Page 1 of 1

Starting a script by clicking on file/folder and markers

Posted: 18 Aug 2021 16:25
by zakhar
Hello, dear XYplorer Community!

My wish is as follows:
XYplorer should have a function to load a script by clicking directly on a file / folder.

I use many lnk-files to open folders and files.
But the problem is, that the lnk-files of windows open/start only
one item at once. (Using bat-files is not convenient for me). The mentioned function of XYplorer would make possible
to not only open files/folders, but also add any scripting functionality
to this action and therefore effectively replace lnk-files of windows for those
using this function.

My "subwish" in this direction is that XYplorer could be able to load a script if a file/folder
is clicked, which name contains a marker, that could be recognised by XYplorer as a command
to open an associated script. The marker and the associated script could be defined
by user somewhere in XYplorer's settings.
Example:
The file name is "birthdays_list_X123.xls" or "birthdays_X123_list.xls" or "X123_birthdays_list.xls".
The "X123" sequence is set by user as marker to load a script.xys.
Every time a file/folder with "X123" sequence is clicked in XYplorer the script.xys is executed.
This mechanism could also work if XYplorer is commanded to open a file / folder with
marker sequence per command line.

Thank you!

Re: Starting a script by clicking on file/folder and markers

Posted: 18 Aug 2021 16:44
by highend
You are free to use CFAs to do this (at least by double clicking on files)...

Code: Select all

*>::load "your script to handle everything.xys";
and markers?

Tag those items and let the initial script decide what to do and what subscript to load by reading that tag...

Re: Starting a script by clicking on file/folder and markers

Posted: 18 Aug 2021 18:01
by zakhar
Thanks, highend!
It does what I wanted!

Re: Starting a script by clicking on file/folder and markers

Posted: 19 Aug 2021 16:26
by zakhar
I have added the line

Code: Select all

lnk>..\script.xys
under CFAs.

Is it possible to conditionally bypass this setting in the script.xys?

The problem is, that the code placed in the script.xys

Code: Select all

open "C:\...\*.lnk";
that normally leads to the normal function of a lnk-file (opening of something by XYplorer)
makes a loop and loads the script.xys again.

Re: Starting a script by clicking on file/folder and markers

Posted: 19 Aug 2021 16:55
by highend
Don't use open on a lnk?

Get the #LinkTarget property of the clicked .lnk and use a goto instead

Re: Starting a script by clicking on file/folder and markers

Posted: 19 Aug 2021 18:48
by zakhar
Yes!
It works!
Thank you, highend!