2

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?

WindowsEscapist
  • 1,483
  • 2
  • 17
  • 42
  • 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. –  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. –  Dec 29 '12 at 23:52

1 Answers1

4

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