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.

For example, I want all avi files to be associated with mplayer in Wine

mplayer /home/user/myvideo.avi

Edit from Oli: I believe this this actually the inverse of what most people would assume from the original title. Unless I'm mistaken the user is using Total Commander in Wine and would like to launch a Linux-native player on the path. If I'm wrong, just rollback this edit.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

The Wine page has some detail on this.

First you need winepath to translate the path. This will make the script and give it permission to run:

mkdir -p ~/bin/
echo '#!/bin/sh' > ~/bin/run_linx_program
echo '$1 "`wine winepath -u "$2"`"' >> ~/bin/run_linx_program
chmod a+x ~/bin/run_linx_program

Then you'd save something like this to a file called association.reg:

[HKEY_CLASSES_ROOT\.avi]
@="AVIfile"
"Content Type"="video/x-msvideo"
[HKEY_CLASSES_ROOT\AVIfile\Shell\Open\command]
@="/bin/sh run_linx_program mplayer \"%1\""

Then run regedit association.reg to add the association to Wine's registry.

Note: this is adapted from the Wine page. I got the mime-type from within Linux (file --mime-type an_avi.avi). Wine may treat AVI files differently.

share|improve this answer
    
... or use @="c:\windows\system32\winebrowser.exe \"%1\"" as the command. Its a wine builtin that translates the path and launches the file using xdg-open. So, provided that mplayer is already configured outside wine to handle avi files, its a more generic solution (and no scripting or sudo needed) –  MestreLion Jun 30 '11 at 22:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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