Recently I had a problem with some AppleScript .scpt files being somehow corrupted such that opening them in a script editor (Apple’s or Late Night Software’s Script Debugger) rendered them as ‘garbage’ instead of a readable script. Actually, it appeared to be the compiled code being rendered as plain text: button labels, text properties, etc. were readable, but the commands, keywords, etc were not.
The key to identifying this situation is that the characters “FasdUAS ” appear near the top of the text.
Using Spotlight to view the file showed the script correctly, so I knew the information to recover it was ‘in there’ somewhere. But the Spotlight window provides no way to copy the data (jn 10.10 at least, which is where I am).
The solution to recovering these files is a bit bizarre: use Spotlight to ‘find’ the file, and copy the compiled script from the preview in that window. Paste that into a new script, recompile, and save.
Note: my first thought was to paste the text back into the corrupted script and compile that, so I wouldn’t have multiple files floating around. That seemed to work except that reopening the file opened as text, requiring a recompile each time. Clearly there’s something about the file that thinks it is plain text (probably .applescript) and finding that might be the key to repairing the original file.
But that’s a task for another day.by