Applescript not saving

I have created an applescript and am trying to save it, but it will not let me save it at all. I have tried saving as application, script and it keeps telling me that it cannot be saved. I have sent to a coworker and it will not let him save either. I tried to do a very simple code and save, it allows me to save this.

I cannot figure out why this will not save and any help will be wonderful. Is there a limitation to how many lines I have?

other details…
the code is about 4500 lines.
the code works, I have ran the code and it does everything I want it to, no errors.

Please Help!!!

4500 lines? Hm… That sounds like a limitation… Save it as a “Text.” If that doesn’t work, copy the script into a plain text file (UTF-8, if you know what I mean) and add the .applescript extension at the end, and presto, you have a saved applescript.

4500 lines is a pretty enormous script. :slight_smile:

Besides Dylan’s suggestion, you could try recompiling the script immediately before saving it. if you’ve run it in AppleScript Editor (or Script Editor), all the properties, globals, and run-handler variables will have values which the editor will be trying to save with the script. Getting rid of these by recompiling often reduces the bloat by enough to allow the save to happen.

Presumably you have been able to save it in some form, since you’ve been able to send it to a co-worker.

I was able to save it in text edit, that is how I sent it to a coworker. I also was able to save it with the .applescript extension. After I save it with the .applescript extension, How can I all that script to be able to use it?

Thanks for the help…

Note that saving in Textedit is not enough; select Format>Make plain text before saving.

I’d say it should open in Script Editor on doubleclick. If it does not, use ‘open’ in the editor, or drag 'n drop.
Then click compile, and save as script.

I think I encountered this problem a few times in Tiger, and saving as plain text from Text Editor worked for me.

If it still won’t compile some invisible character might have crept in.
I would try commenting out blocks of code, and compile, until it does compile. That would identify the code where the offender is lurking.

Another trick: open the plain text version in TextWrangler, and set it to display invisibles. “Unprintables” show up in red.

Hi
You could try breaking down your script to many scripts of individual actions and run them from desktop,I have found that useful on bigger scripts

set LoadedScript1 to (load script (((path to desktop as string) & "some script.scpt")) as alias)
set LoadedScript2 to (load script (((path to desktop as string) & "some more script.scpt")) as alias)
set LoadedScript3 to (load script (((path to desktop as string) & "and some more script")) as alias)

run LoadedScript1
run LoadedScript2
run LoadedScript3

regards
bills

Browser: Safari 533.16
Operating System: Mac OS X (10.5)