Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to change default program to certain type of files, but I've been running to situations where I could use 2 defaults.

Lets take .html files for example. I have assigned Chrome to open all .html files on doubleclick, which is nice. As Im web developer, I usually need to open .html files also in textmate. For this to happen, I need to open context menu and select program from Open With menu.

Wouldn't it be great if one could Command+doubleclick to open that file with secondary program?

Is there a way to achieve this?

share|improve this question
up vote 0 down vote accepted
  1. Open Automator and choose the service template
  2. Set the input type to files or folders
  3. Add a run shell script action and choose to pass input as arguments
  4. Paste this as the script and edit the list of applications:

    applications="pdf Preview
    zip The Unarchiver"
    for f in "$@"; do
        if [[ "$ext" == "$basename" ]]; then
            app=$(grep -m1 ^$ext' ' <<< "$applications" | cut -d ' ' -f 2-)
        [[ -z "$app" ]] && app=TextMate
        open "$f" -a "$app"
  5. Assing the service a shortcut in the keyboard preference pane

There's a bug where the shortcuts for Automator services don't always work until the services menu has been shown once from the menu bar. Another bug is that services that receive folders or files as input aren't available when folders are selected in column view in Finder.

share|improve this answer
fits my needs perfectly, thanks! – Tom Oct 8 '12 at 9:14

Your Answer


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.