Script Debugger 8.0: Release Notes

Icon-MacOS-256x256@1x

Script Debugger 8 has been released and the beta testing period has ended as of May 3, 2021.

DOWNLOAD

PURCHASE

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.

26th Anniversary Edition

The release of Script Debugger 8 marks Script Debugger’s 26th anniversary as a continuously developed indie Mac application.

Requirements

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.

Release Notes

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:

Apple Silicon

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.

Big Sur Appearance

Script Debugger 8 adopts the Big Sur appearance when running on Big Sur systems.

Script:

Dictionary:

Alerts:

Toolbars

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.

Script Timer

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.

Tabbed Windows

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.

Tabbed Windows:

Show All Tabs:

Windows Menu:

Dark Mode

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.

Themes

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.

Sparkle Settings

Script Debugger 8 allows you to configure your Sparkle app cast settings when generating enhanced script applications.

Preferences

The Script Debugger 8 preferences panel has been redesigned to facilitate searching for preferences settings.

Building Preferences Panel

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.scpt and 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.

Scripting

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.

The 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, 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.

The 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.

The 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 as parameter.

Notarizing

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.

Bundle & Export Settings

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:

Direct Export

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.

Persistent Globals Removed

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.

View Libraries and SDEFs in Dictionary Window

Support for viewing Script Libraries in Script Debugger 8’s dictionary viewer has been expanded. Please see this forum post for more details.

Line-Break Changes

Script Debugger 8 has transited to using linefeeds for line breaks. Please see this forum post for more details.

Open Used Dictionary

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.

Line Commands

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.

Enumeration Pickers

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 making parameter:

Custom Pickers

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:custompicker:Picker title:Value1:Value2:...]]

The word 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:

[[template:custompicker:Picker title:1:One:2:Two...:*]]

Using this form, you can insert separators into the menu by using empty label and value strings like this:

[[template:custompicker:Picker title:1:One:::2:Two...:*]]

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:

[[template:custompicker:Picker title:1:One:2:*:3:Three...:*]]

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 “”.

External Debugging Removed

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.

Create «class furl» File References

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.

New Controls for User Clipping and Script Presentation

Script Debugger 8 introduces additional control over how user defined clippings and scripts are displayed in their corresponding menus:

Add library use statement when pasting code

When using Paste Tell/Paste Code with script libraries, a use script statement will be inserted if it hasn’t been already.

NSColor Viewer

A viewer for examining NSColor objects has been added to the debugger.

Text Substitutions Storage Changed

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.

Resources List Now Contents

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…

Smarter Library Picker

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.

Auto-saving Improved

Autosaving is faster, and more reliable. It now also handles scripts with top-level AppleScriptObjC values.

Code-completion Refinements

AppleScriptObjC completion has been improved, and more frameworks are supported.

Clippings Changes

Script Debugger 8 includes several new and refined clippings.

Clippings, Scripts Menu Access

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.

1 Like

Mark @alldritt, looks like a lot of great changes. I hope to get started testing on Mojave (latest ver I have) next week.

1 Like