Вы находитесь здесь


Passing command line arguments to Apps?

Автор Replies
hasi Saturday 19 January 2008 at 7:32

playonlinux command line parameters are not really documented. ("playonlinux --help" anyone?).
When I tried to feed through command line arguments to the actual application, it (almost) works. If I do 'playonlinux --run "Word 2003" C:\asdf.doc', the application actually gets invoked with the file "asdf.doc" as an argument.
However, it fails when there is a space in the file name a la:
'playonlinux --run "Word 2003" "C:\as df.doc".
Any ideas how to fix that? This would be really helpful to make wine apps the default apps when certain file types are clicked (*.doc, for instance).
Quentin PÂRIS Saturday 19 January 2008 at 9:36
Quentin PÂRISAnonymous

Yes I have the same problem.

Try playonlinux --run "Word 2003" C:\as df.doc


playonlinux --run "Word 2003" C:\as\ df.doc

I'm not sure that the command will work but try...

I hope it will be fixed in the 2.0.6
hasi Saturday 19 January 2008 at 18:53

Hey, I found the solution!!!

I guess I wasn't skilled enough in bash scripting. Anyway, this is the solution:

playonlinux --run "Word 2003" '\"C:\as df.doc\"'

Tinou: Your solution (playonlinux --run "Word 2003" C:\as\ df.doc) will make sure that the argument will get transmitted as one (and not two) arguments to the playonlinux command. However, it does not work. My guess is that this argument then gets passed through to the wine application as a string, where it contains a space. Word then interprets it as two command line argument, the first one being C:\as (which is not a valid file).

By the way, I also wrote a small script that allows setting any program installed via PlayOnLinux as default application for any MIME type.
It takes two arguments: the $1 is the name of the application as installed in PlayOnLinux, $2 is the (Linux) path to the file to be given as argument to the Windows application.

# convert the path into Windows form:
ArgWinePath=\\\"`winepath -w "$2"`\\\"
# make sure that nothing is passed to application when no file is given:
# call application with argument:
playonlinux --run "$1" "$FileName"
exit 0

So, if you name the script "2wine" you could use it as follows:
     2wine "Word 2003" ~/as\ df.doc
This works if your application in PlayOnLinux is called "Word 2003" and you have a file "as df.doc" in your home directory.
Now, you can change the "Start Menu" entry for the Word program to:
     2wine "Word 2003" %u
Finally, you may want to associate all *.doc and *.DOC files with the Word program in your Start Menu. Voila.
Let me know if this works or if you have difficulties.
Quentin PÂRIS Saturday 19 January 2008 at 19:57
Quentin PÂRISAnonymous

Good !!

I will probably use your script Thank you
hasi Sunday 20 January 2008 at 2:17

OK. I just found out that the same script works for Word 2003, but not for PowerPoint 2003. That strongly indicates that there is a difference how the two applications handle command line arguments.

Anyway, my impression was that PlayOnLinux has a suboptimal handling of additional command line arguments and how they are passed on to Linux. I really had to do a lot of tweaks to the script to make it work for Word 2003. I relatively sure that the problem is not in Wine. The same task was very easy when I was using wine directly (without PlayOnLinux). Particularly, it was easily working on PowerPoint 2003.

So, does anyone have an idea how to fix/improve that? I would suspect it is as simple as adding another layer of quotes or other escape sequences when the arguments are passed from PlayOnLinux to wine. Anyway, it would be very helpful to have some documentation about the command line parameters ("playonlinux --help", anyone?). Right now, the only one I know from the examples is "--run". Beyond that, I was unable to find out how things are handled.

Any ideas would be very welcome.
hasi Sunday 20 January 2008 at 2:33

Please note that I opened another, thread on this, as I had (prematurely, sorry...) set it to "solved" after I had found a solution for Word 2003. I hope that it will get more attention when it is tagged as unsolved.

New thread:

I hope this is not violating any rules.
hasi Sunday 20 January 2008 at 2:39

Hey, I forgot to mention that I am using PlayOnLinux 2.05. I confirmed it with wine 0.9.53 and 0.9.37.
By, the way, I also got error messages when I used "winepath" in wine 0.9.53, whereas it ran flawless in 0.9.37. (winepath is part of the script I posted above).
hasi Sunday 20 January 2008 at 4:55

For Acrobat 7, I had to use again a different script. The similar line in the script above has to be modified to:
ArgWinePath=`winepath -w "$2"`
bvlahos Thursday 25 May 2017 at 2:32

I have one application that will send command line aruguments to another application and another application that receives them (it could be a Macintosh application or another Windows application). It isn't clear to me how to set both programs up or maybe I only need to set the program that sends them.


Would it be set in the Arguments field (the screen shot doesn't seem to have been uploaded)? If so, what would the syntax be?



Edited by bvlahos

Вы находитесь здесь: Index > PlayOnLinux > Passing command line arguments to Apps?