<pfaitem> items are passed one-by-one?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
admin
Site Admin
Posts: 66300
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by admin »

Currently not. This would be MAJOR for you and me.

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: <pfaitem> items are passed one-by-one?

Post by binocular222 »

SammaySarkar wrote:I think PFA can benefit from a mechanism where the PFA (script) is called only once, by some kind of notation like the existing |-prefix to disable auto-execute.
No need to change #160, just change PFA as Sammay suggest
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

Just to clarify:
I think PFA can benefit from a mechanism where the PFA (script) is called only once even when multiple items are selected, by some kind of notation like the existing |-prefix to disable auto-execute.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

Just to clarify: It's not PFA. It's "Open Selected Item(s)" that does the calls. No change in PFA can possibly affect this.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

Darn. Guess we'll have to make do with giant scripts.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

I thought about it again. The "Open Selected Item(s)" code is almost 10 years old. It might just be about time to change it a little. I just cannot see a good reason anymore why it behaves so differently from the "Open With..." code. And worse, I just cannot see a good reason why all selected items should be opened one by one.

So, this will be changed experimentally. Let's see if it survives the weekend.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

Thanks for the consideration, but now PFI PFA isn't available for multiple selection. Looks like a vicious circle.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

It's consistent now. What is not working anymore. Example?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

Oh it's working alright, but:

single selection, ENTER: PFA assoc.
plural selection, ENTER: System assoc. (apparently). :veryconfused: minor security risk too. (why? I have a bat;cmd;vbs... pfa to open them in notepad. Now multisel+return executes them.)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

Give a concrete example. Under the hood this is very complex. I need exact data to respond.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

example PFA

Code: Select all

+bat;cmd;vbs;wsh>notepad
example BATs

Code: Select all

::$str = '%COMSPEC% /K echo %0% says hello!'; writefile('a.bat', $str, r); writefile('b.bat', $str, r); writefile('c.bat', $str, r);
Now select one bat and enter. then select all bats and enter.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

Whoops, that was not the plan. :bug: ! Fix coming soon.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

programs are sent selected files as space-separated args. (sidenote: if this persists, <pfaitem> needs a clone <pfaitems> to be grammatically correct :whistle: )
Scripted PFAs just seems to trigger once for the focused item.

:tup: Almost there, now all that's missing is a way to somehow toggle between current and previous behavior: exec pfa once-for-all/exec pfa one-by-one for all.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: <pfaitem> items are passed one-by-one?

Post by admin »

SammaySarkar wrote:programs are sent selected files as space-separated args. (sidenote: if this persists, <pfaitem> needs a clone <pfaitems> to be grammatically correct :whistle: )
Scripted PFAs just seems to trigger once for the focused item.

:tup: Almost there, now all that's missing is a way to somehow toggle between current and previous behavior: exec pfa once-for-all/exec pfa one-by-one for all.
1. That's by design. <pfaitem> is the item that determines the opening application/script. The script then can handle all selected items.

2. You mean a setting in configuration? And, why would a multiple instance call of same-type items be necessary? Do you have a specific case?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: <pfaitem> items are passed one-by-one?

Post by bdeshi »

admin wrote:1. That's by design. <pfaitem> is the item that determines the opening application/script. The script then can handle all selected items.
OK, OK. This part is what I wished for, But here's a bug: it works only as long as all selected files match the PFA.

Code: Select all

+bat>::echo <pfaitem>;
+txt>notepad
select only batch file(s) and ENTER, their pfa will run once for focused file. But add txt file to the selection and ENTER, and now the PFA script will be run multiple times for each bat.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply