I recently upgraded from version 5 of script debugger to 7. I used a number of the old debugger 5 libraries for common handlers I wrote. All worked fine, the conversions to version 7 have all worked so far(haven’t converted everything yet.
I’m trying to get a handle on how the USE and Property statements work
example of converted statments:
use libtableSortInPlace : script "tableSortInPlace"
property tableSortInPlace : libtableSortInPlace's tableSortInPlace
I was following the “converted” handlers format and trying to create a new handler.
I placed new the handler in the script library
I set up new use and property statements:
use libstacksPlistHandler : script "stacksPlistHandler"
property doPlist : libstacksPlistHandler's doPlist
When I compile in script debugger I get a compile error:
I’m not great at AppleScript, and have a hard time getting through Apple’s documents. Most of what I learned was through the AppleScript 1-2-3 book(Sal Soghoian and Bill Cheeseman) and another book called Learn AppleScript (Hamish Sanderson). These books are dated and don’t cover any of this new stuff.
Any help would be apricated
Here is the format for using libraries
use script "BridgePlus" version "1.3.2"
use script "stacksPlistHandler"
use scripting additions
AppleScript will look for a script named: “stacksPlistHandler” in the various script libraries folder. The handlers in that script will be available from your script.
Thanks for the reply.
I just tried what you posted and am getting the following:
I must need something else?
The bridgePlus scripting library. I was just using that as an example.
You can get that and other very useful libraries you can install here:
In the meantime just remove the first line of that script, make sure your stacksPlistHandler script is in one of the designated script libraries and try again.
Thanks Ed, for the help.
I think there was something different about the library file I created with the script debugger. I think I have it figured out, a least for now. Not sure yet, but I noticed in finder the handler file I created had a different icon, with a little “debugger bug” on it, and was much larger than the other handlers of similar size(the ones converted from ver. 5 library). I haven’t a clue as to what that Icon means.
What I have done so far is to get it kinda working:
- I renamed the handler to “stacksPlistHandlerOld”
- I created a new file with the original script name stacksPlistHandler in the builtin script editor
- I selected the content and pasted into the new file and compiled and saved.
- It appears to now use the script OK
I’m having other issues; I think they are not related. Will need to figure out debugging with libraries. If you have any insight into the icon/file size problem above I would love to hear it. Just don’t know what I did to create that and why the file didn’t work.
Thanks again for the help. Will have a look at the link above, looks like a good resource.
When the icon has the bug image, that means the script has been saved in debugging mode. If you run a script or applet saved that way it will open in script debugger and start executing in debugging mode, which is a cool feature. I don’t think scripts save that way work in Script Libraries.
I’m not sure how fussy the system is for script files. Most of mine have the “.scptd” extension(Compiled Script bundle); some have the “.scpt” extension (Compiled Script)
This is explained in detail in SD help here:
Script Debugger Help > Opening and Saving Scripts > Save > Formats > Copiled Script
Thanks that explains the bug image. I think that doesn’t work as a library item. Probably why I got the -1752 error “Script doesn’t seem to belong to AppleScript”. Thanks for pointing out the help feature.
You can remove that icon by just hitting Shift+Cmd+D and recompiling the script.
I got the same error message when a library script file referenced by the main script was saved in debugging mode. I turned off debugging mode in the library script, resaved it and was then able to work without that error. It seems to me that a better error message could be generated but I don’t think Apple is doing anything new with Applescript, at this point.