By Greg Ferrell » June 18, 2011

I use OS X and Ubuntu on a daily basis with my dev machines. One of the things that I like that Ubuntu can do is open folders with applications on right click. Unfortunately, OS X doesn’t do this by default, but we can accomplish it easily with an Automator Workflow. (It would be nice if Binary Age would add this feature to TotalFinder wink ) .

One of the options in OS X’s Automator workflow outputs is ‘Service’, which will allow us to put a finished workflow into a right click menu for files and folders.

First, launch Automator and choose ‘Service’:

Automator: choose Services

Now, the first item shown is an automatic file list receiver from Finder. Because we need to select the app we want to open the files with, we need to store this as a variable. The first thing we need is ‘Set Value of Variable’ from the Utilities heading. This will allow us to store the files into a variable so we can use it later. Drag the ‘Set Value of Variable into the workflow and double click the variable dropdown and make a new variable named ‘files’.

Set Value of Variable

The next thing we need is ‘Ask for Finder Items’ under Files & Folders. This will allow us to prompt for the application we are going to open the selected files with. (If you can restrict it to file extensions, i am not sure how, so for now, I just set it to type ‘file’.) Change the Prompt to ‘Choose an Application’ and set the starting folder to your Applications folder. Then, right click the action window and select ‘Ignore Input’ so we don’t receive any of the files from the previous action in the workflow:

Ask for Finder Items

Now we need to capture this as a variable, so from the Utilities folder, find ‘Set Value of Variable’ and drag it into your workflow. It should automatically pin itself to the previous item. Name the variable ‘selectedapp’ by double clicking the ‘New Variable’ dropdown box.

Set value of Variable

We have our chosen app, and we need to retrive the value of the selected Finder items so we can feed them to the app to open them. From the Utilities folder, select ‘Get Value of Variable’ and drag it into the workflow. From the variable list at the bottom, drag the ‘files’ variable into the variable dropdown. Then, right click the action window and select ‘Ignore Input’ so we don’t receive any of the files from the previous action in the workflow:

Get Value Of Variable

The last item we need is an Application opener to open the selected Finder items with the previously prompted for application. Under ‘Files & Folders’, select ‘Open Finder Items’ and add it to the workflow. Then, from the variable list at the bottom of the window, drag in the ‘selectedapp’ variable we created before onto the ‘Open Finder Items’ item in the workflow. It should automatically change the ‘Open with:’ value to the variable.

Open Finder Items With

Your completed workflow should look like this:

Completed workflow

Now safe the file (It should automatically be saving as a finder service) and name it ‘Open Files With…’. Use the workflow by highlighting the folder you want to open, right click and go to the services menu and select ‘Open Files With…’.

Finished Product

If you use some applications more than others, then an option to create a directly opening right click workflow is to remove the middle two steps for selecting an application, and for the last step, use a selected application instead of the ‘selectedapp’ variable.

Enjoy!  grin

blog comments powered by Disqus