Script Debugger 8 has been released and the beta testing period has ended as of May 3, 2021.
Note that if you purchased Script Debugger 7 after October 18, 2020 you are entitled to a free copy of Script Debugger 8. Please visit the purchase page and enter your Script Debugger 7 registration number into the upgrade form.
Thank you to everyone who helped test Script Debugger 8. We really appreciate the time you contributed towards making Script Debugger better.
The release of Script Debugger 8 marks Script Debugger’s 26th anniversary as a continuously developed indie Mac application.
Script Debugger 8 requires macOS Big Sur, macOS Catalina or macOS Mojave. Script Debugger 8 supports macOS Big Sur on Intel and Apple Silicon processors natively.
The following is a summary of the changes in Script Debugger 8. Additional information is available through the Script Debugger Beta category of the LNS Support forum. Specifically, these posts:
- Where Did It Go?
- Scripting Tabbed Windows
- Bundle and Export Settings
- Direct Export
- Script Libraries
- Line-Break Changes
- Version & Build Numbers
Script Debugger 8 runs natively on Apple Silicon Macs. Additionally, when running on Big Sur, script applications created with Script Debugger 8 run natively on Apple Silicon. Note that there are code signing and other considerations when creating script applications on Big Sur. See Big Sur: Lost Properties for more details.
Script Debugger 8 adopts the Big Sur appearance when running on Big Sur systems.
Big Sur’s window title design reduces the amount of space available for toolbar items. Script Debugger 8 alters the default toolbar configuration when running on Big Sur to accommodate this change. Note that if you are upgrading from Script Debugger 7 your toolbar customizations will not be carried forward to Big Sur and you must re-apply your customizations manually.
The script timer has been redesigned for Script Debugger 8 to use less space in the toolbar. The timer now has two modes: Timer and Stats. You switch between modes by clicking the timer.
Script Debugger 8 adopts the standard macOS tabbed window appearance and behaviour.
Script Debugger 8 is consistent with all other macOS applications supporting tabbed windows. You can drag within a window to re-order or between windows. Tabs can be dragged out of windows to create new windows. There are additional menu comments in the View and Window menus.
Show All Tabs:
Script Debugger 8 fully supports Dark Mode. This applies to user interface elements and script text formatting. Please see the Themes section for details of how Script Debugger accommodates Dark Mode/Light Mode transitions.
Script Debugger 8 introduces the notion of color themes. Themes are used to change script formatting when switching between Light and Dark mode, or simply to provide alternative formatting options. Please see this forum post for further details.
Script Debugger 8 allows you to configure your Sparkle app cast settings when generating enhanced script applications.
The Script Debugger 8 preferences panel has been redesigned to facilitate searching for preferences settings.
Script Debugger 8 introduces a new Preferences panel, Building. Much of it relates to the Direct Export feature, and is covered here. However, there are two other important settings.
Under Saving Applets, there is a checkbox,
Lock main script. When this option is checked and you save an Apple Applet document where Persistent Properties is disabled, the applet’s
main.scpt script file’s permissions will be set to read-only, to prevent it from being modified when run.
This is unnecessary for Enhanced Applets, and applets that are saved under Big Sur and not intended to be run on earlier versions of macOS. However, if you are saving applets in Big Sur and distributing them un-notarized to users on earlier versions of macOS, this will stop them from being modified when run, and hence having broken signatures, in such cases.
This file locking occurs automatically when exporting an applet signed to run locally, regardless of the setting.
The second option, under Saving Script Bundles, is the checkbox
Save .scptd files in version-control-friendly format. This is an option designed for those who use version-control systems. The explanation is a bit technical, so if you don’t use such a system, feel free to ignore it.
The problem with AppleScript and version-control systems is the source is stored in compiled form, unless you save as text. But when you save as text, handling projects that involve other resources becomes more complicated. And document-level settings become more fragile.
With this setting, you can save files in
.scptd form, and still peruse — and modify — source code in version-control systems. The code is still stored in compiled form, but it is also stored in .rtf form, and when documents are opened, the .rtf form takes precedence.
This scheme takes advantage of changes Script Editor introduced when it converted to autosave. If, in System Preferences, you turn off the option to ask whether to keep changes when closing documents, you can see it in action. Make a change to a Script Editor document so that it cannot compile, then quit the application. You can then open the document — in Script Editor or Script Debugger — and the change will be present (with the document marked modified in the case of Script Debugger).
What happens in this case is that Script Editor saves the last compiled version of the script in the bundle’s compiled
main.scpt file, and then saves the current source in a file called main.rtf, in the same directory as
main.scpt. When you open the document again, the editor first looks for a main.rtf file, and falls back to the
main.scpt file if it is not found.
In Script Debugger, the facility is used a bit differently. Code that will not compile still cannot be saved, but when this option is on, the same code will be saved in both
main.rtf. This means the code in main.rtf can be read, and edited, in a version-control system — it will have precedence when the script is next opened. The only requirement is that any modifications will need to be followed by a recompile before the script is deployed.
In combination with the new Direct Export feature, it can make things more streamlined in some situations.
The biggest are of change in terms of scripting is in access to window tabs (this is covered in some detail here. But there are also several other scripting changes.
The application object has several new properties, and loses some others. With the introduction of Color Themes, the
apply handler formatting,
handler color, and
script background color properties been removed. The
AppleScript format class is also no longer relevant, so it is no longer an element of the application.
Script Debugger now supports searching, via the
search command, with relevant application properties
search uses regex,
search matches words,
search ignores case and
search wraps. You also set the search and replace string via application properties:
search string and
search replace string.
open in tabs property has been deprecated, in favour of the
prefer tabs property, which lets you choose whether to follow the system setting or override it.
Other new application properties are
can notarize, which tells you if the Mac meets the requirements for notarizing apps, and several properties that cover settings in the Preferences → Building pane:
copy notes file, which reflects the setting for the SD Script Notes.rtfd file;
export destination fixed and
export folder name, for controlling where exported files end up;
lock applets, which controls whether applets are locked; and
version control friendly, for scripts saved as script bundles.
You can get a list of available themes through the
available themes property, and get or set the active theme via the
current theme property. And the application no longer has an
AppleScript formats collection.
document class has some new properties:
autoincrement build number on export joins
autoincrement build number;
embed run only and
embed used frameworks join
embed used libraries for exports;
export name gets and sets the name used used for exported files; and
local codesigning controls whether to sign to run locally when exporting apps.
codesign identity and
codesign on export only properties are no longer applicable, and have been removed.
There is a new command,
direct export, which provides access to the new Export Run-Only facility. You pass the document as the direct parameter, and the script type for the
For the past several versions of macOS, all applications, including AppleScript applets, need to be notarized to be approved by Gatekeeper. Notarizing requires membership of Apple’s paid developer program, and involves code-signing with a special identification certificate, plus submission to Apple for scanning for malware.
Script Debugger does not directly support notarizing, but instead links with Late Night Software’s free SD Notary application. If Script Debugger detects that you have a valid Developer ID certificate, a copy of SD Notary, and meet the other requirements for notarizing (including having a recent version of Xcode installed), when you export an applet, the dialog will include an extra button, Notarize.
When you click this button, the file will be passed to SD Notary, where you can customize the app’s entitlements if required, and press Submit to submit it for notarizing.
Script Debugger 8 introduces the Bundle & Export Settings dialog which combines various previous settings, and some new ones, in one place. Please see [this forum post for more details](SD8: Bundle & Export Settings https://forum.latenightsw.com/t/sd8-script-libraries/2851).
Build & Export Settings:
Build & Export privacy Settings:
Build & Export Advanced Settings:
Script Debugger 8 simplifies exporting of run-only scripts by making it a one-step process, which we call Direct Export. It’s part of a suite of changes to help users better manage scripting projects. As the requirements for scripts become more complicated with issues like code-signing and notarizing, these changes make it more convenient to separate the development and deployment processes. Please see this forum post for more details.
The Persistent Properties option in the Script menu has been removed. As of Script Debugger 8, properties and top-level values never persist: when you run or save a script repeatedly, these variables will contain their initial compiled value, if any. Please see this forum post for more details.
Support for viewing Script Libraries in Script Debugger 8’s dictionary viewer has been expanded. Please see this forum post for more details.
Script Debugger 8 has transited to using linefeeds for line breaks. Please see this forum post for more details.
You can place the cursor on a
use script statement and use the Open Dictionary (Comand-D) command to summon the dictionary associated with the script library.
Script Debugger 8 introduces several line-based editing commands, for those who don’t like to take their hands off the keyboard.
The Edit menu has a new submenu, Lines. This contains several line-based commands from previous versions: Shift Left, Shift Right, Comment, Uncomment, Entab, and Detab. There are also four new commands:
Move Up. This moves the line or lines containing the selection up one line, to before the line that precedes them. The formatting and selection within the moved lines is retained through the move.
Move Down. This moves the line or lines containing the selection down one line, to after the line that follows them. The formatting and selection within the moved lines is retained through the move.
Insert Line Before. This inserts a line before the line containing the selection, gives it a similar indent, and moves the cursor into it, ready for typing.
Insert Line After. This inserts a line after the line containing the selection, gives it a similar indent, and moves the cursor into it, ready for typing.
There are also four new commands in the Edit menu itself:
Cut Lines. This is similar to the Cut command, except it cuts the line or lines containing the selection, and not just the selected code itself.
Copy Lines. This is similar to the Copy command, except it copies the line or lines containing the selection, and not just the selected code itself.
Delete Lines. This is similar to the Delete command, except it deletes the line or lines containing the selection, and not just the selected code itself.
Duplicate Lines. This duplicates the line or lines containing the selection. The duplicated text is then selected.
All these commands support Undo, and you can assign them keyboard shortcuts by going to the Key Bindings panel in Preferences.
When pasting a command template from a dictionary, new pickers are provided for enumerations.
For example, BBEdit’s
change case command accepts a parameter named
making which is an enumeration. If you use Script Debugger to paste BBEdit’s
change case command into your script, you’ll see this picker for the
Script Debugger 8 allows you to create custom pickers within clippings.
Script Debugger’s Clippings facility works with plain text documents, using a simple tag mark-up scheme to implement various substitutions and the use of placeholders. Pickers are a special kind of placeholders: if you select them and type return or escape, a menu pops up, allowing you to pick a value to use.
Script Debugger has implemented various pickers: for applications, script libraries, frameworks, and a couple of other. Script Debugger 8 introduces user-defined or custom pickers, where you can set the contents of the menu your self.
At its simplest, a custom picker is defined using tags like this:
template signifies it’s a kind of placeholder,
custompicker defines the type, and then come the title and any entries, with all values separated by colons.
You can also create a picker where the menu items show one thing — perhaps an abbreviation or label — with different content to be inserted. You do this by alternating the labels and values, and ending the list with a final *, like this:
Using this form, you can insert separators into the menu by using empty label and value strings like this:
In this case a separator between the 1 and 2 entries.
You can also disable labels so they act as subheadings by setting their inserted value to *, like this:
In this case, the label 2 will be dimmed and disabled.
This alternating form can also support AppleScriptObjC enums and constants by appending **e or **c to the end of the relevant value to be inserted:
[[template:custompicker:Picker title:is an app:NSURLIsApplicationKey**c:is background:NSActivityBackground**e:*]]
This supports the usual property insertion if
Use Properties for Cocoa Terms is on, otherwise it prefixes the name with "current application’s “”.
Script Debugger 8 no longer offers external debugging. External debugging was a facility where scripts saved with debugging enabled, and invoked from other runtime environments (e.g. Folder Actions, etc.) would be debugged within Script Debugger. Security changes introduced in macOS Mojave and later rendered this feature inoperable so it has been removed.
A benefit of this change is that all documents saved with Script Debugger 8, regardless of their debugging state, are saved as standard AppleScript scripts. This makes all Script Debugger documents fully interoperable with any other application that reads AppleScript files.
Script Debugger 8 offers a new option for inserting «class furl» file references when files are dropped into the script editor. Additionally, the drop file dialog now presents the options as a list rather than radio buttons, enabling keyboard navigation.
Script Debugger 8 introduces additional control over how user defined clippings and scripts are displayed in their corresponding menus:
When using Paste Tell/Paste Code with script libraries, a use script statement will be inserted if it hasn’t been already.
A viewer for examining NSColor objects has been added to the debugger.
In previous versions of Script Debugger, Text Substitutions were stored in the user’s preferences for the application. Script Debugger 8 stores them in a separate file,
~/Library/Application Support/Script Debugger 8/Text Substitutions.plist, making it less fragile and simpler to transfer between Macs.
In previous versions of Script Debugger, the Resources Pane displayed the file hierarchy in a bundled script’s
/Contents/Resources directory. Script Debugger’s display has moved up the hierarchy, displaying the contents of the
/Contents directory. This simplifies things like adding frameworks to script applications…
Script Library pickers now check if the relevant
use statement declares a variable that refers to the library, and if not, only displays libraries that contain scripting dictionaries.
Autosaving is faster, and more reliable. It now also handles scripts with top-level AppleScriptObjC values.
AppleScriptObjC completion has been improved, and more frameworks are supported.
Script Debugger 8 includes several new and refined clippings.
Script Debugger 8 has removed modifiers that cause clippings and scripts menu items to to invoke alternate actions such as Edit or Reveal in Finder. This avoids conflicts with other modifiers assigned to scripts and clippings, and frees up more shortcut combinations.