Introduction

Suppose you’ve downloaded a PDF from the internet onto your classic Mac, but the Finder doesn’t know that it’s a PDF. You’d expect to be able to double-click on your new PDF and it’d automatically launch Adobe Acrobat for you. Why doesn’t it work? Because the file isn’t properly associated.

Unfortunately, associating a file with a specific application is a little tricky in Classic Mac OS. You need to use a program such as ResEdit to adjust the “creator string” and “file type” inside the resource fork of the file.

This sort of metadata is typically lost (or not even present to begin with) when your newly downloaded file didn’t originally come from an old Mac. That’s why an old, original PDF may properly “look like” a PDF in the Finder, but a new one just downloaded from the internet does not.

The creator string and file type are special 4-character codes. How do you know which codes to use? You can use ResEdit to examine the creator string and file type of a known good example – say, an old PDF. Then you would use ResEdit to plug these codes into the the new PDF you’d just downloaded.

This method works, but using ResEdit just to examine some metadata can be cumbersome. Fortunately, with a little bit of AppleScript, you can create a more lightweight tool which simply tells you the relevant metadata.

Source code

Here’s the source code to a simple app which prompts the user for a file or application, and then returns the creator string and file type codes in a dialog box. Simple.

-- RevealCreatorString
-- Charlotte Koch <dressupgeekout@gmail.com>

set TheFile to (choose file with prompt "Choose a file or application...")
set TheProperties to (info for TheFile)
set CreatorString to file creator of TheProperties
set TypeString to file type of TheProperties
set FileName to name of TheProperties

set Line1 to FileName
set Line2 to "Creator string: '" & CreatorString & "'"
set Line3 to "File type: '" & TypeString & "'"
set TheMessage to Line1 & return & return & Line2 & return & Line3

display dialog TheMessage

Download

I’ve also created little double-clickable applications from this script. One of them has an explanatory splash screen, and the other does not. These were created on my G4 tower running Mac OS 9.2.2, and then packaged together into a StuffIt archive.