EDIT: There's a better way of doing this than I first though when writing this post. Jump to jecogul's post: http://ubuntuforums.org/showthread.p...84#post9793671 .
-------------------------------------------------------------------------
Ignore the rest of this post
-------------------------------------------------------------------------
The idea behind the attached script is to be able to double-click on a file to open it with an application running with wine. The idea and the script are based on luke16 post about associating warcraft 3 replays with wine.
HOW IT WORKS
The script launches an action with based on the type of the file (e.g., its extension). You'll need to write your own actions, as i only write the only one i was interested with. If you have a look at the end of the code, you'll see something like this:
Code:
#perform action according to file type (e.g. file extension)
#ex: wine "$winePath"drive_c/Program\ Files/Foo/foo.exe "$winTempFile"
case "$ext" in
w3g)
#warcraft replay file
wine "$winePath"drive_c/Program\ Files/Warcraft\ III/war3.exe -loadfile "$winTempFile"
;;
*)
#unknown file type
wine "$inputFile"
;;
esac
So basically, to start the program foo.exe when opening a .foo file (e.g. bar.foo), you would do something like:
Code:
#perform action according to file type (e.g. file extension)
#ex: wine "$winePath"drive_c/Program\ Files/Foo/foo.exe "$winTempFile"
case "$ext" in
w3g)
#warcraft replay file
wine "$winePath"drive_c/Program\ Files/Warcraft\ III/war3.exe -loadfile "$winTempFile"
;;
foo)
#foo file
wine "$winePath"drive_c/Program\ Files/Foo/foo.exe "$winTempFile"
;;
*)
#unknown file type
wine "$inputFile"
;;
esac
"foo)" specifies that an action will be done if the extension of the file is "foo".
"wine "$winePath"drive_c/Program\ Files/Foo/foo.exe "$winTempFile"" is the action to execute. Normally, you should only change "Foo/foo.exe" to the correct path. Note that some programs will require more arguments. Warcraft for instance, requires the "-loadfile" argument before the file name.
";;" terminates the action.
Note that "*)" is the default action, so don't add anything after that part, or it will never happen!
HOW TO INSTALL
1- download the script and unzip it.
2- move the script to appropriate place, say /usr/local/sbin.
Code:
sudo mv ~/Desktop/wineOpen /usr/local/sbin/
3- make the script executable
Code:
sudo chmod +x /usr/local/sbin/wineOpen
4- tell you system to open the desired type of file with "wineOpen". if you are using gnome:
a- right click on the file you wish to open
b- click on properties
c- go to the "open with" tab
d- click "add"
e- click "use custom command" at the bottom
f- enter "wineOpen"
You'll need to do that only once for each type of file. If you're not using gnome... well, sorry, but i guess you'll sort it out 
Hope that will be of any use.
Bookmarks