How to define a new file association with a binary application (not a .App) ?

Joined
May 20, 2009
Messages
7
Reaction score
0
Points
1
Hello !

I installed wine from MacPorts (the only one to work) and I'm a bit tired to open a Terminal to open Wine, is there a way to define a new file association to automatically open *.exe file with /opt/local/bin/wine (it's not possible with the built-in application selector on MacOSX) ?

Cheers,
Vianney
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
You could probably create an Automator workflow to automate this somehow. I'm not near my Mac at the moment so I can't give any more specific ideas on how to configure that workflow for now.
 
Joined
Mar 24, 2008
Messages
6
Reaction score
0
Points
1
I'd like to bump this to see if anyone has any ideas or sample scripts. I don't really know what I'm doing with AppleScript to be honest, though it seems like it should be simple enough I don't really want to have to learn AS just to get it done.

Being able to double-click .exe files and then create a dummy drive for WINE are my two main wishes for making integration almost seamless, and IMO what they need for any binary distributions that come along in the future, as navigating to ~/.wine/ to get at your "C:" drive is a bit of a pain, and having to fire into the terminal to open an application is a bit too. The drive one is solved easily enough by throwing it in the sidebar and giving it a nice OS X drive icon though, but me being picky I'd prefer to see it under the devices heading :)

Though on the plus side everything I want to run seems to run much better in WINE than it ever has in VMWare Fusion or Parallels, so it's been worth the effort so far!
 
Joined
Mar 24, 2008
Messages
6
Reaction score
0
Points
1
Okay, so I went ahead and made something myself. All you have to do is open a new Automator application workflow, throw in a shell-script task, and copy/paste the following code:

Code:
source ~/.profile
if test $# = 0
	then
		winefile C:
		exit
fi

for f in "$@"
do
	d=`dirname "$f"`
	f=`basename "$f"`
	cd "$d"
	wine "$f" &
done

You can then save your app, associate .exe files with it (using Finder's get-info), and WINE should run with very little fuss as you can now just double-click .exe files, create aliases to your favourite ones etc.

If you open the app without a .exe argument then you get the default file-browser. You can also go a step further and associate files in the info.plist within the .app, and provide icons and so-on as well, but I won't describe that here.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top