Slayer0248
Slayer0248

Reputation: 1261

Applescript functions

Is there a difference between the on and to keywords when declaring functions in applescript? Seems like they're interchangeable from what I've seen. Is that the case or would one be more useful than the other in some situations?

Upvotes: 1

Views: 2308

Answers (1)

Lri
Lri

Reputation: 27613

on and to are equivalent. See https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_handlers.html:

( on | to ) handlerName ¬
   [ [ of | in ] directParamName ] ¬
   [ ASLabel userParamName ]... ¬
   [ given userLabel:userParamName [, userLabel:userParamName ]...]
      [ statement ]...
end [ handlerName ]

Upvotes: 1

Related Questions