In my applescript work I’ve intentionally developed handlers that I use over and over. Once debugged, then these are saved in a Library.
Is there a way to extend Script Debugger so that it gives debugging information about Applescripts handles in the Script Libraries? Currently it reports any error message from the Script Library correctly, but the error seems to be attached to some random line in the main script.
Here is my Structure
General Utility handlers are saved in ~/Library/Scripts/Utilities.scptd, and a set of logging handlers are stored in ~/Library/Scripts/Loqqing.scptd.
Not surprisingly, the Logging handlers use some of the utility handlers
The main script starts with
use AppleScript version “2.5”
use scripting additions
use U : script “Utilities”
use L : script “Loqqing”
property M : missing value
set M to me
set L’s M to me
if false then true – change this to force a recompile
The Logging script starts with
use AppleScript version “2.5”
use scripting additions
use U : script “Utilities”
property M : missing value
if false then true – change this to force a recompile
The Utility Script starts with
use AppleScript version “2.5”
use scripting additions
Script that refers to a a library handler looks like this:
set thisResult to U’s removeLeadingTrailingBlanks(someString)
All of this works fairly well with 4 Script Libraries (Utility, Logging, GUI, CaptureOne) except that for debugging any error, I have to:
- Copy the Library scripts to the main script
- Sometimes: Copy every Library that refers to the problem Library to the main script
- Replace the Use statements in the main script with a reference to Me
- fix the problem
- Open the library script in Script Editor
- Copy the AppleScript to the Script Editor window, compile and save
- Recompile every other Script Library that uses this Script Library
- Remove the Library script from the main Script in Script Debugger
- Enable the Use Statements in the Main Script
It would sure save a lot of work to be able to see debug information about the Library handlers from Script Debugger.
I find that if I save a script file with Script Debugger, and then execute that script from another parent like Capture One, then it sometimes crashes if Script Debugger is not running.
So everything, once debugged, has to be copied to Script Editor and saved from there.