Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

load library script --«script» doesn't understand the xxx message

I've been through the various posts I could find on this without spotting a solution.


I have two scripts, like this, a dummy library, saved on the Desktop with the name "abc.scpt"


--test library script

on myhelp()


display dialog "help"

end myhelp


and a script in an AS Editor window:



--test calling script

property f : (path to desktop as text) & "abc.scpt"

property lib : load script alias f

lib's myhelp()




The script compiles, so I know it's seeing the library script, but when I try to run it, it returns with the message:


«script» doesn’t understand the myhelp message.


What am I missing folks? I get the same problem trying it in either AS or Script Debugger and I've tried writing the files from scratch in both (not cutting and pasting over). No matter, I can't seem to get a library handler to run in a calling script.


Anyone know how I can solve this?


TIA 🙂

Posted on Jul 6, 2013 1:06 AM

Reply
Question marked as Best reply

Posted on Jul 6, 2013 5:24 AM

Hello


It works as expected here under 10.6.5.

One thing to note is that properties in top level of a script are initialized at the time of compilation of the script. So if you edit the callee script after compiling the caller script, the changes in callee does not reflect in the callee script loaded as top level property in caller script.


Try this and see if it works.


set f to (path to desktop as text) & "abc.scpt"
set lib to load script alias f
lib's myhelp()


Regards,

H

5 replies
Question marked as Best reply

Jul 6, 2013 5:24 AM in response to Phil Stokes

Hello


It works as expected here under 10.6.5.

One thing to note is that properties in top level of a script are initialized at the time of compilation of the script. So if you edit the callee script after compiling the caller script, the changes in callee does not reflect in the callee script loaded as top level property in caller script.


Try this and see if it works.


set f to (path to desktop as text) & "abc.scpt"
set lib to load script alias f
lib's myhelp()


Regards,

H

Jul 6, 2013 9:53 AM in response to Phil Stokes

Hello


I don't understand why it happens. Seemingly the previous error message indicates abc.scpt does not have myhelp() handler defined, while the new error message indicates myhelp() handler is found in abc.scpt but it throws run-time error.


The error "Can’t make current application into type string." will be thrown if you use "display dialog" command without direct parameter. But why? Apparently you are saying:


display dialog "help"


aren't you?

Just in case, edit the abc.scpt as follows, save and run it in AppleScript Editor to see if it shows dialogue correctly.


on myhelp()
    display dialog "hello"
end myhelp

myhelp()


If it works as abc.scpt itself, then run the caller script to see if it works as loaded script.

Where does it fail in these tests?


This is all I can say for now.

H

load library script --«script» doesn't understand the xxx message

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.