starting a script by clicking on a PaperFolder item

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

starting a script by clicking on a PaperFolder item

Post by zakhar »

Hello, dear XYplorer Community!

I would like to know, if it is possible to start a script by clicking on a paperfolder item.
(something like Custom File Associations)

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

Re: starting a script by clicking on a PaperFolder item

Post by highend »

Single click directly on the item? No. Double-click, sure, use a CFA with a script...
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

Re: starting a script by clicking on a PaperFolder item

Post by zakhar »

highend wrote: ↑02 Nov 2021 14:34 Single click directly on the item? No. Double-click, sure, use a CFA with a script...
What I do not understand is what I should write there in CFA so that CFA understands, that the call comes from a paperfolder item.

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

Re: starting a script by clicking on a PaperFolder item

Post by highend »

Code: Select all

if (regexmatches(tab("get", "path"), "^paper:")) {
    // do something here?
}
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1422
Joined: 26 Sep 2013 15:22

Re: starting a script by clicking on a PaperFolder item

Post by autocart »

zakhar,
A paperfolder item, what is that for you?
An item inside a paperfolder, i.e. when you have the paperfolder open in the list view and you are then clicking on one of those items in that list view?

zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

Re: starting a script by clicking on a PaperFolder item

Post by zakhar »

highend wrote: ↑02 Nov 2021 14:42

Code: Select all

if (regexmatches(tab("get", "path"), "^paper:")) {
    // do something here?
}
highend, this is already a script.
I mean the CFA must be given as "[file extension or "something mentioned in XYplorer's Help file under CFA"]>[action]".
Edit: And the paperfolders are not mentioned in "XYplorer's Help file under CFA".
autocart wrote: ↑02 Nov 2021 14:46 A paperfolder item, what is that for you?
XYplorer's Help file: "Paper Folders are simple text files that contain the full paths to items, one per line. XYplorer employs those files as virtual folders.".
autocart wrote: ↑02 Nov 2021 14:46 when you have the paperfolder open in the list view and you are then clicking on one of those items in that list view?
I would say not "when you have the paperfolder open" but "when you have the paperfolder loaded".
Last edited by zakhar on 02 Nov 2021 15:08, edited 1 time in total.

zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

Re: starting a script by clicking on a PaperFolder item

Post by zakhar »

I have found something under CFA in XYplorer's Help file:
"Variables
XYplorer native variables and environment variables are supported in the pattern list. E.g., the following pattern will only match TXT files in the Paper Folder folder:
<xypaper>\*.txt>::echo <focitem>;".
I will try it now.

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

Re: starting a script by clicking on a PaperFolder item

Post by highend »

So you were not talking about paper folder items but the paper folder files themselves...
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1422
Joined: 26 Sep 2013 15:22

Re: starting a script by clicking on a PaperFolder item

Post by autocart »

zakhar wrote: ↑02 Nov 2021 14:56 I mean the CFA must be given as "[file extension or "something mentioned in XYplorer's Help file under CFA"]>[action]".
[action] can be a one-line script:
["something mentioned in XYplorer's Help file under CFA"]>::if (regexmatches(tab("get", "path"), "^paper:")) {// do if paper} else {//do if not paper}

EDIT:
To open a non-paper-folder-item with the default application:
["something mentioned in XYplorer's Help file under CFA"]>::if (regexmatches(tab("get", "path"), "^paper:")) {// do if paper item} else {open <pfaitem>, w;}

zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

Re: starting a script by clicking on a PaperFolder item

Post by zakhar »

highend wrote: ↑02 Nov 2021 15:14 So you were not talking about paper folder items but the paper folder files themselves...
No! :)
PaperFolder Items in my posts are folders or files represented in the XYplorer's list after XYplorer has loaded the txt-file as paperfolder.

zakhar
Posts: 179
Joined: 08 Sep 2010 21:13

Re: starting a script by clicking on a PaperFolder item

Post by zakhar »

Code: Select all

<xypaper>\*.txt>::load "<xypath>\Data\Scripts\pf.xys";
does not work as I expect it to work:
After clicking on an item (a folder in the XYplorer's list in a loaded paperfolder)
the experimental script pf.xys (only

Code: Select all

echo "1";
) does not start.

Do not know what to do. :cry:
Last edited by zakhar on 02 Nov 2021 15:58, edited 1 time in total.

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

Re: starting a script by clicking on a PaperFolder item

Post by highend »

Of course not. CFA doesn't support folders, use a custom event action with a changing location event for these
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1422
Joined: 26 Sep 2013 15:22

Re: starting a script by clicking on a PaperFolder item

Post by autocart »

zakhar wrote: ↑02 Nov 2021 15:54

Code: Select all

<xypaper>\*.txt>::load "<xypath>\Data\Scripts\pf.xys";
does not work as I expect it to work:
After clicking on an item (a folder in the XYplorer's list in a loaded paperfolder)
the script pf.xys (only echo "1";) does not start.

Do not know what to do. :cry:
Of course. You quoted it yourself.
wrote:E.g., the following pattern will only match TXT files in the Paper Folder folder:
<xypaper>\*.txt>::echo <focitem>;".
Put <xypaper> in the address bar and hit Enter. Then you will understand. That's why highend got confused with what you want.

autocart
Posts: 1422
Joined: 26 Sep 2013 15:22

Re: starting a script by clicking on a PaperFolder item

Post by autocart »

zakhar wrote: ↑02 Nov 2021 15:54

Code: Select all

<xypaper>\*.txt>::load "<xypath>\Data\Scripts\pf.xys";
After clicking on [...] a folder
highend wrote: ↑02 Nov 2021 15:58 Of course not. CFA doesn't support folders, use a custom event action with a changing location event for these
Oh, but even if CFA did support folders, why do you, zakhar expect *.txt to be triggered when clicking a folder?

autocart
Posts: 1422
Joined: 26 Sep 2013 15:22

Re: starting a script by clicking on a PaperFolder item

Post by autocart »

zakhar wrote: ↑02 Nov 2021 15:54 Do not know what to do. :cry:
Did you already try what highend and me wrote up above?
I don't think so. E.g. viewtopic.php?p=192451#p192451

Post Reply