"The document could not be saved"

This weekend I upgraded from Leopard to Snow Leopard (in preparation eventually for Mavericks), and ever since I cannot save any modified AppleScript applets (“Application”) from AppleScript Editor v2.3 (118), AppleScript v2.1.2. Error: “The document ‘xxx.app’ could not be saved.” I can do a Save As over top of an applet, but not a straight Save. (Even with newly-created applets from within this Snow Leopard AppleScript Editor.) I checked the folder containing my applet with Finder Get info, and I do have Read and Write permissions. Has this happened to anyone else?

Hello.

I had a clean install of Snow Leopard, and I had never any problem with saving as an applet, but I allways had to save as in order to save as applet. :slight_smile:

Thanks for the reply, McUsrII.
Of course saving as an applet the first time requires a Save As (doing a Save defaults to Save As with a new document), but what happens when you do an Open or drag & drop an existing applet onto AppleScript Editor and modify it? Can you just do a straight Save to update it, or do you get my error, too, and have to do a Save As to replace the applet file on disk in order to update it with your changes?

Hello.

I’m not sure, if I had such problems, or not. One reason is of course that I have done most of the stuff with Script Debugger. but it may have happened that I had some trouble with saving applets from Script Editor, but then I just switched to script debugger, so I would have hardly noticed the problem. Does Smile work for you?

Thanks for the suggestion; I’ll look into Smile & Script Debugger, but in the meantime, I’d really like to know what’s going on with AppleScript Editor in Snow Leopard and find out why it can’t do a straight Save of applets after changes. I never had this problem with Apple’s Script Editor in Leopard. Does anyone else have any ideas what’s wrong?

Don’t panic.

I got this behavior after a major system upgrade for some scripts.
If I remember well I applied a reboot in safe mode as described in :
http://support.apple.com/kb/HT1564?viewlocale=en_US&locale=en_US
and retrieved a normal behavior.
I guess that one or several cache files were more or less corrupted and as the process cleaned them I retrieved a normal behavior.

Never got worse that the switch to AppleScript introducing the Unicode support when all my scripts containing accented characters in varnames enclosed with vertical bars were unusable because the bars were gone.

So, relax, take a breath then go to apple menu, restart with the shift key depressed.

I will be back tomorrow to read that everything retrieved its standard behavior.

Yvan KOENIG (VALLAURIS, France) mardi 18 mars 2014 21:18:45

I was really hoping that would work, but now it’s even worse:
“ With a new document, I’m getting the error, “The document ‘Untitled’ could not be saved as 'Untitled.app”. The file doesn’t exist."
“ And now it gives the same kind of error when I try to save any new doc as a script. (Before it only gave an error when trying to save an existing applet.)
“ Now I can’t Save As over itself, replacing. Same type of error.
“ When I opened an applet containing my long list of Mac startup items, it asked me to locate almost every single one of them

Aaarrgghh! H-E-L-P !!

It sounds like all your applets have been saved in the single-file format that is no longer supported in 10.6 and later. You need to re-save them in the newer bundled format. From the 10.6 release notes:

Good thought, Shane, but during my years in Leopard, I’ve always explicitly saved applets as Application Bundles, because the old single-file format applets had to run as PPC under Rosetta; it took the bundle format to make them run under native Intel… Besides, my first problem immediately after upgrading to Snow Leopard was not being able to open Application Bundles, modify them, then doing a Save ” I had to Save As, overwriting them, to save my changes. But now after rebooting in Safe Mode to clear caches and who knows what else, I’m afflicted with all of the additional maladies listed two posts above, including not being able to Save As a brand new doc as an application bundle, or now even a script… I can’t believe I’m having all this grief so freshly soon after an OS upgrade! I hope others notice my symptoms as something they’ve seen before and can offer another solution. Your and Yvan’s suggestions were good ones, please keep 'em coming, guys! Thanks!

Did you already asked Disk Utility to repair permissions on your disk ?
If not, try to do that.

Yvan KOENIG (VALLAURIS, France) mercredi 19 mars 2014 10:01:17

Ohhh, thanks for reminding me, Yvan. I always repair permissions & fsck before and after an OS update, but had forgotten to repair permissions afterward this time. But, alas, after just now doing so, I still get the error, “The document ‘xxx.app’ could not be saved.” Even when:
” create a new blank window
” drag & drop old un-savable window’s text to it
” Save As new applet and close
” open new applet
” modify it and try to Save

Hello.

I wonder if your account at present is an administrative account.

^ Yes.
(But even if it weren’t, why would that stop saving an AppleScript applet?)

Hello.

Because your wouldn’t be a member of the group staff, and therefore lack the rights to save things before going in and change the owner at various places, say that you lack adminstrative rights on a folder, that is owned by root.

By the way.

What happens if you create a new applet, and then tries to save it after having edited it?

If I were you I’d look for some third-party diagnostics app, or reinstall from a clean disk, that is, if you have a backup of your data.

Hello.

The first thing you should do, is to read your console log thoroughly, and remove any stuff that creates dylib conflicts, then perform a safe boot, and see if any problems dissappear. (Just be sure to remove the old stuff that takes part in conflicts, and not the new).

Thanks for the suggestions, McUsrII.
¢ Oh, I see, yes. But I was just trying to save applets I had on my Desktop, so surely even a non-Admin user should be able to do that. (But it’s moot ” I am in an Admin account.)
¢ Yeah, the thread’s getting long now, but I did say in the first post of this thread that I can’t do a straight Save of an applet even when creating a new applet, and then trying to save it after having edited it.
¢ I just did a search in my Console displaying “All Messages” and “dylib” does not occur anywhere.
Thanks, all good ideas. Please keep 'em coming, folks!

Well. You could of course try to look at “All Messages” in the Console.app, while you are trying to save files.

Generally speaking you would probably have a lot of warnings and errors in your Console.log, if you have installed osaxen’s, Preference panes, keyboard drivers and the like on your Leopard installation, -Snow Leopard had a major upgrade of the frameworks, so you must expect some stuff to have broken. It might not be intuitive as to what creates your current problems, so it is best to have as little messages in the Console as possible.

Oh, it wasn’t “dylib”; rather, it was “DYLD.” The console log below is while I tried to save an edited applet. Looks like I need to go through my old osaxen and such, and do an old fashioned conflict isolation. Stay tuned…

Hello.

It doesn’t seem that you have to increase the logging level to find errors :slight_smile:

Anyways, you have a current logging level of 5 (NOTICE) should you want to increase the level to 6 (INFO) or 7 (DEBUG), then the manual pages below will guide you in the right direction.

I don’t think you need to do that at this stage, but should someone ever have troubles they can’t figure out by reading the log, then that may be a possible way to go, if the error isn’t trapped by a diagnostics tool.

Indeed, most of the OSAXen are PPC only. You have to update the files (like Adobe Unit Types where an Intel version is available) or to drop them