Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Use Automator to ease document-app assignments System 10.6
As has been covered in many spots, including my own high-level look at the issue, Snow Leopard changes the way files are associated with their creating applications.

In short, you can no longer expect (at least in the near term) that double-clicking a file created by BBEdit will actually open that file in BBEdit. Until all developers start using Uniform Type Identifiers (UTIs) (for more on UTIs, see this detailed article at AppleInsider), users may be surprised to find a BBEdit .html file opening in their default browser when double-clicked.

How can you avoid these problems in the short term? You can drag a document onto the creating app's icon in the Dock; use the Open menu from within the app, or use the Get Info dialog to change the associated application for the document. I've taken to using the third method, but wanted an easier way to get it done. Enter Automator and Services...

For each of the main applications I use (Smultron, BBEdit, and Photoshop), I created a very simple one-line Service in Automator to change the owning application for a selected file or files with a keyboard shortcut. To create your own, launch Automator and select Service from the template chooser that appears. Set the pop-up menus on the right to files or folders and Finder. In the Library column, select Files & Folders, then drag the Set Application for Files action into the work area on the right.

Click the Application pop-up menu, and select your application of choice. Now save your Service with a fitting name; Set app to PShop for instance. Repeat this process for each of your often-used apps, changing the pop-up and renaming each before saving. You've now got a set of shortcuts you can use in the Finder's contextual menu to change the owner of a document or documents.

To make these even easier to use, visit the Keyboard Shortcuts tab of the Keyboard System Preferences panel. Select Services in the leftmost column, and then look for your newly-added Services in the Files and Folders section of the rightmost column. Click in the blank area to the right of each one's name, and enter a keyboard shortcut. I had trouble getting shortcuts with just Control or Option to work, so I went with Command-Control, and these seem to work fine.

Now I can set the opening application for any file with a keyboard shortcut. One could, with a bit of work I think, modify the Service to display a pop-up menu of your most-used apps, instead of creating one Service for each app. I'll leave that as an exercise for you, though, as it's beyond my Automator abilities.
  • Currently 2.27 / 5
  You rated: 5 / 5 (11 votes cast)

10.6: Use Automator to ease document-app assignments | 13 comments | Create New Account
Click here to return to the '10.6: Use Automator to ease document-app assignments' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Use Automator to ease document-app assignments
Authored by: fitzage on Sep 23, '09 09:27:33AM

You can always use the contextual "open with" as well.

And this gives me an idea for creating "open with" services that are easier than digging through the "open with" submenu. You could create a Photoshop one that only applies to image files, etc.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: PopMcGee on Sep 23, '09 09:56:02AM

This should be cleary fixed by Apple not bloody *censored*ing it up in the first place.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: wfolta on Sep 23, '09 11:42:34AM

Apple didn't screw anything up, they changed which workflow is favored:

1. Programmer. Lots-of-generic-files and lots-of-specific-apps-that-all-edit-generic-files. Like .txt or .html files and BBEdit, Smultron, vim, etc, etc, etc. This was the favored workflow.

2. Projects. You use programs that have sophisticated project files (Photoshop's PSD, Final Cut Pro, Logic, etc) where the output is generic and generally not directly edited (say JPEG from PSD, Quicktime file from FCP, AIFF from Logic, PDFs from Pages, etc). You want to view generic files, not edit them.

I, and I think most Mac users, tend to use workflow #2, and it's a royal pain when you double-click on a QT file and launch the world's slowest and least-featured previewer, Final Cut Pro, rather than a fast, full-featured (for manipulating QT files and their contents) Quicktime Player Pro.

And let's be honest, the previous way wasn't useful for workflow #1 if you used different programs on the SAME file at various times. It had to be that you edited certain .html files in one program, and other .html files in another, or specific PDFs in one program and different PDFs in another.

So if you worked in a specific subset of workflow #1, the previous way worked for you. Otherwise, it either did not help you much, or it actually made you go out of your way. So I think the 10.6 way of doing things is a benefit to most users, while a loss to specific kinds of technical, programmer-like jobs.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: Ilo on Sep 23, '09 10:11:53AM

There is nothing for Apple to "fix" The problem is due to BBEdit's failure to use the new and improved file identification system. They have had years to stop using the old deprecated system.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: robg on Sep 23, '09 12:21:41PM

The problem isn't just BBEdit. The problem is, at least in my testing, that a majority of the apps aren't using UTIs, so nearly every app will exhibit this problem.

Yes, it's not directly Apple's fault, but it's clearly Apple that turned off creator codes in 10.6. To a user, the fault will appear to Apple's.


[ Reply to This | # ]
Are UTIs read-only?
Authored by: hamarkus on Sep 23, '09 01:00:54PM

And thus not useable for the purpose suggested here. From a post at Appleinsider:
Apple's docs on kMDItemContentType:

kMDItemContentType: The UTI pedigree of a file. A CFString.

For example, a jpeg image file will have a value of public.jpeg/public.image/ The value of this attribute is set by the MDImporter. Changes to this value are lost when the file attributes are next imported.

So it can be written to, but the value will be discarded by Spotlight. Not quite read only, but effectively so.

[ Reply to This | # ]
Re: 10.6: Use Automator to ease document-app assignments
Authored by: Uncle Asad on Sep 23, '09 03:55:57PM

The AppleInsider article is just plain wrong when it comes to this specific part.

UTIs "replace" file types and filename extensions, and, unless you happen to be dealing with a file that only one application knows how to edit (com.robservatory.robg-app.robg-custom-file-format), are completely ineffective for application bindings. If your application writes files in a common format, like public.rtf, that doesn't help you at all. It says you *can* open the file, but so can dozens of other apps, and you can't claim default ownership of the file without rendering the file unopenable (practically speaking) by other applications. To use the method AppleInsider suggests, you'd have to say that your RTF files have the UTI of com.robservatory.robg-app.rtf *and* change the filename extension to something like ".robgrtf" in order to prevent Mac OS X and other applications from overriding your UTI declarations with the standard "public.rtf" one.

Yes, that's right; UTIs aren't associated with a file at all, not like a type code was filesystem metadata that moved with the file, or the way a filename extension is part of the file's name. No, UTIs are a higher level mapping system set up by the OS, a way to map filename extensions and file types into a common system. UTIs are defined in an application's plist (or by Apple in the OS) in reference to either file types or filename extensions; that is, I say my app can open files of type 'RTF ' and extension "rtf" and that any files that match these criteria have the UTI of public.rtf. Again, the UTI is not associated with the file itself the way, nor is it a way of mapping ownership of the file to an application. All it does is say that "RTF " and ".rtf" are both the same type of file, "public.rtf".

Sure, you can override the default application binding (of whatever app Apple decides has precedence for "public.rtf") by using Open With in the Finder (and on a permanent basis via the Open With in the Get Info window, which is what this Automator action simulates), but you're not using UTIs; you're adding separate filesystem metadata stored in

[ Reply to This | # ]
Re: 10.6: Use Automator to ease document-app assignments
Authored by: hamarkus on Sep 24, '09 06:08:00AM

"you're adding separate filesystem metadata stored in"
Can an application write into this location (when saving a file)?

[ Reply to This | # ]
Re: 10.6: Use Automator to ease document-app assignments
Authored by: Uncle Asad on Sep 24, '09 01:47:17PM
According to Peter Hosey (on the development teams of Adium and Growl), there's no public API for writing the override resource. In theory an app could reverse-engineer the function and use it to write the resource, but that could stop working (and maybe even break the app) at any time.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: llee on Sep 25, '09 11:51:19AM
I completed the assignment of creating an example of an Automator Service workflow (and an AppleScript) that let's you choose the application that will be assigned to your Finder-selected files from a list of applications that you can configure yourself. I tweeted a preliminary version of this to Rob G. yesterday, but todays version includes a fix for a problem wherein the chosen application would be launched when the list selection was made. I've also included both the Automator Service workflow and an AppleScript droplet version in the linked .zip archive:

Set Default Application for Selected Files

To configure the choice list, you'll need to know each Application's bundle identifier. The easiest way I know to find the bundle identifier is to type the application's name into the search field of PrefSetter. Maybe that tip merit's its own hint.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: llee on Mar 27, '10 07:35:42PM

I just wanted to fix that broken URL in case you tried it.

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: llee on Nov 12, '12 09:16:12AM
New link for the download. (because the old one is going away soon)
Edited on Nov 12, '12 09:16:42AM by llee

[ Reply to This | # ]
10.6: Use Automator to ease document-app assignments
Authored by: ElRay on Jan 07, '10 01:51:25PM

The problem is not just apps that haven't been updated. Every time I bring files to my Mac from a Windows or Unix system, that do not end in .txt, the Finder & Spotlight treat them like unix executables, so they do not get indexed. I can use Get Info to set the default application, or drag them to an app's icon in the Dock, but until there's a way to assign the concept of "TYPE", then things remain broken. I can't use "Open with ..." without going through the file selection dialog box and (most importantly), the files will not appear in any OS searches (Spotlight, Finder Window Toolbar or Sidebar Saved-Searches) because the content will not be index, because the system doesn't know they're TEXT files. In all the articles I've read, there's no mention of an official API to set UTI data.

And adding .txt, .html, etc. is not a viable option. It would seriously break the systems that these text files come from.


[ Reply to This | # ]