Author Topic: How to close all tabs?  (Read 18363 times)

SKAN

  • Newbie
  • *
  • Posts: 3
    • View Profile
How to close all tabs?
« 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?
« Last Edit: June 19, 2013, 05:58:20 by SKAN »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4409
    • View Profile
    • Multi Commander
Re: How to close all tabs?
« Reply #1 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.

SKAN

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How to close all tabs?
« Reply #2 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.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4409
    • View Profile
    • Multi Commander
Re: How to close all tabs?
« Reply #3 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.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4409
    • View Profile
    • Multi Commander
Re: How to close all tabs?
« Reply #4 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.