Is there a “scratch buffer” à la emacs where one can write a few lines and test some code without modifying the code currently being written ?
No, not as such. But you can create a new document tab, enter your code, experiment, and then copy-paste back into your main script.
I’m not seeing a “Merge all windows” item in the Windows menu, is it a oversight on my part?
Not an oversight. Script Debugger’s tabbed window implementation pre-dates the one Apple introduced in macOS Sierra and does not offer the same functionality. We’ll probably move to the sierra tabbed window APIs in Script Debugger 7.
This is what I do all the time. Which leads me just to offer a gentle reminder for a feature request in SD7: any chance we could have horizontal split screen view showing two different script documents?
That would make this kind of workflow much more convenient.
Hey Folks,
Script Debugger is scriptable…
I have a specific script on my file-system I use for this purpose.
⌃⌘O opens it.
One of my most used Keyboard Maestro macros is to toggle the frontmost position of the front two windows.
⌃⌥⌘SpaceBar
So it’s dead-simple to work with two documents at once.
-Chris
I like your suggestion, Phil.
In the meantime, I just designed this layout, which seems to work OK:
At the bottom is a SD window of a saved document “My Scratch Pad.scpt”
- saved to the SD Scripts folder
- Title bar turned off
- Results panel turned off
- All to minimize space used and minimize distractions
I’ve set SD6 prefs to “Remember open scripts” on startup. So, I’ll always leave My Scratch Pad open when I close SD, and it is opened automatically for me next time.
So far, so good. But if I close all other windows, when I open SD6 I have to create a new document window. ⌘N does this, but then it does NOT have the Title bar showing. So I have to manually show it.
None of this is that difficult. I’m sure I could write a script to open SD6 with the windows as I want them. Currently I am using LaunchBar (LB) to open SD6, and most of my other apps. I’m sure I can train LB to run a my SD setup script when I type “SD”.
This script will cascade all the open windows (from back to front) then position the first two script windows side by side. It ignores all other windows, just script windows. You can also remove the cascading part, if that’s not your thing.
tell application "Script Debugger"
-- return bounds of script window 1
set maxRight to 1280
set maxBottom to 760
set windowLeft to 0
set windowTop to 23
set windowRight to round (maxRight * 0.75)
set windowBottom to round (maxBottom * 0.75)
set x to the count of script windows
repeat until x = 0
set currentBounds to bounds of script window x
set currentWidth to (item 3 of currentBounds) - (item 1 of currentBounds)
if (windowLeft + currentWidth) < maxRight then
set windowRight to windowLeft + currentWidth
else
set windowRight to maxRight
end if
set currentHeight to (item 4 of currentBounds) - (item 2 of currentBounds)
if windowTop + currentHeight < maxBottom then
set windowBottom to windowTop + currentHeight
else
set windowBottom to maxBottom
end if
set bounds of script window x to {windowLeft, windowTop, windowRight, windowBottom}
set x to x - 1
set windowLeft to windowLeft + 10
set windowTop to windowTop + 25
end repeat
set windowLeft1 to 0
set windowRight1 to (round (maxRight / 2)) - 1
set windowTop to 23
set windowBottom to maxBottom
set windowLeft2 to windowRight1 + 1
set windowRight2 to maxRight
set bounds of script window 1 to {windowLeft1, windowTop, windowRight1, windowBottom}
set bounds of script window 2 to {windowLeft2, windowTop, windowRight2, windowBottom}
end tell
The problem with any such solution (and I have my own version, too, using Hammerspoon) is that you still end up with two complete windows, each with their own Event Viewer and Inspectors. That then invevitably entails a lot of repositioning and so on.
The split view that SD6 current has is the right solution. The problem is that its limited to only showing one and the same script in each split.
Eventually somebody will implement the buffer/(file/)window/frame system that makes emacs such a powerful window management tool
I agree that a SD6 split window that supports different documents would be ideal. But until then I have automated use of my Scratch Pad using KM Macros and scripts so that it is only a very minor inconvenience.