Setting Document Associations With OS X
Mac OS X Only

Here’s what you need to do in OS X... I’m assuming a creator code of "STS1" and an extension of "sts" - remember the original app was called "TestAE":

If you have PropertyList Editor:

If you don’t have PropertyList Editor:

If you like, you can also change other data, such as copyright info ("NSHumanReadableCopyright") and version strings ("CFBundleShortVersionString", "CFBundleLongVersionString"). 6) Create your test stack, adding a ".sts" extension (mine was called "Dummy.sts").

Now comes the important part — reboot *twice*. Perhaps its the way I did things (create the dummy stack with the ".sts" extension first and then tweak the settings of, but I found that if I rebooted once, the dummy stack I’d created did not associate properly with

BTW: You'll know if the association works if the "Kind" column in the Finder shows "TestAE document" and not "Document" or "Metacard stack".

One final note: You can change the icons that your standalone uses for documents by downloading an icon editor for OS X (I tried a cheap one called Icon Machine III), and opening the file "MetaCardDoc.icns" in the Resources folder of the Contents folder. I would assume that for professionally shipping applications you could change the names of the '.icns' files, so long as you changed the references in the Info.plist file ("CFBundleIconFile", "CFBundleTypeIconFile").

Hope this works for you; please report back to the list and let us know if these instructions are sound. If they are, I'll formalize them and put them as a Tip on my site that anyone can access as needed.


When a document with the proper association is double-clicked in the Finder, your application will launch, but you will need to use some AppleScript to determine the path of the file that was opened:

on appleEvent theClass,theID
   if theClass is "aevt" and theID is "odoc" then
      request appleEvent data
      put it into theFiles ## files OS is requesting your application opens, one per line
      if theFiles is not "not found" and theFiles is not empty then
         ## code to open theFiles
      end if
      pass appleEvent
   end if
end appleEvent
Put that in your preOpenCard or preOpenStack script and you should be able to work with files that were opened from the Finder.

Posted 7/24/2002 by Ken Ray to the Use Revolution List   (See the complete post/thread)
Updated 6/15/2013 by Ken Ray