Page 1 of 2
Tip: Simple file-based favorites
Posted: 18 Oct 2010 18:02
by admin
FYI, with the latest version
v9.60.0013 you can turn simple text files (that just contain a number of paths) into clickable popup menus when you load them as script files.
For example, create a file
goto.xys and paste this:
Code: Select all
Desktop
C:\WINDOWS\system.ini
C:\WINDOWS\system32
Then select the file and click menu
Scripting | Load selected Script File.
Hey, in v9.60.0014 also this will work:
Code: Select all
Desktop
%tmp%
<xydata>
C:\WINDOWS\system.ini
C:\WINDOWS\system32
Re: Tip: Simple file-based favorites
Posted: 18 Oct 2010 18:56
by SkyFrontier
...then I just have to ::load favs or assign an alias for it.
Later I'll add a "edit this script" function for this.
Best of all: under certain circumstances, the little EASIER to handle custom menu will pop under the mouse pointer.
Now I have a fleXYble way to handle my session-based favorites without having to save XY config over and over again. Wow.
The awesomeness of this is fantabulous...
Thanks again, Don!!!

Re: Tip: Simple file-based favorites
Posted: 18 Oct 2010 19:00
by SkyFrontier
Is there a way to easily import (options:) pane 1, pane 2 or both panes' tabs to such "favs.xys", people...?
-if so, now we have another kind of Session Manager, too!!!
Re: Tip: Simple file-based favorites
Posted: 18 Oct 2010 20:34
by Stefan
SkyFrontier wrote:Is there a way to easily import (options:) pane 1, pane 2 or both panes' tabs to such "favs.xys", people...?
Code: Select all
//collect paths from all tabs in current pane:
$TabCount = tab(,"c"); //how many tabs are open?
//$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<=$TabCount) //for each tab do
{
$Tabs = $Tabs . tab("get", "path", $Loop) . "<crlf>";
incr $Loop;
}
writefile("C:\Temp\fav.xys", $Tabs);
//add CTB:
//http://www.xyplorer.com/xyfc/viewtopic.php?p=51737#p51737
$CTB = <<<Heredoc
Snip: CTB 1
XYplorer
Action
NewUserButton
Name
My Temp Favorites
Icon
:favs
ScriptL
Load "C:\Temp\fav";
ScriptR
FireClick
1
Heredoc;
snippet $CTB;
Re: Tip: Simple file-based favorites
Posted: 18 Oct 2010 20:38
by admin
Wow! Funny idea to first wrap the snippet in a script and then the script in a snippet.
But please, don't do the jurassic
incr $Loop; -- do
$Loop++; instead!
Re: Tip: Simple file-based favorites
Posted: 18 Oct 2010 22:32
by SkyFrontier
Added the following code to get the thing running under
CTRL+F (free as default);
-it has the
tab("get", "path", $Loop) . "\<crlf>"; parameter so each path will end with a "\", which will pop a message asking to create a currently non-available location (ideal solution for us, portable soldiers!) - only possible thanks to the
freak paths handling and the
create folders for non-existent locations trick.
--but when you cancel creating such folder XY pops an "
scripting error" message... Can this be avoided?
-tried to write a little "Set Favorites from Tabs/
Inactive Pane", but couldn't do it. Open for suggestions ("pane switcher" dialog?, whatever... - despite this means another dialog to deal with).
-am I missing something or I really can't assign a keyboard shortcut to a script attached under a CTB? That way I could get a cleaner UDC, currently filled with little scripts just to get the ks function...
Code: Select all
"Menu FAVORITES|:favs"
load "<xyscripts>\favs.xys";
"Set Favorites from Tabs/Active Pane|:conf"
//collect paths from all tabs in current pane:
$TabCount = tab(,"c"); //how many tabs are open?
//$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<=$TabCount) //for each tab do
{
$Tabs = $Tabs . tab("get", "path", $Loop) . "\<crlf>";
incr $Loop;
}
writefile("<xyscripts>\favs.xys", $Tabs);
sel;
status "Tabs stored as (Favorites) favs.xys!";
"Edit/Check Favorites File|:udc"
open "<xyscripts>\favs.xys";
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 07:43
by SkyFrontier
Is there an easy way to get
Hotlist as a source for building this list, too?
It's
Hotlist's main goal to keep track of the most accessed folders, so it's a reliable source for such a task.
It seems to be stored under "actions.dat", but it should be an easier way to export it via List Management > select all and copy (currently not possible even for the simple History itself).
Side note: if such functionality can be implemented, please make the outputs ending with a "\", so the "create if non-existent" trick can be supported for this.
----
The below script is a version that offers access to a
PermaFavorites list, so it can list "Hotlist" content if/when supported. That way "favs" can be a session manager, and "favsp", a reliable file-base favorites.
Layout was made having usability in mind, so the most common items are placed on top positions.
Code: Select all
"PERMAfavorites|:favfiles"
load "<xyscripts>\favsp.xys";
"Menu FAVORITES|:favs"
load "<xyscripts>\favs.xys";
"Set Favorites from Tabs/Active Pane|:conf"
//collect paths from all tabs in current pane:
$TabCount = tab(,"c"); //how many tabs are open?
//$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<=$TabCount) //for each tab do
{
$Tabs = $Tabs . tab("get", "path", $Loop) . "\<crlf>";
incr $Loop;
}
writefile("<xyscripts>\favs.xys", $Tabs);
sel;
status "Tabs stored as (Favorites) favs.xys!";
"Edit/Check Favorites File|:udc"
open "<xyscripts>\favs.xys";
"Set PERMAFavorites from Tabs/Active Pane|:conf"
//collect paths from all tabs in current pane:
$TabCount = tab(,"c"); //how many tabs are open?
//$Pane = getinfo("Pane"); //which pane is active?
$Loop = 1;
$Tabs = "";
while ($Loop<=$TabCount) //for each tab do
{
$Tabs = $Tabs . tab("get", "path", $Loop) . "\<crlf>";
incr $Loop;
}
writefile("<xyscripts>\favsp.xys", $Tabs);
sel;
status "Tabs stored as (Favorites) favs.xys!";
"Edit/Check PERMAFavorites File|:udc"
open "<xyscripts>\favsp.xys";
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 07:50
by admin
SkyFrontier wrote:Added the following code to get the thing running under
CTRL+F (free as default);
-it has the
tab("get", "path", $Loop) . "\<crlf>"; parameter so each path will end with a "\", which will pop a message asking to create a currently non-available location (ideal solution for us, portable soldiers!) - only possible thanks to the
freak paths handling and the
create folders for non-existent locations trick.
--but when you cancel creating such folder XY pops an "
scripting error" message... Can this be avoided?
Currently not. This might be important information for the user running the script so I think it should stay as it is.
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 15:14
by SkyFrontier
SkyFrontier wrote:Currently not. This ("scripting error" message) might be important information
Agree on this but still see as a valid request since disabling such dialogs individually and temporally (like the "AllowRecursion" trick) makes sense for known scripts - the ones we tested over time and see that the only (minor) issue is this.
----
Regarding the
Hotlist/Recent Locations items export, what about adding a "Copy/Export locations" button on the bottom of them?
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 15:29
by TheQwerty
SkyFrontier wrote:Agree on this but still see as a valid request since disabling such dialogs individually and temporally (like the "AllowRecursion" trick) makes sense for known scripts - the ones we tested over time and see that the only (minor) issue is this.
In that case the script writer can work around it by checking the existence with Exists and then prompting (Confirm) the user to create (New) or ignore.
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 15:34
by SkyFrontier
TheQwerty wrote:SkyFrontier wrote:Agree on this but still see as a valid request since disabling such dialogs individually and temporally (like the "AllowRecursion" trick) makes sense for known scripts - the ones we tested over time and see that the only (minor) issue is this.
In that case the script writer can work around it by checking the existence with Exists and then prompting (Confirm) the user to create (New) or ignore.
The
skilled script writers, you mean?
Thanks for the tip, TheQwerty - hope I manage to achieve that effect (there's a good bunch of my own scripts I'd need to revise against this, but - not for now while I don't know how...).
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 15:42
by TheQwerty
SkyFrontier wrote:The
skilled script writers, you mean?
Thanks for the tip, TheQwerty - hope I manage to achieve that effect (there's a good bunch of my own scripts I'd need to revise against this, but - not for now while I don't know how...).
I actually have to take that back anyhow... I wasn't paying attention but with the implied goto, and the format of the above script there really isn't a way for you to add such a check easily.
You could only write out the locations which exist to your favs*.xys files, but that wouldn't necessarily be portable.
or
You could add a wrapper around the whole thing that would read the files and perform a check as mentioned and then Load the modified contents of the favs*.xys (it shouldn't need to modify the file's written data).
However, it might be easier to get one of the existing tab manager scripts working with a simple flat favorites file.
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 16:06
by SkyFrontier
Code: Select all
v9.60.0014 - 2010-10-19 13:02
+ Scripting: The multi-script goto-shorthand now also supports
environment and native variables, name searches, and visual
filters. For example:
Desktop
%tmp%
<xydata>
C:\WINDOWS\system.ini
C:\WINDOWS\system32
C:\WINDOWS\system32?a*
C:\WINDOWS\system32?:a* or b*
C:\WINDOWS\system32?:a* | b*
C:\WINDOWS\system32?tag:blue
C:\WINDOWS\system32|a*
The thing is powerful - I used the "
goto "*?tag:*"" pattern in it and IT WORKED!!!
Don, do you plan to offer custom icons and label/caption support for this one, too? Or will this necessarily conflict with Visual Filter?
C:\Documents and Settings\Admin\Dados de aplicativos\Local Stuff\Administrative\System Wide\Microsoft\SystemCertificates\My\Certificates\|*VISUAL FILTER* (whatever value)|:props (Icon)|Admin SysCerts (caption to be displayed instead of this longish path)
----
TheQwerty:
However, it might be easier to get one of the existing tab manager scripts working with a simple flat favorites file.
Would you mind in building a sample code on this actually working?
I just
can't see how this could be done the way you describe (sorry...).
Remember: the aim is to avoid the (now called) XYplorer Scripting message when clicking "Cancel" at the "not available: create?" dialog, invoked by trying to go to a currently non-existent location from the new file-based favs.
----
Generic tip:
I've workaround'ed the list building limitation using
Yankee Clipper: it was a mere question of "click Hotlist item > press CTRL+C > loop" (to my surprise the items are kept focused on address bar, so it was a piece of cake!!!). The list was built inversely (top to bottom, 1st items being the last ones), but that is a minor problem for Cream/VIM. It's strange having to get away from home...

Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 16:17
by TheQwerty
SkyFrontier wrote:However, it might be easier to get one of the existing tab manager scripts working with a simple flat favorites file.
Would you mind in building a sample code on this actually working?
I just
can't see how this could be done the way you describe (sorry...).
Remember: the aim is to avoid the (now called) XYplorer Scripting message when clicking "Cancel" at the "not available: create?" dialog, invoked by trying to go to a currently non-existent location from the new file-based favs.
My suggestion avoids seeing XY's "create?" dialog entirely.
But no, I don't have the time to build something on top of someone's tab manager.
Re: Tip: Simple file-based favorites
Posted: 19 Oct 2010 17:51
by admin
SkyFrontier wrote:Code: Select all
v9.60.0014 - 2010-10-19 13:02
+ Scripting: The multi-script goto-shorthand now also supports
environment and native variables, name searches, and visual
filters. For example:
Desktop
%tmp%
<xydata>
C:\WINDOWS\system.ini
C:\WINDOWS\system32
C:\WINDOWS\system32?a*
C:\WINDOWS\system32?:a* or b*
C:\WINDOWS\system32?:a* | b*
C:\WINDOWS\system32?tag:blue
C:\WINDOWS\system32|a*
The thing is powerful - I used the "
goto "*?tag:*"" pattern in it and IT WORKED!!!
Don, do you plan to offer custom icons and label/caption support for this one, too?
This is a shorthand version for those who are happy with the vanilla choices. If you want more use the longhand:
