How to use openwith <items>

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

How to use openwith <items>

Post by binocular222 »

I want to open selected items with Media Player Classic HC (so that all items appears in MPC-HC play list)
These not work:
openwith "?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe",s ,<items>
openwith ""?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe" /add",s ,<items>
openwith "?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe",s ,<selitems>

Help please.

---------
P.S: I guess that openwith use | to separated list of items while <items> are space-delimited
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: How to use openwith <items>

Post by kotlmg »

you have to use the full path of mpc-hc.exe. for zoommplayer and pot player i have used the following lines.

OpenWith """C:\Program Files (x86)\Zoom Player\zplayer.exe"" <items>";
OpenWith """C:\Program Files (x86)\DAUM\PotPlayer\PotPlayerMini.exe"" <items>";

similarly you can use the following lines (assuming media player classic installed in c drive)

OpenWith """C:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <items>";

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

So, the syntax in XYplorer help file not work:

Code: Select all

openwith application, [mode (s|m)], [itemlist]
openwith """?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"",s,<items>"
But this works:

Code: Select all

openwith """?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <items>"
However, I encounter another problem: When I open multiple files, the play list double itself (i.e: open 3 files, but the list show 6 lines).
---------
P.S: Everything works fine when I open from Windows Explorer, the list is not duplicated
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: How to use openwith <items>

Post by highend »

openwith already processes the current selected items, so <items> is unnecessary...

Code: Select all

openwith "?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe";
One of my scripts helped you out? Please donate via Paypal

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

highend wrote:openwith already processes the current selected items, so <items> is unnecessary...

Code: Select all

openwith "?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe";
This still dupplicates MPC-HC's playlist (while Windows Explorer doesn't)
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: How to use openwith <items>

Post by FluxTorpedoe »

binocular222 wrote:So, the syntax in XYplorer help file not work:

Code: Select all

openwith application, [mode (s|m)], [itemlist]
openwith """?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"",s,<items>"
But this works:

Code: Select all

openwith """?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <items>"
Well, the syntax is working as it should, with a real [itemlist] - being a pipe-separated list.
Whereas the vars <items> or <selitems> are space-separated lists.

In your working example, <items> being between the overall quotes, is part of the "application" value. Like you'd have with e.g. (also working)

Code: Select all

run """?:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <items>";
About the duplicates, I tried highend's example and this one in MPC-HC v1.6.3.5597 (under WinXPSP3) and the playlist doesn't show any duplicates...
Do you still have this problem with the "run" command?
And to make a test, do you still have it if you manually replace the <items> var with the item(s) path?

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

This works:
run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" D:\Movie\Amazing!\CGI\Yogin.flv D:\Movie\Amazing!\CGI\Yogin.flv"

But this doesn't (mpc-hc tells that the path is invalid)
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"",s,D:\Movie\Amazing!\CGI\Yogin.flv|D:\Movie\Amazing!\CGI\Yogin.flv"

Maybe due to quoting?
------------
P.S:
I'm using mpc-hc 1.6.7.7114
Agh, I know the reason for duplicating:
Things work fine when I run this code via address bar
run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <selitems>"
However, when I save this code as PFA.xys, assign is a label (MPC), then callthe script via PFA, then the playlist will be duplicated. Here's the PFA:
flv>::load "PFA", "MPC"
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: How to use openwith <items>

Post by FluxTorpedoe »

binocular222 wrote:But this doesn't (mpc-hc tells that the path is invalid)
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"",s,D:\Movie\Amazing!\CGI\Yogin.flv|D:\Movie\Amazing!\CGI\Yogin.flv"
Maybe due to quoting?
Exactly.
As I said before, if you use quotes that include everything after the command-name, then what's inside is considered the first value/argument, here: "application". i.e. what you're doing equals not to
openwith "application", , "itemlist";
but to
openwith "application, , itemlist", , ;

The "3 quotes system" if I may say, is used to include everything it can under a single argument.
We could visualize it (correct me if I'm wrong) with an command like:

Code: Select all

command  " ""path with spaces => double-quoted"" -CommandLineArgument ""Something with spaces again"" " , flag, ""list with spaces"";
         ^ ^                                   ^                      ^                             ^ ^         ^                  ^
         | |___________________________________|                      |_____________________________| |         |__________________|
         |                                                                                            |
         |____________________________________________________________________________________________|
[/size]
Hope this helps...

Will check later about the PFA / Duplicates thing.

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: How to use openwith <items>

Post by highend »

run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" <selitems>"
However, when I save this code as PFA.xys, assign is a label (MPC), then callthe script via PFA, then the playlist will be duplicated. Here's the PFA:
flv>::load "PFA", "MPC"
Simple reason: The PFA get's executed for each selected item. So when you have three songs selected and call a script via a pfa, the script will be executed three times...
One of my scripts helped you out? Please donate via Paypal

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

Then, anyway to work around?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: How to use openwith <items>

Post by FluxTorpedoe »

highend wrote:The PFA get's executed for each selected item.
Indeed!
As a general rule for your PFA scripts, use the recent <pfaitems> that's been made just for this!
(This was one of the problems I had with my PowerLauncher script before this var.)

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

Thanks, <pfaitem> works great. However: I tried all these in PFA.xys:
run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" /add ""<pfaitem>"""
run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" ""<pfaitem>"""
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" ""<pfaitem>"""
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" /add ""<pfaitem>"""

All produce the same problem:
a few files are failed to added to the playlist. I guess that due to some file name contain special unicode characters. Example:
This works (all 3 files are shown in playlist):
Cat's Meow.flv
Catwalk - Black Cat Crossing.flv
Ce Que Je Suis (What I am) by Doncvoilà Studio.mp4

This also works (all 3 files are shown in playlist):
Cat デジスタ・ティーンズ応募作品『視力検査.flv
Cat's Meow.flv
Catwalk - Black Cat Crossing.flv

This not work (playlist only show Cat's Meow.flv):
Cat デジスタ・ティーンズ応募作品『視力検査.flv
Cat's Meow.flv
Catwalk - Black Cat Crossing.flv
Ce Que Je Suis (What I am) by Doncvoilà Studio.mp4

edited: changed <pfaitems> to <pfaitem> as Don said below, the result does not change.
Last edited by binocular222 on 28 Apr 2013 15:36, edited 2 times in total.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: How to use openwith <items>

Post by admin »

Ahem, it's <pfaitem>, not <pfaitems>!

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: How to use openwith <items>

Post by binocular222 »

Oh, it works with run command:

Code: Select all

"PFA : MPC"
run """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" /add ""<pfaitem>"""
I just wonder how to use openwith with <pfaitem> and command-line switch?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: How to use openwith <items>

Post by FluxTorpedoe »

binocular222 wrote:I just wonder how to use openwith with <pfaitem> and command-line switch?
I may not understand what you're after...
In your case with PFA and openwith, you shouldn't even need to use <pfaitem> (without the "s" indeed :oops: ), it's implied.

So either line would work:

Code: Select all

"PFA : MPC"
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" /add";
openwith """E:\4Media\Player\Media Player Classic HomeCinema x86\mpc-hc.exe"" /add", , "<pfaitem>";
To answer you question, as I had shown in the imaginary "command" example: since the /add is inside the main quotes, it means it's part of the first argument, hence with "openwith" just like with "run", considering it is following the double-quoted application, this means it is the command-line - and any other command-line argument can be added here.

Post Reply