http://www.xyplorer.com/xyfc/viewtopic. ... 943#p43943
But I wanted the ability to swap the entire panes around with all the tabs moving between the panes. I succeeded with this hash up of the above code:
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 panes to P1.ini and P2.ini
$CurrentPane = get("Pane"); // Remember active Pane to be restored later
$LoopPane = 1;
while ($LoopPane<3) // do for Panes 1 and 2
{
Focus "P$LoopPane";
$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;}
writefile("<xydata>\Sessions\$SubFolderName\P$LoopPane.ini", $Tabs, "o"); //Write either P1.ini or P2.ini
incr $LoopPane;
}
// ///////////////////////////////////////////////////////////////////////
// open new tabs from P1.ini and P2.ini:
$LoopPane = 1;
while ($LoopPane<3) // Loop between Pane 1 and Pane 2
{
Focus "P$LoopPane"; //Focus on Pane#
//read session file into array "$Tabs":
if ($LoopPane=="1") {$Tabs = readfile("<xydata>\Sessions\$SubFolderName\P2.ini")}; //Load Opposite Saved Pane
if ($LoopPane=="2") {$Tabs = readfile("<xydata>\Sessions\$SubFolderName\P1.ini")}; //Load Opposite Saved Pane
//a little bit clean up first?
#352; //Close all Tabs no prompt
$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;
}
seltab +1; // Select first tab (Remnant of old tab layout)
#351; //Delete First Tab for tidy up
incr $LoopPane; // Do other Pane
}
Focus "P"."$CurrentPane"; //Restore focus to original Pane
XYplorer Beta Club