3

I want to asssociate the .exe file extension to Mono (don't care about wine).

Apparently, when using Finder's GUI, only .app files (application bundles) can be selected. But the Mono executable (/Libraries/Frameworks/Mono.Framework/Current/bin/mono) is no such bundle.

I tried some AppleScript

on run this_file
 do shell script "mono this_file &"
end run

but Finder's GUI still doesn't allow to associate that with .exe's.

How to associate a specific file extension to a command-line application in Mac OS X?

4
  • I'm not sure what you're trying to say about that GUI, but it seems you can find your answer in "How to change file associations on Mac OS X?" at superuser.com/questions/29016/… or "Associate a file extension with an app in Snow Leopard" at superuser.com/questions/58598/…
    – Arjan
    Nov 7, 2009 at 13:08
  • When you browse for application apparently only .app files can be selected while mono exetuable (/Libraries/Frameworks/Mono.Framework/Current/bin/mono) has no extension. Hence neither GUI way nor RCDefaultApp (in the end uses same select app dialog) doesn't work for me.
    – jonny
    Nov 7, 2009 at 13:38
  • Did you use Automator for that AppleScript? In Automator, those can be saved as an application bundle. (But: "Associate a file extension with an app in Snow Leopard" at superuser.com/questions/58598/… seems to have trouble with that as well.)
    – Arjan
    Nov 7, 2009 at 14:55
  • It seems my answer worked to associate files with a Python script: see Set default open-with app to a Python program on a Mac.
    – Arjan
    Apr 25, 2010 at 21:40

2 Answers 2

4

Using Automator to save the following as an Application works fine for me, also for new files:

  1. Start Automator
  2. In "Choose a template for your workflow" choose "Application"
  3. Drag the action "Run Shell Script" into the workflow in the pane at the right
  4. Change "Pass input" from "to stdin" into "as arguments"
  5. Replace echo "$f" with mono "$f" &. So:

    for f in "$@"
    do
      mono "$f" &
    done
    
  6. Save (as an Application)
  7. Use Finder to associate any file extension with this new application (like: hit Cmd-I, or right-click » Get Info, select the application and then choose "Change all")

enter image description here

I have not tested step 5 with mono, but with the following, which also uses the command line though:

for f in "$@"
do
  open -a /Applications/TextEdit.app/ "$f"
done

(I am not an AppleScript expert.)

0
0

Follow the steps above but use this instead:

for f in "$@"
do
 mono $f &
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .