I think I ran into some limitations of Script Debugger, but I’m not sure and want to verify. I’ve searched the forum, but didn’t find anything.
Issue one: I’ve added a script-block to my AppleScript program, and now I can’t debug anymore. When I press the “Run” button, it runs shortly, and then stops again. The status bar says “Stopped”. Not sure what happens…
I hope I missed something trivial, because grouping code in script-blocks seems like a good idea.
It’s something like this:
script my_subscript
property my_property: missing value
on my_handler()
set my_property to "something"
end my_handler
end script
on run
...
my_subscript's my_handler()
...
end
Issue two: some while ago, I told about my way how to debug script libraries. To do so, I replaced the use XXX: script "my-script" with property XXX: document "my-script.applescript".
This way of debugging script-libraries works great, except when the script-library itself contains properties. When I want to set a property of the script-library (document) I get the error (something like “can’t make a reference type of the property”, I’ve got Dutch localization).
One solution would be to use a handler to set this property, but I hope there would be another solution.
Re Issue One, I’m not seeing a problem when I try your code snippet here. When I step through the code I see the current line start a the my_subscript's my_handler() statement and then advance to the set my_property to "something" line and then finally exit the script. When the set my_property to "something" line executes, the debugger shows the value of my_property change form missing value to "something".
Re issue two: yes, for now, this is a limitation of Script Debugger’s scripting implementation. You’ll need to use handlers to access and mutate properties when you use this means of library debugging.
Thanks for looking into it. Yeah, I can’t seem to make it reproducable. The script-block script itself runs and debugs fine, the main script too, but when I put them into the same file, when pressing the run button in debug mode, Script Debugger runs for a seconds and just stops. No results. No events.
Console is reporting the following two lines repeatedly (15 times):
Ugg, this error indicates that AppleScript has experienced a serious internal failure. Script Debugger should not be failing silently and I’ll sort that out, but the underlying problem is that your script is simply too large.
Ah, good to know. I’ve had some headaches about refactoring the code. Today I decided to split the script into an old and new script. The old script (very long and tedious, difficult to refactor) will get used less and less…
Could this error be related to Scripting Debugger (but also Scripteditor) crashing when pressing the compile button?
Yes. When AppleScript generates a errOSAInternalTableOverflow error you must assume that memory has been corrupted and your editor (SD or SE) is about to crash. Its best to save your work as quickly as possible and quit and re-launch your editor.