Choosing between opening a file with primary or secondary program with a shortcut 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?
Open Automator and choose the service template
Set the input type to files or folders
Add a run shell script action and choose to pass input as arguments
Paste this as the script and edit the list of applications:

applications="pdf Preview
zip The Unarchiver"

for f in "$@"; do
    basename=${f%/}
    basename=${basename##*/}
    ext=${basename##*.}
    if [[ "$ext" == "$basename" ]]; then
        app=
    else    
        app=$(grep -m1 ^$ext' ' &lt;&lt;&lt; "$applications" | cut -d ' ' -f 2-)
    fi
    [[ -z "$app" ]] &amp;&amp; app=TextMate
    open "$f" -a "$app"
done

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.