Basics of AppleScript

Defining A Handler

Script [14.1.1]:

on method1()
    display dialog "This handler was executed"
end method1

Explanation: Just like in try block when we say on error, we are actually declaring a handler which will get executed when error occurs. Similarly to declare a handler we type on handlerName(). To end the handler we type end handlerName.