[quote="ccstone, post:9, topic:3788"]
“use” is similar to an “include” statement in other programming languages.
[/quote]
2016-05-19 16:49 CT (Thu)
(fix the memory lapse in the scripts pointed out by Chris)
Chris,
Thanks for laying that out.
Please correct me if I'm wrong, but my understanding is:
(1) All of the use framework statements, and the use scripting additions statement, do NOT require any further qualification when you call handlers/functions in any of those.
- IOW, you can use the terms directly
- IF you had the satimage.osax in your Scripting Additions folder, then you could simply state:
set myVar to change "x" into "y" in "some string with x in it"
where "change" is a handler/function in satimage.osax
(2) Whereas, when using script libraries, you must provide a qualifier, the reference you have given to the library, OR, use the script library name directly in a "tell" statement: (added per Chris)
use myLib : script "My Personal Script Library" ### Must be in Script Libraries folder (fixed)
--- To call any of the handlers/functions, you MUST qualify it with the reference "myLib"
set myVar to changeStr("x", "y", "some string with x in it") of myLib
--- OR you can use this form:
set myVar to myLib's changeStr("x", "y", "some string with x in it")
--- OR use the script lib script name directly in a "tell" statement, as pointed out by Chris:
tell script "My Personal Script Library" ### Must be in Script Libraries folder
set myVar to changeStr("x", "y", "some string with x in it")
end tell
The key difference here being the use of "myLib"
To All Interested in Using Script Libraries:
Once you have used Script Libraries a few times, it will become easy and straight-forward. Unfortunately, all the the Apple AppleScript documentation either hides or obscures this information.