Hi
I want to automate script code in script code. I use tho following code
set myScript to load script “HD:path:to:file.scpt”
set scriptResult to myScript’s handlerName()
an get the following error:
«script» doesn’t understand the handlerName message.
What’s wrong? Any tip or hint is welcome.
Thanks and regards
Lazy
StefanK
November 16, 2012, 4:26pm
#2
Hi,
load script expects an alias or file reference
set myScript to load script alias "HD:path:to:file.scpt"
set myScript to load script alias “eANW:SUBs:SUBzeroPAD.scpt”
set scriptResult to myScript’s handlerName()
same result
«script» doesn’t understand the handlerName message.
anyone?
Lazy
McUsr
November 16, 2012, 6:48pm
#4
Well, if there is a script object within that file.
Named myscript for instance, then you’d have to do like this:
set myScript to myscript of (load script alias "eANW:SUBs:SUBzeroPAD.scpt")
You might want to check out this thread too…
http://macscripter.net/viewtopic.php?id=39759
juergen
November 17, 2012, 8:15am
#6
Remove the parenthesis in
set scriptResult to myScript’s handlerName()
Using “handlerName()” trys to call the handler. For just assigning it to a variable, use the name “handlerName” only.
I just tried the variant
set x to load script alias "Path:to:test.scpt"
set y to x's noise
y()
(“noise()” just beeps. Hence the name ;-))
Works with no problem.
Jürgen
The message means there’s no handler called ‘handlerName()’ in the loaded script.
Things to check:
¢ Does the handler exist in the loaded script?
¢ Does it exist, but in a contained script object (as McUsr’s theorised)?
¢ Is there anything in the code of either the loaded script or the running script which changes the value of the loaded script’s ‘handlerName’ variable?