Basics of AppleScript

Call Methods In Tell

Script [14.7.1]:

on completion()
    display dialog "Success"
end completion
tell application "Finder"
    empty trash
    completion()
end tell

Explanation: Here I have created a handler named completion(). But when I call it in the tell block, I get error.

Figure 14.7.1

Figure 14.7.1 Error on Calling Handler in Tell

To solve this issue use command of me after calling handler

on completion()
    display dialog "Success"
end completion
tell application "Finder"
    empty trash
    completion() of me
end tell

Figure 14.7.1-2

Figure 14.7.1-2 Success on Calling Handler In Tell

This issue of calling handler in tell blocks is not applicable to variables