Page 1 of 2

[Script] Restore closed tabs

Posted: 21 Sep 2012 12:21
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 549 times
Changelog:
v0.1
Completely rewritten


Old downloads: 41

Regards,
Highend

Re: Restore closed tabs

Posted: 21 Sep 2012 12:25
by admin
But note that a closed tab has much more properties than just the path.

Re: Restore closed tabs

Posted: 21 Sep 2012 12:30
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?

Re: Restore closed tabs

Posted: 21 Sep 2012 12:35
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.

Re: Restore closed tabs

Posted: 21 Sep 2012 12:36
by highend
Thanks!

Re: Restore closed tabs

Posted: 24 Sep 2012 16:29
by highend
Updated to v0.2

Changelog:
Store all properties of a tab (path, name, home, iconized, locked, lockedhomezone) instead of only the path

Re: [Script] Restore closed tabs

Posted: 17 Dec 2014 18:26
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:

Re: [Script] Restore closed tabs

Posted: 18 Dec 2014 09:42
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?

Re: [Script] Restore closed tabs

Posted: 18 Dec 2014 10:07
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]);

Re: [Script] Restore closed tabs

Posted: 19 Dec 2014 20:04
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... :)

Re: [Script] Restore closed tabs

Posted: 24 Dec 2014 15:51
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

Re: [Script] Restore closed tabs

Posted: 24 Dec 2014 16:12
by bdeshi
the self-mutation is a nice touch. 8)

Re: [Script] Restore closed tabs

Posted: 24 Dec 2014 20:38
by Enternal
The script has effectively and can... evolve...

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

Re: [Script] Restore closed tabs

Posted: 25 Jul 2018 07:27
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

Re: [Script] Restore closed tabs

Posted: 25 Jul 2018 07:49
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.