Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 18. Organizing Your Code with Ha... > Using the run Handler in Scripts

18.7. Using the run Handler in Scripts

The run handler contains all the statements that will be executed when you run the script. A script can have only one run handler at most, but some scripts may have no run handler at all.

18.7.1. I've Never Seen No run Handler!

You may be wondering why you already wrote a bunch of scripts, but none of them has anything that looks like a run handler. This is because the run handler doesn't have to be explicitly defined. If a script doesn't contain an explicit run handler, then AppleScript assumes the script has an implicit run handler instead. An implicit run handler consists of all the statements found at the top level of the script, except for any property declarations, named script object definitions, and other handler definitions.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint