4

How do I configure TextWrangler and Mac OS X, so that TextWrangler appears in "Open With…" submenu for all files, not just the text files (and other file types explicitly supported by TextWrangler)?

I don't want to configure all those non-standard extensions one by one. Also, I don't want to open unknown files in TextWrangler by default. I just would like to have an option to quickly open in TextWrangler without looking for it in "Others…"

1 Answer 1

5

Use an Automator Service instead. The result might be even better, depending on your point of view (I created the service for the hex editor 0xED, but it should also work for TextWrangler):

enter image description here

If you like what you see in the screenshot, open /Applications/Automator.app and select to create a new Service. At the top right of the window, select "receives selected files and folders in any application" (or just Finder, your choice).

From the library, select Utilities and double-click Run Shell Script.

Configure that action to "Pass input as arguments" and replace the script text with the following:

if [ -f "$1" ] ; then
    open -a "TextWrangler" "$1"
fi

This will open the selected file using TextWrangler if it's a regular file (no symbolic link, folder, etc.)

Save as "Open in TextWrangler" and you can use it.

5
  • My solution doesn't work with .webloc files though (i.e. those created by drag&dropping e.g. from Safari's address bar). But that's a bug with open, since e.g. open -t url.webloc doesn't open in TextEdit.
    – Daniel Beck
    Apr 13, 2011 at 7:54
  • I think TextWrangler installs a service like this for you. Even easier :) May 18, 2011 at 20:38
  • It did not when I installed it a few months ago. This script combined with the Get Info/Open With solution (to get the double-click shortcut) for specific file suffixes covers all my needs, so thanks for this :) Mar 20, 2013 at 10:10
  • How did you get the services out of the services submenu?
    – fzwo
    Jul 17, 2014 at 10:03
  • To answer my own comment: If there are fewer than five services available for a file, the services are displayed as in your screenshots. Five or more services, they go into a submenu.
    – fzwo
    Jul 17, 2014 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.