Page 1 of 5
<pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:18
by binocular222
I suspect this because when I pass a large number of video files to Media Player Classic Home-Cinema, there's significant lag, mis-order and duplication of items in mpc-hc playlist.
However, when use UDC Openwith (::#3), it seems all files are passed to mpc-hc at once and everthing goes smoothly, playlist ini mpc-hc is correct, no more lag.
1) Is that true?
2) Is there anyway to pass all <pfaitem> at once to target application?
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:42
by admin
Strange, cannot confirm. Both operations do NOT enforce multiple instances (UDC OpenWith can be configured to do so; PFA will never do).
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:50
by bdeshi
<pfaitem> IS passed one by one when multiple files are selected. In fact the PFA association is executed once for each selected file. And each time <pfaitem> is the item currently being processed.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:53
by TheQwerty
PFA/File>Open Selected Item(s) opens each item individually...
But POM/File>Open With... will open the selection in a single instance based on the current item, or first in selection - in which case <pfaitem> is only that item.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:55
by binocular222
No, it's not about multiple instance. In both way, there's only 1 instance of mpc-hc. But the order of files appear in mpc-hc playlist is wild (randomized order, sometime duplicate). With UDC, the playlist is always the same as in XY's List.
Actually, I do not pass <pfaitem> parameter. My PFA is plain simple:
{:Media}>?:\Media Player Classic HomeCinema\x%osbitness%\mpc-hc.exe
My UDC:
E:\Media Player Classic HomeCinema\x%osbitness%\mpc-hc.exe
Then, how to pass ALL items at once?
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:57
by TheQwerty
How do you have the PFA and UDC defined?
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 16:59
by bdeshi
MPC-HC is probably set up to open only one instance, like XYplorer's [ ] Allow Multiple instances.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:11
by binocular222
@Sammy: Yes, MPC-HC is set up to open only one instance
Another test: This PFA map to above mentioned UDC but the result is still a chaos
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:15
by admin
OK, I somehow managed to overlook "<pfaitem>" in the OP and my answer only applies to File / Open With... (aka PFA). Here XYplorer definitely tells Windows to open all files in a single instance. However, it depends on the application whether this will actually happen.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:18
by TheQwerty
With that PFA & UDC...
Open With... / POM / UDC (single instance) - XY opens a single instance of MPC with the list of selected items as arguments.
Open Selected Item(s) / UDC (multiple instances) - XY opens an instance of MPC for each selected item, the order in which MPC receives them is unpredictable and a bit of a race condition.
In both cases XY orders the selected items by starting at the focused item (even if it is not selected), goes down/right to the next item, and wraps around the list until all selected items are covered. I believe this is also the order used for the <items> and <selitems> variables.
(At least in my experience - correct me if wrong, Don.)
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:20
by admin
That's correct. I copied this ordering from Explorer.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:37
by bdeshi
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.
binocular222 wrote:Then, how to pass ALL items at once?
Set a perm $counter for all matching pfa entries. then first run the program for all items at once, and start counting down the counter. As long as the counter exists the program won't run again. Delete the counter upon reaching the last matching item (when $counter==1) [ed. ~typo]
Code: Select all
{:Media}>::if !isset($count) { $allsels = <get selecteditemspathnames |>; $matches = formatlist($allsels, 'fns', '|', <get genericfiletype "{:Media}" "|">); perm $count = gettoken($matches,'count','|'); text $matches; run """C:\Program Files (x86)\MPC-HC\MPC-HC.exe"" ""$matches""";} else { $count--;} if ($count == 1){unset $count;}
I don't know the cmd arg syntax for mpc-hc. Format $matches as you need.
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 17:47
by binocular222
I think a simple solution would be ignoring the feeding-items mechanism once user use ::
example:
Code: Select all
{:Media}>::$cmd = openwith "E:\Media Player Classic HomeCinema\x%osbitness%\mpc-hc.exe"; load "$cmd",,"s"
This should run the script as if a normal script would run
Re: <pfaitem> items are passed one-by-one?
Posted: 16 Mar 2015 18:41
by bdeshi
That will feed
ALL selected files regardless of PFA match X
number of items matching PFA to target app !
Not recommendable if target app doesn't handle duplicate inputs well, or doesn't have instance management
Re: <pfaitem> items are passed one-by-one?
Posted: 17 Mar 2015 02:43
by binocular222
I simplified the PFA example to stress my point: PFA passes items one-by-one even to :: script
That should be changed.