I’ve got a series of Mac files that were converted from one system to another, and only after it was too late to do much about it, we realized the files got stripped of their Macintosh-specific information (resource fork presumeably). So file type and creator codes are gone, icon previews as well as embedded previews for file types like EPS.
I’ve written a script to “fix” some of these files when they are retrieved from the new system, based on certain assumptions. For example:
–If it ends in “.psd” make the appropriate changes to File Type and Creator, as well as open the file in Photoshop and re-save to get the preview back.
–If it ends in “.ai” or “.indd”, fix the File Type and Creator to Illustrator and InDesign
And other such basic assumptions. However, we still have about 25% of the files which have no extensions and while the average human using these files can figure out what they are by looking at the file names or whatnot, then fix the files manually, the logic is too “fuzzy” to automate.
I’d like to automate this “hole” and I figured if I could peer inside the files “guts” and figure out things to look for in there I could use this plus a series of checks to fix all the file’s resource information.
But the first trick is to look inside.
I got BBEdit to peek at the raw file code of some file types, like Illustrator, by simply changing the file extension to “.txt” to trick it into opening them. Sure enough, the word “Illustrator” is in there near the top.
However, BBEdit will try to display graphics images (like JPEG) even when you give it fake extensions. Apparently it is pre-emptively peeking inside the headers itself (darn smart buggers those BareBones folks).
So what I need is a program, preferrably scriptable (but I’ll resort to UI scripting if I have to), that I can have “peek inside,” look for certain strings, then fix the resoruce information via the Finder. I had hoped BBEdit would work, which would mean TextWrangler might have worked, since being able to access BBEdit’s GREP engine would have been useful in this automation.
One last thing: I can’t fix the files where they reside. They “live” in a Windows-based asset management system. I can only fix them at the user level, after they download them. So this script will see heavy use. My first version of this “fixit” script was a drag-n-drop script, the next version is going to get a host of enhancements via FaceSpan.
Anybody have any ideas?