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 11. AppleScript Subroutines > Reusing Subroutines

11.6. Reusing Subroutines

As you can see, creating subroutines is the smart way to go, but it does you no good to have multiple copies of subroutines scattered throughout all your scripts. If you needed to update a certain subroutine, you'd have to search for half a dozen (or more) copies of the same subroutine.

The smartest thing to do is to create libraries of subroutines and then load those libraries when you need them. For example, you could create a math library that contains your factorial() subroutine, save it as a compiled script, and then use the load script command to make whatever subroutines are in that library available to other scripts.


  

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