Multi Commander > Script
How to close all tabs?
(1/1)
SKAN:
I use the following script to close all tabs in ( both panels ) and then open a couple of new explorers:
--- Code: ---@var $n;
for( $n = 0; $n <= 20; $n++)
{
MC.RunCmd ID=core.20002; // Ctrl+W
}
MC.Explorer.NewBrowser SIDE=LEFT PATH="C:\";
MC.Explorer.NewBrowser SIDE=RIGHT PATH="D:\"
--- End code ---
I feel uncomfortable with a limit of 20 tabs. Can anybody suggest a better way?
Mathias (Author):
Maybe
--- Code: ---MC.Explorer.CloseAll
--- End code ---
However, It closes all Explorer Panel tabs, It will not close Search tabs.
SKAN:
Well, when I tried the following:
--- Code: ---MC.Explorer.CloseAll;
MC.Explorer.NewBrowser SIDE=LEFT PATH="C:\";
MC.Explorer.NewBrowser SIDE=RIGHT PATH="D:\"
--- End code ---
.. the new browsers appear and vanishes immediately. :(
I tried inserting a sleep( 5000) but it does not help.
Mathias (Author):
Hmm too bad..
Think is is because CloseAll is sent as an async operation. and since the script is running in main thread it is not processed until script ends.
Mathias (Author):
For the next version I will add
--- Code: ---MC.CloseAllTabs
MC.CloseAllTabs LEFTONLY
MC.CloseAllTabs RIGHTONLY
--- End code ---
And since it is under the core "MC" namespace it will close ALL of them. Even search tabs or other extensions, and It does not need to be handled async.
Navigation
[0] Message Index
Go to full version