0

I'm using MS Office 2007 via Wine/PoL and I've made the desktop files for them like that:

For starting:

[Desktop Entry]
Encoding=UTF-8
Name=Word 2007
GenericName=Game
Comment=PlayOnLinux
Type=Application
Exec=/usr/share/playonlinux/playonlinux --run "Microsoft Word 2007"
Icon=/home/sebastian/.PlayOnLinux//icones/full_size/Word 2007
Categories=Office;

For file opening: (z: is the wine link to /)

[Desktop Entry]
Encoding=UTF-8
Name=Mit Word 2007 öffnen
GenericName=Game
Comment=PlayOnLinux
Type=Application
Exec=/usr/share/playonlinux/playonlinux --run "Microsoft Word 2007" z:%f
Icon=/home/sebastian/.PlayOnLinux//icones/full_size/Word 2007
Categories=Office;

However, the file opening shortcut doesn't accept files with spaces (they get replaced by %20).

Now I want to merge those two files into one, which should start Word and, if supplied, opens a document, which may contain spaces.

How do I accomplish that?

0

I found a solution for myself. I created the following script:

#!/bin/bash
if [ "$2" != "" ]
 then
  mode="open"
  DATA="file:///Z:$2"
  DATA=${DATA// /%20}
else
  mode="noopen"
fi
case $1 in
  winword)
    if [ $mode == "open" ]
    then
      /usr/share/playonlinux/playonlinux --run "Microsoft Word 2007" "$DATA"
    else
      /usr/share/playonlinux/playonlinux --run "Microsoft Word 2007"
    fi
  ;;
  excel)
    if [ $mode == "open" ]
    then
      /usr/share/playonlinux/playonlinux --run "Microsoft Excel 2007" "$DATA"
    else
      /usr/share/playonlinux/playonlinux --run "Microsoft Excel 2007"
    fi
  ;;
  pwrpoint)
    if [ $mode == "open" ]
    then
      /usr/share/playonlinux/playonlinux --run "Microsoft Powerpoint 2007" "$DATA"
    else
      /usr/share/playonlinux/playonlinux --run "Microsoft Powerpoint 2007"
    fi
  ;;
  *)
    exit
  ;;
esac

It converts the file name to a URL (file:///Z:/home/sebastian/Documents/test.docx). It also determines whether to supply a second argument or not, so Office won't say File "Z:" not found.

The launchers look like this now: (This one for word)

[Desktop Entry]
Encoding=UTF-8
Name=Word 2007
GenericName=Word Processor
Comment=PlayOnLinux
Type=Application
Exec=/home/sebastian/.PlayOnLinux//wineprefix/Office2007/MSOfficeExecutor.sh winword %f
Icon=/home/sebastian/.PlayOnLinux//icones/full_size/Word 2007
Categories=Office;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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