0

I have some content saved in Script Editor. They are saved in the 'default' way where I simply CmdQ.

It happened that my laptop ran out of ram, or had some other odd issue, and the contents in the Script Editor would not be saved in that default manner. After restarting the computer, I could not longer find the content when I open Script Editor.

How can I search for the lost content? Where does Script Editor noramlly save its content?

2
  • 1
    RE: "t happened that my laptop ran out of ram" -- That should be a non-issue as the OS will write to VM (swap file). Unless you are incorrectly using "ram" and you actually mean disk space. Jul 23, 2021 at 14:56
  • @user3439894, yep ran out of disk space and ram
    – Pacerier
    Jul 23, 2021 at 15:53

2 Answers 2

1

They are saved in the 'default' way where I simply CmdQ.

In macOS Catalina and macOS Big Sur I do not find that to be the case. If in Script Editor, if I press ⌘Q I'm presented with a Save As dialog box where I have to choose between Delete, Cancel or Save.

Where does Script Editor noramlly save its content?

That said, when Script Editor opens a document, what happens is at ~/Library/Autosave Information/ a file named com.apple.ScriptEditor2.plist is created/updated and a file named Unsaved Script Editor Document.scpt is created/updated. As more documents are created a new document named, e.g., Unsaved Script Editor Document 2.scpt, where the number in the document name is incremented as more documents are created.

5
  • I think the 'ask to save' will be a consequence of system Prefs> Ask to Keep changes. If that's unchecked, it doesn't ask, as autosave on quit is switched off, in effect. but, yeah, i didn't spot the Unsaved Script Editor Document until now
    – Tetsujin
    Jul 23, 2021 at 14:26
  • @Tetsujin, In System Preferences > General I have [] Ask to keep changes when closing documents unchecked, so you'd think it wouldn't ask, but it does. Jul 23, 2021 at 14:32
  • I've been toggling it to try force it, but not relaunched Finder or relogged & right now it's being really confusing. - It seems to save tiher the ScriptEditor2.plist or the Unsaved Editor Doc depending on which way that is toggled. D'oh! maybe I was thinking of 'Close windows when quitting'. That probably forces the save dialog. <-Tested, yes, that's it.
    – Tetsujin
    Jul 23, 2021 at 14:37
  • Ahh… to confuse me still further, if you delete the .plist without emptying trash, it can still find it.
    – Tetsujin
    Jul 23, 2021 at 14:41
  • I think I've tied it down a bit further - it being able to find deleted files in Trash really threw me for a while.
    – Tetsujin
    Jul 23, 2021 at 14:59
1

There are three places I can find where this data is stored.

~/Library/Saved Application State/com.apple.ScriptEditor2.savedState
This, in common with most saved state folders, remembers which files were open & their window positions etc. It only does this for existing script files, already saved somewhere on your disk.
~/Library/Autosave Information/com.apple.ScriptEditor2.plist and
~/Library/Autosave Information/Unsaved Script Editor Document
These are responsible for holding the contents of completely unsaved files.

When you Quit & rely on autosave, then completely unsaved files are saved in the Autosave folder, previously saved files have their changes written back to their existing saved file location. This works even if you change the file name beween launches.

2
  • In autosave folder I have only 2 files, Unsaved Script Editor Document.scpt and com.apple.ScriptEditor2.plist, and I see that the .scpt file has been overrided with new content instead of storing the old script. Are you aware if the old content is logged anywhere else?
    – Pacerier
    Jul 23, 2021 at 16:05
  • Time Machine… otherwise, no, it's automatically overwritten. You might be able to use some kind of file recovery software to delve through many, many older versions, if they haven't been directly overwritten. File systems don't literally overwrite a file, they make a new one then delete the old. As your drive would appear to be dangerously full, I wouldn't hold any hope for that approach.
    – Tetsujin
    Jul 23, 2021 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .