Reputation: 572
I write a lot of AppleScripts and I organized my codes by using library scripts. Is there a simple way to define a common handler that I can invoke from my scripts?
For example, I create a library with a handler:
Script Libraries/logger.scpt
to info(message)
log(message)
end info
Then on my client scripts, I would do:
set logger to script "logger"
logger's info("Hello world")
Is it possible, how do I make it so that I can simply write the invocation as:
info("Greetings")
I want to omit the target and just call the handler directly from the client scripts.
Upvotes: 0
Views: 78
Reputation: 823
You will need to implement an AppleScript Library with Terminology - i.e. add a dictionary to the library script.
There's a ton of information on this site http://macosxautomation.com and specifically on this and subsequent pages https://macosxautomation.com/mavericks/libraries/terminology.html
Upvotes: 1