Page 1 of 2

Closing All Other Tabs...

Posted: 27 Nov 2011 22:35
by Marco
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?

Re: Closing All Other Tabs...

Posted: 27 Nov 2011 22:41
by highend
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.

Re: Closing All Other Tabs...

Posted: 27 Nov 2011 22:46
by Marco
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...

Re: Closing All Other Tabs...

Posted: 27 Nov 2011 22:56
by highend
Then iterate through them and reset the current home location + lock status and after that use the #352 command. Works.

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 09:15
by Marco
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.

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 10:17
by highend

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

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 14:34
by kotlmg
the above code is working like a charm. thanks a lot.

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 15:40
by Marco
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...

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 15:56
by highend
Sure, a scriptable #353 command (that allows us to use it without the security message) would be a much better option...

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 17:52
by admin
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)

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 17:58
by Marco
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*

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 18:03
by admin
:)

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

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 18:38
by PeterH
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:

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 18:44
by Marco
#351?

Edit: you mean a way to close a tab without selecting it (via scripting of course)?

Re: Closing All Other Tabs...

Posted: 28 Nov 2011 19:37
by admin
PeterH wrote:Did you also think of CloseOne, in short: Close? :roll:
Well, now that you mention it ... ... ... done. :)