Adding “Open With ►” Functionality to a Folder

If you right-click a file in the Finder, you are presented with a contextual menu, and the top 2 items are to “Open” the file or “Open With ►” with opens another sub menu off to the side with selections for different apps that the Finder thinks can handle that sort of file.

openwith.png

Folders are a little different.  They are the Finder’s bread & butter, yet the Finder only presents you with a single way to open it (in the Finder).

openfolder4.png

There are some apps which can open folders and do things with them, so it would be nice to be able to open a folder from the Finder in the app of our choice, just like we can do with files.

Well, there is a way we can do that, albeit with a little more movement of the cursor.  To do this, we’ll take advantage of a Finder feature known as services.

A service is another contextual menu item that appears at the very bottom of the contextual menu when you right-click on either a file or a folder in the Finder. You can see it way down at the bottom here when I right-click my Dropbox folder:

servicesmenu2.png

In order to add to this contextual sub-menu, we’re going to create a service using Automator.app, located in your /Applications folder.  Double-click Automator.app and when prompted, click the service icon, which looks like a gear and then click “Choose”:

servicegear.png

Next, you’ll need to drag the “Run Shell Script” action to the pane on the right where it says “Drag actions or files here to build your workflow”.

WnXQ7g.gif

Once you’ve done that, you’ll need to make the following changes/entries in the Run Shell Script action you just dropped into your workflow:

  1. Select Service receives selected: Folders
  2. Select in Finder.app
  3. Select Pass input as arguments
  4. Delete any text inside the shell script window and paste in:
    • open -a “Disk Inventory X.app” “$@” &> /dev/null &

The final action will look like this (you can ignore the backslash in front of the open command):

automator_openwith.png

As you can see, I created a service to open a folder in Disk Inventory X.app.  That’s a handy app that graphically shows you how much space each file & folder is taking up.  Note that the quotes are important, as is all the gibberish after the app name.  Briefly: “$@” is where the folder name or names will go (you can select multiple folders and right click on the group to open multiple folders in the same app).  The rest just tells Automator to ignore any weird output from the command and to not wait for it to finish.

Save the service and give it a name.  I called mine “Open in Disk Inventory X”.  The name of the file is how the service will appear in the menu.  If you want to test it first, you can type a folder path in place of the $@ and click the run button at the top right of the workflow window in Automator.

If you’ve got everything right, when you right click on a folder and hover down to the services menu, you should be able to select your service like this:

servmenu.png

Selecting it will open the folder in the app you’ve selected.

Note, not all apps can open folders.  If you’re unsure whether your app can open a folder, try running it and drop a folder onto it in the dock.  If it opens the folder automatically, you’re good to go.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s