13

How can I open a file with an application, other than the default, using a keyboard shortcut? I don’t want to change the default application for the filetype.

E.g. sometimes I want to open a .html file using an editor instead of a browser.

  • The closest I get is if I know the name of the app, I press Cmd Shift /, then start typing the name, and use the down arrow to select Open With > App – Redandwhite Nov 27 '12 at 12:44
  • There is a direct and super easy solution to this. Check my answer.Please accept it as answer if it serves your need. – Safwan Jun 28 '17 at 8:10
11

The best solution for me:

  1. Select file you want to open
  2. Press ++/ (opens up the mighty Help search)
  3. Then start to type a name of app you want to open
  4. Use arrow keys to select right menu item
  5. Press Enter
  6. Done!

For example I want to open HTML-file with Sublime Text instead of Chrome. I navigate to this file, press shortcut, type in "su", press down-arrow and press enter!

enter image description here

4

I'm afraid there's not shortcut. You can, though, create your owns.

To do so just:

  1. Go to System Preferences / Keyboard / Keyboard Shortcuts / Applications.
  2. Click the + button.
  3. Choose Finder, from the drop-down list.
  4. On the menu title field add the exact name of the menu bar item. It this case it should be Other... instead of Open with.
  5. Pick your keyboard shortcut and click Add.

You'll be able to test the shortcut right away. Just mind the Open always with option!

  • I dont think this works. I just tried and looks like Finder confuses Open With and Always Open With (10.7.5): The keyboard shortcut pref and the error message – Nivas Nov 27 '12 at 12:37
  • 1
    @Nivas And here the preferences panel, in case I didn't make myself clear enough. – Thecafremo Nov 27 '12 at 13:02
  • 1
    Ah... I did not know that. Other... does work. (It does amaze the programmer in me though that there is an implicit assumption that the menu items should have unique names. What if another submenu has an Other? But that is beyond this question...) – Nivas Nov 27 '12 at 13:07
  • 1
    This is not working on 10.10 the menu Othe… get the shortcut but does not respond – markhunte Dec 9 '14 at 10:29
  • 1
    IT WORKS!! YAY!!! On macos 10.12 (sierra) at least – chrismarx Aug 1 '17 at 18:53
2

As requested , here is a capture of [my blog] post for an Automator Service that works for me in Yosemite .

enter image description here

Code for Applescript in step 2

on run {input, parameters}

    tell current application to activate


end run

Code for Applescript in step 5

on run {input, parameters}
    set theApp to (POSIX path of (item 1 of input))
    repeat with i from 2 to number of items in input
        set this_item to item i of input
        tell application theApp to open this_item
    end repeat
    tell application theApp to activate
end run

After Saving the Automator Service go to System Prefs. and add your shortcut to it.

enter image description here

  • Glad I followed through with this one, just had to discover some 'right'-clicking needed for your orange dotted-line instruction (at least that's how I got through it.) Thanks for posting – Rene Marcelo Dec 30 '16 at 20:19
2

If you frequently open a file in a specific app (other than the default app), you can set a keyboard shortcut for doing it. This is super easy.

Let's say you want to open a file in Sublime Text whenever you press control+S after selecting the file.

  1. Go to System Preferences > Keyboard > Shortcuts (tab) > App Shortcuts (option in left sidebar).
  2. Create new shorctut by clicking/tapping on +.
  3. Select Finder as Application.
  4. Set Menu Title as Sublime Text.
  5. Set Keyboard Shortcut as control+S. It will be shown as ^S. Or you can use any other shortcut which you prefer.
  6. Click/Tap on Add.

Now you can simply select the file and press control+S to open the file in Sublime Text.

0

I have used FastScripts to assign a shortcut to this script. It can also be used to select the open recent menus in other applications.

try
    set l to {"Open With", "Open Recent", "Open Recent File", "Recent Projects", "Open Recent Set"}
    tell application "System Events" to tell (process 1 where it is frontmost)
        tell menu bar item 3 of menu bar 1
            click
            repeat with x in l
                try
                    menu item x of menu 1
                    click menu item x of menu 1
                    exit repeat
                end try
            end repeat
        end tell
    end tell
end try

I also used scripts like in 10.6 and earlier:

try
    tell application "Finder"
        open (get selection) using path to application "TextMate"
    end tell
end try

There is a bug that makes them unusable in 10.7 and 10.8 though. It could be avoided by focusing another application at the start, but it results in a visual glitch.

You could also use Automator services, but there is another bug where the shortcuts for services don't always work until the services menu has been shown from the menu bar.

  • The shorter solution (FastScripts) works flawlessly in 10.11, at least for opening file in Emacs. – Blaz Oct 7 '15 at 8:18
0

My favorite solution is using Better Touch Tool, a free app. For this to work you need to have Full Keyboard Access turned on (in system preferences - keyboard preferences - shortcuts), so that ctrl-f2 will access the menu bar.

Then use BTT to configure your short-cut (I use ctrl-alt-cmd-O) to do ctrl-f2, then attach addtional actions (10 times: two right arrows, then 7 down, then one right). When typing your shortcut you will get to the same submenu as you would get using the right mouse click and 'open with'.

Note that ctrl-f2 may not be displayed in BTT when you type it, but it does after you do 'attach additional action'.

-1

Right click on the file > press h key > use arrow keys to navigate

  • This does not appear to work on OS X 10.9. Do you have any third party utilities installed that may be providing this functionality? – Graham Miln Mar 6 '14 at 17:03

You must log in to answer this question.

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