Here's your fix (please report if something went wrong).
It's a dumb solution - but it seems to work fine.
Also, incorporated Mr_Inc's suggestion on the code - seems to work fine.
Code: Select all
//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:
"Store Session/Tabs"
$SubFolderName = "%computername%"; //"Work"; //sub-folder in sessions-folder
$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) . "|"; //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\$SubFolderName")==0) {new "<xydata>\Sessions\$SubFolderName", dir;}
$DefaultFileName = "<xydata>\Sessions\$SubFolderName\<date yyyymmdd hhnn>_Pane" . $Pane . ".ini";
//
$SessionFile = Input("Save Session", "Save list of tabs as: (you may add an description into the file name)", $DefaultFileName);
//$SessionFile = $DefaultFileName;
//
// copytext $SessionFile;
new "$SessionFile";
writefile($SessionFile, $Tabs, "o");
$Comment = Input("Session comment", "Enter an comment for this session (optional)",,"s","");
comment $Comment, $SessionFile;
// ///////////////////////////////////////////////////////////////////////
// open new tabs from an list of paths (saved tabs):
"Load Session/Tabs"
//read session file into array "$Tabs":
$SubFolderName = "%computername%"; //"Work"; //sub-folder in sessions-folder
$SessionFile = inputfile("<xydata>\Sessions\$SubFolderName", "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
-
"Edit this &script : edit"
self $ScriptFile, file;
//OpenWith "<xypath>\Tools\NotePad2\Notepad2.exe", ,$ScriptFile;
OpenWith "Notepad", ,$ScriptFile;
XYplorer Beta Club