Force Thunderbird attachment to open in Word (Resolved)

userone@office2:~$ locate -i WINWORD.EXE
/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE
userone@office2:~$

userone@office2:~$ sudo find / -iname WINWORD.EXE
[sudo] password for userone:
/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE
userone@office2:~$

Her is out puts requested.

Play-on-Linux puts the puts the programs in the following folder- /home/userone/PlayOnLinux’s virtual drives

What happens if you run this in a terminal:

wine "/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE"

Does Word open ?

if that doesn’t work … can you try what SeZo suggested, right-click on the Word icon on the cairo dock, and select “properties” … does that mention the Command: that it runs ?
(as you can probably tell, I don’t use Cairo Dock either :slight_smile: )

Run in a terminal, Word did not open the IOPL not enabled error came up. After clicking OK got this read out -

userone@office2:~$ wine “/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE”
fixme:heap:HeapSetInformation 0x110000 1 (nil) 0
fixme:heap:HeapSetInformation 0x110000 1 (nil) 0
fixme:heap:HeapSetInformation 0x110000 1 (nil) 0
fixme:thread:InitializeSRWLock (0x5de6b680): stub
fixme:thread:InitializeSRWLock (0x5de6cfe4): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockExclusive (0x5de6b680): stub
fixme:thread:ReleaseSRWLockExclusive (0x5de6b680): stub
fixme:thread:AcquireSRWLockExclusive (0x5de6b680): stub
fixme:thread:ReleaseSRWLockExclusive (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:thread:AcquireSRWLockExclusive (0x5de6b680): stub
fixme:thread:ReleaseSRWLockExclusive (0x5de6b680): stub
fixme:thread:AcquireSRWLockExclusive (0x5de6b680): stub
fixme:thread:ReleaseSRWLockExclusive (0x5de6b680): stub
fixme:thread:AcquireSRWLockShared (0x5de6b680): stub
fixme:thread:ReleaseSRWLockShared (0x5de6b680): stub
fixme:msvcr90:__clean_type_info_names_internal (0x321ba234) stub
fixme:msvcr90:__clean_type_info_names_internal (0x3b47da08) stub
userone@office2:~$

Running the command from the icon opens Windows. CMD Line is /usr/share/playonlinux/playonlinux --run “Microsoft Word 2007”

userone@office2:~$ /usr/share/playonlinux/playonlinux --run “Microsoft Word 2007”
[POL_System_CheckFS] Message: Checking filesystem for WINWORD.EXE
[POL_Wine_SetVersionEnv] Message: Setting wine version path: 1.3.6, x86
[POL_Wine_SetVersionEnv] Message: “/home/userone/.PlayOnLinux//wine/linux-x86/1.3.6” exists
[POL_Wine] Message: Running wine-1.3.6 WINWORD.EXE
[POL_Wine] Message: Notice: PlayOnLinux deliberately disables winemenubuilder. See http://www.playonlinux.com/fr/page-26-Winemenubuilder.html
[POL_Wine] Message: Wine return: 0
userone@office2:

When I close Word read out is-

userone@office2:~$ wine: Install the Windows version of Mono to run .NET executables

userone@office2:~$

Running the path to WINWORD.EXE with strait WINE will not work as it seems Playonlinux installs wine per application.
But you should have been OK to run in terminal:

POL_Wine "/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE"

at least you could try to run it to see what response you get with it.

Could you please post the output from this:


ls  /usr/share/playonlinux/
ls .PlayOnLinux/shortcuts/

Also, what e-mail client are you using?

Terminal shows following error -

userone@office2:~$ POL_Wine “/home/userone/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE”
POL_Wine: command not found
userone@office2:~$

Output -
userone@office2:~$ ls /usr/share/playonlinux/
bash lang playonlinux-pkg plugins TRANSLATORS
bin lib playonlinux-shell python
CHANGELOG playonlinux playonlinux-url_handler resources
etc playonlinux-bash playonmac src
userone@office2:~$ ls .PlayOnLinux/shortcuts/
Internet Explorer 7 Microsoft Powerpoint 2007
Microsoft Excel 2007 Microsoft Word 2007
userone@office2:~$

Could you please post the result of the following:

ls /usr/share/applications/ | grep -i Word

and

cat '.PlayOnLinux/shortcuts/Microsoft Word 2007'

Also, what e-mail client are you using?

Read outs-

userone@office2:~$ ls /usr/share/applications/ | grep -i Word
userone@office2:~$

userone@office2:~$ cat ‘.PlayOnLinux/shortcuts/Microsoft Word 2007’
#!/bin/bash
[ “$PLAYONLINUX” = “” ] && exit 0
source “$PLAYONLINUX/lib/sources”
export WINEPREFIX=“/home/userone/.PlayOnLinux//wineprefix/Office2007”
export WINEDEBUG=“-all”
#POL_Log=Microsoft Office 2007_1320227480
cd “/home/userone/.PlayOnLinux//wineprefix/Office2007/drive_c/./Program Files/Microsoft Office/Office12”
POL_Wine “WINWORD.EXE” $@
userone@office2:~$

Client the clue is at the top “Thunderbird”

You could also look at this solution: http://askubuntu.com/questions/116002/how-to-set-file-associations-with-playonlinux « Last Edit: May 30, 2012, 11:29:11 pm by SeZo »

I tried this and it works just fine for documents that are already on the computer or LAN but it dose not work with the email.

Thanks Guys for assistance so far…

Have you already modified the
/home/userone/.PlayOnLinux/shortcuts/Microsoft Word 2007
script as per this link:

ie. so it reads:-

#!/bin/bash
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
export WINEPREFIX="/home/userone/.PlayOnLinux//wineprefix/Office2007"
export WINEDEBUG="-all"
#POL_Log=Microsoft Office 2007_132022748 0
cd "/home/userone/.PlayOnLinux//wineprefix/Office2007/drive_c/./Program Files/Microsoft Office/Office12"
POL_Wine "WINWORD.EXE"  "$(echo "$@" | sed -e 's:/*/:\\:g')"

if so, when you click an the attachment in Thunderbird … select “Open with”, and point it at that script.

Yes I have changed the script as shown and tried pointing the open with other to the new short cut in the play-on-Linux short cuts folder and nothing happens.

Client the clue is at the top "Thunderbird"
That would have been too simple :-[

This might be a silly question but have you now got a .desktop file for Word in /usr/share/applications/ ?
If you have then please post the contents.
Also in Thunderbird try to associate the open with with this .desktop launcher (not with the script).

I’d already tested that, and it didn’t work … though no harm in trying :slight_smile:

Here’s why I want you to try poining it at the modified script …

As a test, I tried it with a .odt attachment (through Firefox though, not Thunderbird), and selected “Open with” and pointed it at the /usr/share/applications/libreoffice-writer.desktop file … writer didn’t open at all.
(I should probably add this was in Peppermint not Ubuntu … Gnome/Unity may treat .desktop files differently)

So I tried creating a script (lo-writer.sh) that contained:-

#!/bin/bash libreoffice -writer

and pointed “Open with” at my lo-writer.sh script … writer opened, but didn’t have the attachments contents … just opened a blank file.

So I changed my lo-writer.sh script to include the edit from that link, so it read:-

#!/bin/bash libreoffice -writer "$(echo "$@" | sed -e 's:/*/:\\:g')"

and it worked

Which is why I asked if you’d made that edit to the script … then wanted you to try pointing “Open with” at that script.

Sorry SeZo … just showing my train of thought :wink:

Question. how do I point open with at the script.

OK, this is where I may fall over … I don’t use Thunderbird (or any other email client for that matter, all webmail now) … so I can’t remember how Thunderbird behaves when you click an attachment … I was supposing it would behave like Firefox.

Here’s what happens in Firefox -

You click an attachment, and a dialog box opens that gives you the option to:-

Open with:
or
Save File

(it also give the option to make this the default action … but DON’T do that yet)

If I then click the arrow at the end of the it’s chosen by default (drop menu) … I get an option called “Other”
(so really, I’m selecting Open with > Other)

If I select “Other”, a file manager window opens for me to point it at an application … so I hit Ctrl+H to show hidden files, then browse to and choose the script.

Is Thunderbird different ? … if so, can you explain what happens when you click an attachment in Thunderbird.

That will probably be easier than me setting up an email account, installing Thunderbird, then sending myself an email with an attachment :o


Just a thought … in Thunderbird, if you go to Edit>Prefrences>Attachments … is there a Content type entry for Word document ?

and if so, what is the Action set to ?

If you click the “Action” for “Word document” … is there a “Use Other” option ?


These links are for future reference:
http://kb.mozillazine.org/MimeTypes.rdf
and
http://kb.mozillazine.org/Actions_for_attachment_file_types#.22Open_with.22_choice_disabled

Hi Chaps,

Firstly Thunderbird works the same way as Firefox with the open with option.

I have tried pointing to the script and the desktop short cuts and nothing happens.

I am going to try a radical approach will install Office 2007 directly with Wine and see if that makes a difference.

Thanks so much for your assistance so far…

Hi, was unable to install office 2007 due to a corrupted file on the CD.

However have installed office 2010 on a free upgrade through Wine.

What works- Right clicking any .doc or .docx file and choosing open with other allows the document to be opened by Word 2010.

In Thunderbird right clicking .doc or .docx file and choosing open with other allows me to select Word the program opens and provides a blank document.

Path is - /home/userone/.wine/drive_c/Program Files/Microsoft Office/Office14/WINWORD.EXE

Sorry, I somehow missed your last post.

Try this…

Create a hidden script in your Home direcory called .ms-word.sh and open it for editing:

gedit ~/.ms-word.sh

make it read:

#!/bin/bash
wine /home/userone/.wine/drive_c/"Program Files"/"Microsoft Office"/Office14/WINWORD.EXE "$(echo "$@" | sed -e 's:/*/:\\:g')"

SAVE the file, and close gedit.

Make the script executable:

chmox +x ~/.ms-word.sh

OK, now try pointing the “Open with” in Thunderbird at that hidden script … and let me know what happens.

I pointed the open with to the script and the program opened with the following error message The directory name is not valid (H:\tmp\name of document)

It looks like that the path format is wrong
We know that Thunderbird places the files you trying to open into the /tmp/
If you would edit the script to pass the path literally (without substituting the “/” with "") what result would you get?

#!/bin/bash wine /home/userone/.wine/drive_c/"Program Files"/"Microsoft Office"/Office14/WINWORD.EXE "$@"

Changed the script to the script below and pointed the open with to the new script and nothing happened. Nothing opened at all

Can you try changing the script to:-

#!/bin/bash
wine /home/userone/.wine/drive_c/"Program Files"/"Microsoft Office"/Office14/WINWORD.EXE "$(echo "$@" | sed -e 's:/*/:\\:g' | sed 's_H:\\_/_g' | sed 's_\\_/_g')"

then try again.

Which I’m hoping will replace
H:\tmp<name of document>
with
/tmp/

I say “hoping” because I’m no sed expert :wink:

And there’s probably a much more elegant way of doing this.

Somehow I doubt if this will work, as we’re trying to pass a Linux path to WINWORD.EXE which I doubt will undertand it … it would probably make more sense to attempt to make WINE’s H:\tmp a symlink to /tmp … but I have no idea where to find H:\tmp as far as WINE is concerned or even if it exists.