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.

At its heart, the new process works by storing your export settings, so they do not have to be re-entered each time you export. So when you decide your script is ready to be deployed, you go to the Export Run Only submenu of the File menu and choose the required file format. Unless you choose the Custom… option, there is no more save panel with checkboxes and popup menus to deal with.

For even greater convenience, you can add the Export toolbar item to the document toolbar: it gives direct access to the same submenu commands.

The key to this process lies in two places: the Bundle & Export Settings dialog, and the new Building pane in Preferences.

Bundle & Export Settings combines some of the settings from the Script Debugger 7 Resources tab, plus some new ones — for example, you can set the name to be used for the exported file, allowing you to use more descriptive names for your editable files, and not have to modify names every time you export. You can read more about this new dialog in Script Debugger’s Help (Help -> Script Debugger Help).

The Building panel in Preferences is the place you control where files are exported to. Defining a consistent destination again removes the need to navigate through folders each time you export. But Direct Export goes a step further: when you export, the file is saved within a specially named folder, which is created for you if necessary. This makes it near impossible to accidentally overwrite your editable version, while also creating a record of what was exported when.

The Building pane gives you control over where the file and its enclosing folder are saved, and how the folder is named. By default, the new folder will be created in the same folder as the file you are exporting. Alternatively, you can choose to have all exported folders saved to a single repository folder. Choose which best suits your workflow.

The name of the folder is specified using a template, which uses placeholders similar to those used in clippings or in the Copyright Template in General preferences. The placeholders you can use in this template are:

  • [[filename]] This is replaced by the name of the file you are exporting from, minus any extension.
  • [[date]] This is replaced by a full date and time string, like this: “2020-11-29 14.45.32”
  • [[short-date]] This is replaced by a date-only string, like this: “2020-11-29”
  • [[GMT-date]] This is replaced by a full UTC/GMT date and time string, like this: “2020-11-29 14.45.32Z”
  • [[version]] This is replaced by the version as entered in the Build & Export settings, or “_” if none set.
  • [[build]] This is replaced by the Build # as entered in the Build & Export settings, or “_” if none set.

When you enter a template and hit return, a preview of the name appears below the field.

By including these values in the folder name, you can easily keep track of what changes you made, and when.

There are two other related checkboxes in the Building panel.

Include copy of source in export folder controls whether, when exporting, to also include a copy of the script source in the export folder as a .applescript file. The file is in the folder but not in the exported applet or bundle, and can be a useful way to document and track the contents of a script through each exported version.

Include SD Script Notes file in export folder controls a special file. Documenting changes to projects as you write them, or as requirements change, can be a haphazard business. Comments can only record so much, and they require access to the source. Script Debugger 8 introduces an optional new file, called SD Script Notes.rtfd`, which lives in a bundle or applet’s Resources folder. You can create it yourself, or use the contextual menu in the Contents section of the Resources tab.

The document typically serves as a place for you to document things so that they will not be accidentally separated from the code. You can use it as a Read Me file, or as something more technical, but it will not be included in any applet or bundle when you export a run-only version. However, when this option is checked, any such file in a project will also be copied — not in, but along-side the exported file.

Combined with the export folder naming template options above, this means you can end up with a record of which version you exported when, its source, plus documentation of the changes made.