SD8 doesn't remember open scripts after computer restart

I have On Startup: Remember open scripts checked in Preferences.

However, the open scripts are not remembered after restart: no scripts are open in SD after restart (even if the Mac was restarted while SD was running with open scripts).

There’s no issue when relaunching SD: it does remember open scripts after relaunch.

SD 8.0.5
macOS 13.1
Mac Studio M1 Max

Thanks for the bug report. We’ll look into it and see if we can sort this out for an upcoming maintenance release.

I suspect that when you restart your machine, macOS is causing Script Debugger to shutdown in a way we’ve not tested for and the app’s preferences are not properly being flushed to disk. As you’ll imagine, this is a difficult scenario to debug.

1 Like

Just found out that a similar issue happens when SD crashes: it doesn’t remember open windows of saved documents after relaunching. Which, I guess, is part of the same issue.

(After a crash SD will remember unsaved documents, which probably is a built-in functionality… I’m not experienced in document-based apps).

I’m sure you don’t need my suggestions on how to solve it, but one possible primitive solution for existing files is to just write the path of a document to preferences once the user opens the doc in SD. This way it’s always stored in prefs no matter how the app is closed. (Once again, I’m sure there are better ways to achieve this.)

This makes sense as Script Debugger updates preferences with the open windows/scripts as part of its shutdown process. I’m sure we can improve this.

2 Likes

BTW this issue sometimes also happens when just quitting Script Debugger (without restarting the Mac): open scripts won’t be remembered after relaunch. Seems to happen at random in such cases.

Ok it looks like I can consistently reproduce this issue under the following conditions (in addition to a computer reboot):

-At least one of the open documents is unsaved (an existing unsaved document or a never saved Untitled document)

AND

-You quit SD via the Quit menu in the Dock (right-click the Dock icon > Quit).

After relaunching, SD won’t remember the previously open docs (I’m obviously talking about the ones that were already saved, not Untitled).

This problem does not occur when using ⌘-Q (or the SD > Quit command).

Isn’t it bizarre that the Quit command has different effects depending on how it’s been invoked?

Yes, it is bizarre and frustrating from our perspective as well. When you quit an application in this way (Dock->Quit or System Shutdown) macOS applies an optimization where the application is terminated without allowing it to go through its full shutdown process in order to accelerate the operation.

Thank you to everyone for digging into this and figuring out when the happens. We’ll try an improve things in a future maintenance release.

2 Likes

This build should address this problem:

Thanks Mark,

I didn’t try a reboot yet - but the Dock’s Quit menu issue is NOT fixed.

Like I mentioned, the problem only occurs if there’s an unsaved document open among other documents. That is, SD will ask to save the document on quit. It doesn’t matter how you dismiss this dialog - Save or Don’t Save, but open documents still won’t be remembered after this.

I wonder if it’s not the case on your side?

I also have just tested a reboot - and the problem is also still there.

This test also involved an unsaved file open in SD (as described in my previous post).

When I quit SD one way or another, I pretty much always have at least one unsaved file open so I didn’t test other scenarios.

I’ve improved things in the latest Script Debugger 8.0.6 build. Please give it a try and let me know how it works for you:

Thanks Mark,

However, it doesn’t seem to be fixed yet.

I didn’t try the reboot yet - but the problem with the Dock’s Quit menu remains the same.

image

You’ll have to describe the test case again for me then.

My tests with SD’s Quit command and the Dock - Quit command have SD remembering all documents open at the time the application quits. Unsaved documents are saved, and then re-opened when Script Debugger launches again.

Intersting…

Here’s my test case:

-Open an existing document

-Create a new document (of any kind)

-Type something inside the new doc (to make it unsaved)

-Right-click Script Debugger in the Dock > Quit menu

-Click “Don’t Save” in the “Do you want to save changes…” dialog

-Relaunch SD

No documents will be open on my machine. (I don’t expect new unsaved docs to be open, obviously, only the previously existing ones.)

Notes:

-Just like before, the issue only happens when using the Dock’s Quit menu.

-If you click “Save” in the “Do you want to save changes…” dialog, the issue doesn’t happen - all docs will be remembered on relaunch. That’s indeed a new fix (as previously clicking Save wouldn’t make a difference).