Restore corrupted AppleScript script

Hi all

Can anybody help me out.
I always backup my stuff. But not this time, not this time that I worked a very long day on the improvement of my script.
And my mac crashed when I was in the middle of a version that would not save because I was halfway coding a new part in the script.
Now when I want to open the script (.scpt) AppleScript acts as if it will open, but then immediately crashes.
That is only the case with this script file. Other script open just fine.
I can open the file with a text editor, but that looks weird and is some machine code weird row of all kinds of characters and here and the a variable name.
In that it looks the same as any other AppleScript script that I open with a text editor.

Does anyone know of a way to restore or retrieve as much information from the file as possible ?

Thanks
Rienk

Mac book pro
OS X 10.7.5

Please do not start the “you should have backed up” thing.
I know. I just know and it hurts. Let’s see if something can be done. Otherwise I’ll start over…

Model: MacBookPro
Browser: Safari 534.57.2
Operating System: Mac OS X (10.7)

I am sorry for you.

Try downloading a 20 day evaluation copy of Script Debugger. Maybe it can restore it for you. Maybe

You can try the command line tool osadecompile. It might work. If it does it will give you the text of the script.

set f to choose file
do shell script "osadecompile " & quoted form of POSIX path of f

And if everything else fails, you can try xxd from the commandline, but then you’ll have to copy and paste, and reassemble your script. Enter man xxd in a Terminal window.

regulus6633,

You made my day! the osadecompile worked!
No idea what it did, but it did what it had to do.
Thank you so much!

And thanks to McUsril, too. I didn’t tried your solution, because regulus’ solution worked, but I appreciate your input.

Happy scripting from now on.
(and backing up… right now, of course)

best
rienq

Very nice rienq. Glad it worked and happy scripting! :cool:

Glad it worked for you, I learned something new as well. :slight_smile:

The trick is, is to put all the stuff you don’t care about in a TimeMachine backup quarantine, marking them, so they aren’t included, so those backups, doesn’t take that long!

So I am facing having to do this. It seems Google Drive corrupted my entire scripts folder! Agh!

The xxd output is pretty cryptic. Not much better than strings IMO. Any tips on reconstructing the scripts?

The error from the decompile command is -1753.

ScriptDebugger has a built in recovery feature for corrupted scripts, but I’m not sure if it works for scripts not saved by script debugger.

If they are script bundles and apps, you may be able to look inside their bundle contents for the scripts themselves and save those.

If that’s the case, you can even script the process if there’s a lot.

Well apparently I lucked out. When I was looking at the script files in the Finder, they weren’t sorted my name, and I discovered versions with (1) inserted in the name before the .scpt extension that were not corrupt. phew

…going to remove my google drive from the time machine excludes list, which I’d added before because I thought it was redundant.