Re: Damaged scripts "Expected expression but found unknown token"
Re: Damaged scripts "Expected expression but found unknown token"
- Subject: Re: Damaged scripts "Expected expression but found unknown token"
- From: Stan Cleveland <email@hidden>
- Date: Tue, 24 Jan 2012 13:23:49 -0800
On Jan 24, 2012, at 11:40 AM, Eric Geoffroy wrote:
> Just recovered from catastrophic hd failure. I used Time Machine to restore
> files. There are several scripts however that no longer open. The error
> message is- "Expected expression but found unknown token".
>
> I'm unable to open them in the current Script Debugger or Script Editor.
> I also tried the Recover Script feature in Script Debugger but the damaged
> scripts are greyed out.
>
> Any way to save these?
> Should I drink the hemlock now?
Hi Eric,
I've seen the same -2741 error on occasion, but only in situations where the script opens, but won't compile. In nearly every case, my problem was with the AppleScript continuation character (¬), which is used when a long line of code is broken into two or more lines. This character's Unicode code point is U+00AC or decimal 172. In my case, it had somehow split into two characters: ASCII 0 (null) and 172 (¬). I suspect this had something to do with botched character encodings. I was able to delete the null characters to fix the problem.
You didn't mention what format your scripts are saved in. But based on my experiences, my only "shot-in-the-dark" suggestion is to try changing the character encoding of your script files with the 'iconv' shell command. Check first to see what encoding the files are in and what they should be. Sorry that I don't know if this is the actual problem and that I can't offer specifics on how to do it. You'll need to do some research into 'iconv' and text encodings.
No guarantees, but desperate times call for desperate, if potentially worthless, measures. Perhaps someone with more knowledge of script file formats could say whether this idea has any merit whatsoever.
To avoid such problems, I've long ago learned to save out a text copy of every script I work on (using the '.applescript' extension). I've automated this to happen after every editing session, so I also end up with a running history for each script. These text files are easily opened with any text editor, can be hand-edited if corrupted, and show all terminology for even missing applications or osaxen. It's an idea to think about for the future--if you don't drink the poison. :-)
Crossing my fingers for you,
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden