Closing All Other Tabs...

Discuss and share scripts and script files...
Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Closing All Other Tabs...

Post 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?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Post 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.
One of my scripts helped you out? Please donate via Paypal

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Closing All Other Tabs...

Post 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...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Post by highend »

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

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Closing All Other Tabs...

Post 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.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Post 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
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

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: Closing All Other Tabs...

Post by kotlmg »

the above code is working like a charm. thanks a lot.

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Closing All Other Tabs...

Post 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...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Closing All Other Tabs...

Post by highend »

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

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Closing All Other Tabs...

Post 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)

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Closing All Other Tabs...

Post 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*
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Closing All Other Tabs...

Post by admin »

:)

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

PeterH
Posts: 2776
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Closing All Other Tabs...

Post 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:
W7(x64) SP1 German
( +WXP SP3 )

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Closing All Other Tabs...

Post by Marco »

#351?

Edit: you mean a way to close a tab without selecting it (via scripting of course)?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Closing All Other Tabs...

Post by admin »

PeterH wrote:Did you also think of CloseOne, in short: Close? :roll:
Well, now that you mention it ... ... ... done. :)

Post Reply