Serendipity wrote:OK, but why don't you want search templates? You can easily build them.
As far as I know they will involve searching the whole drives, and speed is everything to me in this case.
---
Raw code (tested a bit and works hmmmmm... fine, despite the tons of duplicates and not handling the required sorting).
Code: Select all
//Tags Handler - based off Stefan's Save Sessions script, desperately revamped by SkyFrontier.
//needs latest XYplorer BETA version (v9.30.0014, 25-jul-2010) or newer
//Note: depending on your XY settings something may not work as indented.
// save an list of current open Tabs from current pane to an file:
"Add Focused Folder to TargetFolders.ini|:showfolders"
$b = report("{fullname}|2|<crlf>", 1);
writefile("<xydata>\Sessions\MultiTargets\TargetFolders.ini", "$b", a, ta);
"Store Tabs into TargetFolders.ini|:go"
$TabCount = tab(,"c"); //how many tabs are open?
$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<$TabCount+1) //for each tab do
{
//if (strlen(tab("get","name") < 1)
$IFTabNameSet = strlen(tab("get","name",$Loop));
if ($IFTabNameSet < 1)
{
$Tabs = $Tabs . tab("get", "data", $Loop) . "|2|<crlf>"; //save the path in array "$Tabs" with | as delimiter
}else{
$Tabs = $Tabs . tab("get", "data", $Loop) . "?" . tab("get", "name", $Loop) . "|"; //save the tab caption too
}
incr $Loop;
}
//save the array to an file:
//$folder = inputfolder("<xydata>\sessions", "Select Folder");
IF (exists("<xydata>\Sessions\MultiTargets")==0) {new "<xydata>\Sessions\MultiTargets", dir;}
$DefaultFileName = "<xydata>\Sessions\MultiTargets\TargetFolders" . ".ini";
//
$SessionFile = Input("Save Session", "Save list of tabs as: (avoid saving it externally to XYpath)", $DefaultFileName);
writefile($SessionFile, "$Tabs", "a", "u");
"Add Inactive Pane's Folder to Focused Generic .ini|:showfolders"
$c = <get item>;
$b = "<get item i>|";
writefile("$c", "$b", a, ta);
"Load Tabs from Focused Generic .ini and Save them Into TargetFolders.ini|:undo"
//read session file into array "$Tabs":
$SessionFile = inputfile("<curitem>", "ini", "Load list of tabs");
$Tabs = readfile($SessionFile);
$Loop = 1;
//a little bit clean up first?
$CloseCurrentOpenTabs = confirm("Close current open tabs first?");
if ($CloseCurrentOpenTabs==0) { ;} elseif (tab(,"c")>1) {#353;} //close all "other" tabs
$Loop = 1;
While(1)
{
$NewTab = gettoken($Tabs,$Loop,"|");
if ($NewTab==""){break;}
if (strpos($NewTab,"?") == -1)
{
tab("new", $NewTab); //open new tab with next token from array
}else{
tab("new", gettoken($NewTab,1,"?"));
tab("rename", gettoken($NewTab,2,"?"));
}
incr $Loop;
}
if ($CloseCurrentOpenTabs==1){seltab 1;#351;} //close last "old" tab too
//Writing starts here:
$TabCount = tab(,"c"); //how many tabs are open?
$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<$TabCount+1) //for each tab do
{
//if (strlen(tab("get","name") < 1)
$IFTabNameSet = strlen(tab("get","name",$Loop));
if ($IFTabNameSet < 1)
{
$Tabs = $Tabs . tab("get", "data", $Loop) . "|2|<crlf>"; //save the path in array "$Tabs" with | as delimiter
}else{
$Tabs = $Tabs . tab("get", "data", $Loop) . "?" . tab("get", "name", $Loop) . "|"; //save the tab caption too
}
incr $Loop;
}
//save the array to an file:
//$folder = inputfolder("<xydata>\sessions", "Select Folder");
IF (exists("<xydata>\Sessions\MultiTargets")==0) {new "<xydata>\Sessions\MultiTargets", dir;}
$DefaultFileName = "<xydata>\Sessions\MultiTargets\TargetFolders" . ".ini";
//
$SessionFile = Input("Save Session", "Save list of tabs as: (avoid saving it externally to XYpath)", $DefaultFileName);
//$SessionFile = $DefaultFileName;
writefile($SessionFile, "$Tabs", "a", "u");
"Write TargetFolders.ini into Tag.dat|:udc"
$a = readfile("<xydata>\Sessions\MultiTargets\TargetFolders.ini");
copytext $a;
writefile("<xydata>\tag.dat", "$a", a, tu);
"Edit this Script|:paste"
self $ScriptFile, file;
//OpenWith "<xypath>\Tools\NotePad2\Notepad2.exe", ,$ScriptFile;
OpenWith "Notepad", ,$ScriptFile;
-you do have a better idea an can do it better?
OF COURSE YOU'RE WELCOME TO DO THIS!!!
EDIT:
-better wording;
-cleaner coding;
-writing ability expanded (now works with a generic text/.ini file or hardcoded TargetFolders.ini, using them both to store and load tabs info);
-small bug fixes related to appending functions;
-"tu" mode set to write tag.dat.
Unable to do: I saw a regEx based solution which could collapse all duplicates to single instances, but was unable to find it anywhere (here on forums or external sites). Any help on this...?
(Manual) cleaning database doesn't solve this...
