News:

MultiCommander v16.6 is released!

Main Menu

How to close all tabs?

Started by SKAN, June 18, 2013, 20:57:29

Previous topic - Next topic

SKAN

I use the following script to close all tabs in ( both panels ) and then open a couple of new explorers:

@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?

Mathias (Author)

Maybe

MC.Explorer.CloseAll

However, It closes all Explorer Panel tabs, It will not close Search tabs.

SKAN

Well, when I tried the following:

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.

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

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.