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 6. Scripting the iPhone Configur... > Learning AppleScript Basics

Learning AppleScript Basics

The AppleScript Language

AppleScript is a vaguely English-like programming/scripting language that allows you to manipulate applications to do things much faster than you could do them manually, and in exactly the same every time. I say “vaguely English-like,” because while AppleScript is almost English, it tends to not be English in amusing ways. For example, to display the URL of the current tab in Safari, AppleScript says:

tell application "Safari"
    set theURL to URL of current tab of window 1
end tell

That’s somewhat in English, but it’s probably not how you’d ask another human being for that information. So it’s “vaguely” English-like. AppleScript is also a dynamic language. Because it manipulates applications, it relies on each application to implement AppleScript within itself. As each application does different things—and there are no hard rules to much of AppleScript—you get some interesting differences. For example, to do the exact same thing in Google Chrome that we did in Safari, the AppleScript is:


  

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