Multi Commander Support Forum

Multi Commander => Script => Topic started by: SKAN on June 18, 2013, 20:57:29

Title: How to close all tabs?
Post by: SKAN on June 18, 2013, 20:57:29
I use the following script to close all tabs in ( both panels ) and then open a couple of new explorers:

Code: [Select]
@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:\"

I feel uncomfortable with a limit of 20 tabs. Can anybody suggest a better way?
Title: Re: How to close all tabs?
Post by: Mathias (Author) on June 18, 2013, 21:42:12
Maybe

Code: [Select]
MC.Explorer.CloseAll
However, It closes all Explorer Panel tabs, It will not close Search tabs.
Title: Re: How to close all tabs?
Post by: SKAN on June 19, 2013, 06:04:31
Well, when I tried the following:

Code: [Select]
MC.Explorer.CloseAll;
MC.Explorer.NewBrowser SIDE=LEFT  PATH="C:\";
MC.Explorer.NewBrowser SIDE=RIGHT PATH="D:\"

.. the new browsers appear and vanishes immediately.  :(
I tried inserting a sleep( 5000) but it does not help.
Title: Re: How to close all tabs?
Post by: Mathias (Author) on June 19, 2013, 06:59:36
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.
Title: Re: How to close all tabs?
Post by: Mathias (Author) on June 19, 2013, 08:16:09
For the next version I will add

Code: [Select]
MC.CloseAllTabs
MC.CloseAllTabs LEFTONLY
MC.CloseAllTabs RIGHTONLY

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.