Script Library help Script doesn’t seem to belong to AppleScript. -1752


(Doug) #1

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 ~/Library/Script Libraries
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:
2018-11-13_11-09-34

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


(Ed Stockly) #2

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.


(Doug) #3

Thanks for the reply.
I just tried what you posted and am getting the following:

2018-11-13_13-21-17

I must need something else?


(Ed Stockly) #4

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:

https://www.macosxautomation.com/applescript/apps/Script_Libs.html

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.


(Doug) #5

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.

2018-11-14_10-22-43

What I have done so far is to get it kinda working:

  1. I renamed the handler to “stacksPlistHandlerOld”
  2. I created a new file with the original script name stacksPlistHandler in the builtin script editor
  3. I selected the content and pasted into the new file and compiled and saved.
  4. 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.


(Ed Stockly) #6

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


(Doug) #7

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


(Jean Christophe Helary) #8

You can remove that icon by just hitting Shift+Cmd+D and recompiling the script.