New variable or Get parameter: PFA Items

Features wanted...
Post Reply
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

New variable or Get parameter: PFA Items

Post by TheQwerty »

Change Log wrote:

Code: Select all

v15.00.0119 - 2015-03-21 09:54
    * File | Open Selected Item(s): Experimentally changed the behavior of this 
      core function, i.e. what happens on pressing ENTER on selected list items.
      Before, if more than one item was selected then the items were opened one 
      after the other with each item's associated application (be it XY- or 
      OS-associated), even if all items were opened by the same application.
      Now all items are opened in one call if they are of the same type and 
      hence share the same associated application.
      The new behavior is analog to the selecting the bold default item (if 
      there is one) in the "File | Open with..." popup menu.
Since that change the <pfaitem> variable can no longer be entirely trusted because we have two possible outcomes:

1) Each selected item is opened separately.
Thus <pfaitem> is the item used for PFA matching and the item to open.

Occurs when any of these is true:
  • Pre-v15.00.0119
  • When only one item is selected.
  • When multiple items of differing types are selected.
  • The user enables the (unmarked) OpenAllSelectedInMultipleInstances tweak.
2) The selection is treated as one.
Thus <pfaitem> is the item used for PFA matching (either the current item or the first in the selection :veryconfused: ).
But <selitems> or Get('SelectedItems...') must be used to determine the items to open.

Occurs when ALL of the following are true:
  • Post-v15.00.0119
  • Multiple items are selected and are all of the same type.
  • The user has not enabled the OpenAllSelectedInMultipleInstances tweak.


The problem is... previously we could use <pfaitem> as the item to open, now we cannot.
Now we must perform our own check on the selected items and if they are all of the same type use the selection, if not we use <pfaitem>.


Hence, I'd like to see a new variable or Get parameter: pfaitems
Such that:
<pfaitem> always equals the item used for matching.
<pfaitems> always equals a list of items to open.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: New variable or Get parameter: PFA Items

Post by TheQwerty »

It's worse than I thought thanks to File | Open Focused Item (#162) and POM.
There is no way for scripts to determine which item(s) the user actually wants to open.

POM made it possible for long to open the selection as a single group/instance regardless of types. <pfaitem> has always been a single item, and did not work well with POM (better off using the selection). Since v15.00.0119 the default behavior for the more common Enter/Open Selected Item(s) made it possible to open multiple items via PFA - extending the <pfaitem>/POM weakness further.

For legacy reasons <pfaitem> should be left as-is (or deprecated), but documented as "The item used for PFA matching."

Going forward we definitely need a new variable/get parameter which is a list of the items actually being opened.

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

Re: New variable or Get parameter: PFA Items

Post by admin »

Next beta has <pfaitems>. Try and see if it works...

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

Re: New variable or Get parameter: PFA Items

Post by binocular222 »

:bug:
This PFA is unreliable:

Code: Select all

{:Media}>::echo <pfaitems>
when select only few items, it always execute only once, but if I select a lot of items, it trigger multiple times:
- The first times, it returns <pfaitems>
- Subsequently, it return <pfaitem> each times

There's no clear cut how many items is "a lot", but it seems about >20.
Only happens with {:Media}, not happens to {:Text}
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: New variable or Get parameter: PFA Items

Post by bdeshi »

All of this became horribly unreliable since the introduction of OpenAllSelectedInMultipleInstances.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: New variable or Get parameter: PFA Items

Post by admin »

binocular222 wrote::bug:
This PFA is unreliable:

Code: Select all

{:Media}>::echo <pfaitems>
when select only few items, it always execute only once, but if I select a lot of items, it trigger multiple times:
- The first times, it returns <pfaitems>
- Subsequently, it return <pfaitem> each times

There's no clear cut how many items is "a lot", but it seems about >20.
Only happens with {:Media}, not happens to {:Text}
Yes, :bug: .

It's not the number, it's whether it's mixed types or all the same type.

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: New variable or Get parameter: PFA Items

Post by FluxTorpedoe »

Hi’
Previous :bug: fixed, but Ooops…
With the latest .0130 <pfaitems> fix, opening X different items now returns X times the full whole list;
but double-clicking on a single item now returns an empty string…


Edit — to whom it might concern / interest:
It may be interesting (though somehow inconsequential) to note an ordering difference between <selitems> and <pfaitems>.
<selitems> returns the list of items as they appear in the list view, regardless of the focused item.
<pfaitems> returns the list of items in a different order depending on the focused item.

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

Re: New variable or Get parameter: PFA Items

Post by admin »

- double-clicking on a single item now returns an empty string: bug indeed
- the list order in <pfaitems> is as Explorer orders the items when opening multiple items: from focused item down to end, then from top down to one-before-focused

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: New variable or Get parameter: PFA Items

Post by TheQwerty »

With OpenAllSelectedInMultipleInstances=1 or a selection of differing types <pfaitems> contains all items instead of just the one being opened.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: New variable or Get parameter: PFA Items

Post by TheQwerty »

All looks good in v15.70.0131.

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: New variable or Get parameter: PFA Items

Post by FluxTorpedoe »

TheQwerty wrote:All looks good in v15.70.0131.
Yep! Even with OpenAllSelectedInMultipleInstances=0.

Thanks! :)
Flux

---------------------------
So, to sum things up, when opening:
• Single item:                    <pfaitems> = <pfaitem> = Full path of selected item    —  One return
• Several similar items:    <pfaitems> = Full list of all selected items                     —  One return
• Several different items: <pfaitems> = <pfaitem> = Full path of a single item     —  Several returns (one for each item)

---------------------------

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: New variable or Get parameter: PFA Items

Post by TheQwerty »

I recommend avoiding the temptation to think about this in terms of the selection.
Doing so makes it too easy to write a PFA script which will not work as expected when called via other open methods.

This does make it difficult to follow the logic in a nice table, but the flow chart isn't too bad:
XYplorer-OpenFlow.png
EDIT: And I realize there's a small lie there, since POM with a single item selection is technically single item in single instance, but that makes things really ugly and behaves no differently.
To see the attached files, you need to log into the forum.


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

Re: New variable or Get parameter: PFA Items

Post by admin »

Mon dieu! :shock: :appl:

Post Reply