[Script] Restore closed tabs

Discuss and share scripts and script files...
highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

[Script] Restore closed tabs

Post by highend »

Completely rewritten. It's a self-modifing script now (which means: all definitions of closed tabs are stored in the script, no .ini file necessary).

This script saves all closed tabs so you can easily restore them later. All properties of the closed tab are saved as well (iconized, home zone, locked status, etc.)!

It's not session dependent and you can limit the number of entries.

If you want to change it, change this line:

Code: Select all

$limit = 16;
Ofc you need to close the current tab through this script! It requires a recent beta to work (>= v14.70.0011)

Current version
v0.1
RestoreClosedTabs_v0.1.zip
(1.34 KiB) Downloaded 414 times
Changelog:
v0.1
Completely rewritten


Old downloads: 41

Regards,
Highend
Last edited by highend on 07 Jan 2013 09:37, edited 2 times in total.
One of my scripts helped you out? Please donate via Paypal

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

Re: Restore closed tabs

Post by admin »

But note that a closed tab has much more properties than just the path.

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Restore closed tabs

Post by highend »

Absolutely.

It was written because of a user request and he didn't mention any special requirements (apart from the path) (http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=8630).

I currently don't plan to change it's behavior (to include properties like iconized, locked, etc.).

EDIT: Btw, Don, why does getkey use parenthesis while setkey does not?
One of my scripts helped you out? Please donate via Paypal

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

Re: Restore closed tabs

Post by admin »

highend wrote:EDIT: Btw, Don, why does getkey use parenthesis while setkey does not?
getkey() is a function with a return value. Those must be used with parentheses.
setkey has no return value, parentheses are optional.

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Restore closed tabs

Post by highend »

Thanks!
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Restore closed tabs

Post by highend »

Updated to v0.2

Changelog:
Store all properties of a tab (path, name, home, iconized, locked, lockedhomezone) instead of only the path
Attachments
RestoreTabs.xys
(6.46 KiB) Downloaded 379 times
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: [Script] Restore closed tabs

Post by bdeshi »

use the script in the ^^first post^^ .
A new version for this request: http://www.xyplorer.com/xyfc/viewtopic. ... 44#p115343

changes:
* Confirmation before closing locked tabs or tabs with home location set.
(* also upped the history limit to 16.)

ed: v0.22 fixed an embarrassing error. :oops:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: [Script] Restore closed tabs

Post by highend »

@Don

If you really don't want to bring this to XY natively could you please give us the option to get the icon of a tab via tab("get", "icon") so that we can restore the full state of closed tabs?
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: [Script] Restore closed tabs

Post by bdeshi »

It's already possible in the way your script works.
tab icons are stored in the caption which is in turn sved as C# keys in pane.ini.
So in your script you could just do this to get (and later restore) the complete caption along with icons.

Code: Select all

$TabCaption = getkey("C" . $curTabID, "Tabs", "<xydata>\Panes\" . $random . "\pane.ini");
//$TabIcon = gettoken($TabCaption,2,"|");
EDIT:
Oh, and even easier:

Code: Select all

echo gettoken(tab(get, name),2,"|");
and the icon could be reapplied with tab(rename,[caption|icon]);
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: [Script] Restore closed tabs

Post by highend »

Yeah, that's rather easy :)

I hope Don fulfills my request for the tab("get", "home") and then I can dismiss most of the code of this script... :)
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: [Script] Restore closed tabs

Post by highend »

A "new" version is up (in fact the version is set back to v0.1)...

- Completely rewritten (because Don added e.g. tab("get", "home"))
- Self-modifing script

Bugs -> New year xD
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: [Script] Restore closed tabs

Post by bdeshi »

the self-mutation is a nice touch. 8)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: [Script] Restore closed tabs

Post by Enternal »

The script has effectively and can... evolve...

Ok... time to play some Pokemon :biggrin:

enteleform
Posts: 4
Joined: 25 Jul 2018 06:31

Re: [Script] Restore closed tabs

Post by enteleform »

highend wrote:Completely rewritten. It's a self-modifing script now (which means: all definitions of closed tabs are stored in the script, no .ini file necessary).
It seems like the current version of the script may be incomplete?

I tried installing this via the instructions given in a post by @SammaySarkar
viewtopic.php?f=5&t=12990&p=115344#p115341

The following error occurs:
Image

jupe
Posts: 2794
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: [Script] Restore closed tabs

Post by jupe »

Edit the button actions to match below, or use this snippet instead, follow previous instructions for how.

Code: Select all

Snip: CTB 1
  XYplorer 14.70.0002, 12/17/2014 9:32:29 PM
Action
  NewUserButton
Name
  Tab Re-opener
Icon
  :closetab
ScriptL
  ::load "RestoreClosedTabs", "#2";
ScriptR
  ::load "RestoreClosedTabs";
FireClick
  0
If you choose to edit you current button instead, make sure the filename matches the file you put in the scripts folder, I changed it in the above snippet to match the file in the zip downloaded from the linked post. The new version of the script pops a menu to select which tab you want to restore, I assume the previous version had different functionality.

edit: But It looks like the old version of the script is here: viewtopic.php?f=7&t=8633#p76999, which should match the snippet you have already used, if you would rather just replace the xys file.

Post Reply