Thank you for the screenshots! Workspaces indeed just load the saved state but do not retain the current one.
What’s the intended purpose of the workspace in your case actually? Retaining the current state and restoring a saved state sounds like opposite options.
Did we misunderstand each other?
Question: How do I change the workspace but keep the current document?
Answer: “Only via scripting.…”
tell application id "DNtp" to load workspace "My Workspace"
I would like to work in the same document but change the “layout” of the window.
Do I understand correctly. Whether I use the menu to change the workspace or use this script, both do the same thing? Why do I need the script then?
You don’t as it’s obviously not what you’re looking for. The menu closes all windows/tabs and loads the workspace, the script just loads the workspace (meaning that additional windows/tabs are opened, not the current ones changed).
Ok, then at least it was nice to chat with you.
Regarding the quotes issue, there is usually an indication of the point of failure in Script Editor…
And check the windows. The window you’re working on should still be open.
But here’s is a simple extension of the script (with proper double-quotes :P)_
tell application id "DNtp"
set currentWindow to think window 1 — This caches a reference to the frontmost window
--Think window covers both viewer (main) and document windows
load workspace "Last Session"
set index of currentWindow to 1 — This brings the window back to the front of all windows