Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Word installed with PlayOnLinux (front-end and helper scripts for WINE). I'd like to be able to select "open with" when downloading a .doc file with Firefox and open it quickly as can be done with LibreOffice.

I found from the .desktop file that the command to run Word is /usr/share/playonlinux/playonlinux --run "Microsoft Word 2010". However, when trying to add a new program I'm not able to give it a command-line, just an executable with no parameters.

Is this even possible?

share|improve this question
    
what does "I'm not able to give it a command-line" mean? –  don.joey Dec 20 '12 at 17:59
    
When you add a program in the firefox dialogue, you either choose from a list or navigate to the executable yourself. There are no parameters you can choose. –  WindowsEscapist Dec 20 '12 at 18:13
    
You could put the appropriate commands in a script, make that script executable, and then select that script in the firefox open with menu. That would get around the problem of not being able to select command-line parameters. –  user76204 Dec 23 '12 at 13:16
    
Thanks! Can I have a little help as to specifics there? I'm not too good with bash. –  WindowsEscapist Dec 25 '12 at 20:31
    
Yes, please see my answer; it should be what you want. –  user76204 Dec 29 '12 at 23:52

1 Answer 1

up vote 4 down vote accepted

You should be able to place any command-line options in a script (as below) and then select that script through the firefox menu. However, it is critical you include "$@" so that the file(s) passed from firefox will actually be opened. Otherwise, just a blank document would be opened. As an example, this is the sort of wrapper script that you use:

#!/bin/bash

/usr/share/playonlinux/playonlinux --run "Microsoft Word 2010" Z:"$@"

It is critical to include the Z: or the document will not be found by wine or its equivalent, as the Z: is a symlink to your filesystem.

I also tried this with WordViewer in Wine and it worked with the following commands:

#!/bin/bash
wine /home/mike/.wine/drive_c/Program\ Files/Microsoft\ Office/OFFICE11/WORDVIEW.EXE Z:"$@"

If you just wanted Libreoffice, you would instead use in the script:

#!/bin/bash

libreoffice --writer "$@" 

There is further detailed information in this useful article if you also wish to associate various file types with Microsoft Word 2010, as also discussed in this question:

Create a new text file, copy the contents of the first script (which is what you said you want) and make it executable. Then you can select the script through the firefox menu, as below:

enter image description here

share|improve this answer

protected by fossfreedom Sep 21 '13 at 22:00

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.