How to switch to other tab via script and save the state of the current tab?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Norn
Posts: 504
Joined: 24 Oct 2021 16:10

How to switch to other tab via script and save the state of the current tab?

Post by Norn »

How to switch to other tab via script and save the state of the current tab? Just like the mouse clicks on other tab to switch, and F7 #520.
Sorting and view state are lost via script, I didn't find information about it in the help documentation:

Code: Select all

 seltab +;
 wait 1000;
 tab("close")
Windows 11 24H2 @100% 2560x1440

highend
Posts: 14926
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to switch to other tab via script and save the state of the current tab?

Post by highend »

What has "Go to previous location" or tab("close") to do with "save the state of the current tab" (for whatever that means)? oO
One of my scripts helped you out? Please donate via Paypal

Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Re: How to switch to other tab via script and save the state of the current tab?

Post by Norn »

Forgive my way of explaining. . .
Write something to the Alternate Data Stream and restore the timestamp, the speed of restoring the timestamp is affected by the number of list items:

Code: Select all

 $test = "Test";
 $selected = <get selecteditemspathnames>;
 foreach($item, $selected, <crlf>) {
    $modified = property("#date.m", $item);           // Get modified date
    writefile("$item:Tags", $test, , "utf8bom");      // Set to ADS
    timestamp "m", $modified, $item;                  // Restore timestamp
    }
If I switch to a tab without any items, it's fast. How do I not lose the state of the sort and view when switching back?

Code: Select all

 $test = "Test";
 $selected = <get selecteditemspathnames>;
 tab('new', '"Please Wait. . ."');
 foreach($item, $selected, <crlf>) {
    $modified = property("#date.m", $item);           // Get modified date
    writefile("$item:Tags", $test, , "utf8bom");      // Set to ADS
    timestamp "m", $modified, $item;                  // Restore timestamp
    }

 if (tab("get", "path") == '"Please Wait. . ."') {tab("close")}
Edit: In the search results tab.
Made it with #520:

Code: Select all

 $test = "Test";
 $selected = <get selecteditemspathnames>;
 tab('new', '"Please Wait. . ."');
 foreach($item, $selected, <crlf>) {
    $modified = property("#date.m", $item);           // Get modified date
    writefile("$item:Tags", $test, , "utf8bom");      // Set to ADS
    timestamp "m", $modified, $item;                  // Restore timestamp
    }

 #520;

 foreach($path, get("tabs", <crlf>), <crlf>) {
    $index++;
    if ($path == '"Please Wait. . ."') {
        tab("close", , $index)
        }
    }
Windows 11 24H2 @100% 2560x1440

Post Reply