Closing All Other Tabs...

Discuss and share scripts and script files...

Closing All Other Tabs...

Postby Marco » 27 Nov 2011 22:35

I have a script which, among the others, executes the command #353 (View / Tab / Close All Other Tabs...).
Upon its execution a window pops up, asking if I'm really sure I want to close all the other tabs, even if they have a home set.
Is there any way I can suppress this warning window, or send and Enter stroke automatically?
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby highend » 27 Nov 2011 22:41

I never had any problems with #352; as long as they aren't locked tabs.

Edit: Works (partially), but tabs with a home set aren't closed ;(

Second edit: You could use the tab scripting command and iterate through all available tabs in a pane, remove the home location and then use #352. That would work.
One of my scripts helped you out? Please donate via Paypal if you like: highend (at) web (dot) de
highend
 
Posts: 1887
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Postby Marco » 27 Nov 2011 22:46

Yep, that's why I use #353, I want to end with just one tab and being sure all the others are closed, regardless of their locked/homed/whatever status...
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby highend » 27 Nov 2011 22:56

Then iterate through them and reset the current home location + lock status and after that use the #352 command. Works.
One of my scripts helped you out? Please donate via Paypal if you like: highend (at) web (dot) de
highend
 
Posts: 1887
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Postby Marco » 28 Nov 2011 09:15

After a night spent thinking about that, I realize that the code complexity and run time is not worth, and just pressing Enter is fine enough.
Anyway thanks for your insight.
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby highend » 28 Nov 2011 10:17

Code: Select all
   $i= 0;
   $Tabs = tab(, "c");
   while ($i <= $Tabs) {
      tab("sethome", , $i); //remove home
      tab("lock", 0, $i); //remove lock
      $i++;
   }
   #352;


This was too complex? oO
Last edited by highend on 28 Nov 2011 14:41, edited 1 time in total.
One of my scripts helped you out? Please donate via Paypal if you like: highend (at) web (dot) de
highend
 
Posts: 1887
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Postby kotlmg » 28 Nov 2011 14:34

the above code is working like a charm. thanks a lot.
kotlmg
 
Posts: 184
Joined: 30 Jun 2010 16:14

Re: Closing All Other Tabs...

Postby Marco » 28 Nov 2011 15:40

highend wrote:[cut]This was too complex? oO

Well, thanks for your help, although there's no similar way to take care of tabs with a locked home zone. You can toggle their status, but not programmatically disable it.
A possible way could be:
1. executing your script
2. set the current path as home for each remaining tab
3. toggling their locked home status (which will become off for sure)
4. remove home
5. close all the unlocked. You end with just one tab.
But as you can see, we have at least two while loops plus flickering tabs in a set-and-forget script, compared to a native function that just requires to press Enter.
I'm not sure which is the best...
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby highend » 28 Nov 2011 15:56

Sure, a scriptable #353 command (that allows us to use it without the security message) would be a much better option...
One of my scripts helped you out? Please donate via Paypal if you like: highend (at) web (dot) de
highend
 
Posts: 1887
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Postby admin » 28 Nov 2011 17:52

Voila!
Code: Select all
    + SC tab enhanced: New operation "closeother", analog to "Close All
      Other Tabs..." in menu View | Tab.
      The data parameter can be used to control whether any prompts are
      shown:
        // show no prompts
        tab("closeother");
        // show prompts
        tab("closeother", 1);

8)
admin
Site Admin
 
Posts: 33028
Joined: 22 May 2004 15:48
Location: Cologne

Re: Closing All Other Tabs...

Postby Marco » 28 Nov 2011 17:58

admin wrote:Voila!
Code: Select all
    + SC tab enhanced: New operation "closeother", analog to "Close All
      Other Tabs..." in menu View | Tab.
      The data parameter can be used to control whether any prompts are
      shown:
        // show no prompts
        tab("closeother");
        // show prompts
        tab("closeother", 1);

8)

We would say "make a statue to someone [Don]" over here to express appreciation... *thumbs up*
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby admin » 28 Nov 2011 18:03

:)

BTW, I just changed it to "closeothers", I think it's better english...
admin
Site Admin
 
Posts: 33028
Joined: 22 May 2004 15:48
Location: Cologne

Re: Closing All Other Tabs...

Postby PeterH » 28 Nov 2011 18:38

admin wrote::)

BTW, I just changed it to "closeothers", I think it's better english...

I think the explicit meaning is CloseAllOthers ,so CloseOthers is better than CloseOther :D

Did you also think of CloseOne, in short: Close? :roll:
W7(x64) SP1 German
( +WXP SP3 )
PeterH
 
Posts: 1759
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Closing All Other Tabs...

Postby Marco » 28 Nov 2011 18:44

#351?

Edit: you mean a way to close a tab without selecting it (via scripting of course)?
Marco
 
Posts: 1718
Joined: 27 Jun 2011 14:20

Re: Closing All Other Tabs...

Postby admin » 28 Nov 2011 19:37

PeterH wrote:Did you also think of CloseOne, in short: Close? :roll:
Well, now that you mention it ... ... ... done. :)
admin
Site Admin
 
Posts: 33028
Joined: 22 May 2004 15:48
Location: Cologne

Next

Return to Script Exchange



Who is online

Users browsing this forum: No registered users and 5 guests