O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

AppleScript® Programming for the Absolute Beginner

Book Description

AppleScript is a high-level scripting language that comes free on the Mac platform. This handy scripting language adds functionality to the Mac operating system by automating tasks and adding functions to your Mac. If you are new to programming with AppleScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. AppleScript Programming for the Absolute Beginner provides you with the programming skills that you need and shows you how to put these skills to use in real-world scenarios. Best of all, by the time you finish the book, you will be able to apply the basic principles you've learned to the next programming language you tackle.

Table of Contents

  1. Copyright
  2. Acknowledgments
  3. About the Author
  4. Introduction
  5. Introducing AppleScript Scripting
    1. AppleScript Basics
      1. Project Preview: The AppleScript Humor Game
      2. Introducing AppleScript
      3. Common Tasks Performed by AppleScripts
      4. Operating System Integration
      5. A Quick Introduction to the Script Editor
      6. Understanding AppleScript Syntax
      7. Back to the AppleScript Humor Game
      8. Summary
    2. Getting Comfortable with the AppleScript Script Editor
      1. Project Preview: The AppleScript Story Teller Game
      2. Introducing the Script Editor
      3. Configuring Script Editor Preferences
      4. Configuring the Script Editor Toolbar
      5. Using Advanced Script Editor Features
      6. Researching Application Dictionaries
      7. Alternate Script Editors
      8. Back to the AppleScript Story Teller Game
      9. Summary
  6. Learning How to Write AppleScripts
    1. Working With Values, Variables, and Classes
      1. Project Preview: The AppleScript Fortune Teller Game
      2. Communicating with the User
      3. AppleScript Commands and Statements
      4. Keeping Track of Data
      5. AppleScript’s Rules for Naming Variables
      6. Understanding AppleScript Variable Classes
      7. Data Coercion
      8. Taking Advantage of Constants
      9. Back to the AppleScript Fortune Teller Game
      10. Summary
    2. Implementing Conditional Logic and Working with Loops
      1. Project Preview: The AppleScript Typing Test Game
      2. Fundamentals of Conditional Logic
      3. Performing Different Comparison Operations
      4. Analyzing Mathematical Expressions
      5. Using Compound Operators to Build Complex Conditional Logic
      6. Using Loops to Perform Repetitive Actions
      7. Back to the AppleScript Typing Test Game
      8. Summary
    3. Using Strings, Lists, and Records
      1. Project Preview: The Godfather Trivia Quiz
      2. Working with Strings
      3. Storing and Retrieving Data Using Lists
      4. Storing Data in Records
      5. Searching String, Lists, and Records
      6. Back to the Godfather Trivia Quiz
      7. Summary
    4. Improving Script Organization with Handlers
      1. Project Preview: The AppleScript Shell Game
      2. Leveraging the Power and Convenience of Handlers
      3. Using Event Handlers to Initiate Action
      4. Understanding a Handler’s Effect on Variable Scope
      5. Back to the AppleScript Shell Game
      6. Summary
  7. Advanced Topics
    1. Accessing Files and Folders
      1. Project Preview: The AppleScript Lottery Picker Game
      2. Working with the Mac OS X File System
      3. Working with Full and Relative Paths
      4. Retrieving File and Folder Information
      5. Working with the File Class
      6. Writing AppleScripts That Interact with Text Files
      7. Printing Text Files
      8. Back to the AppleScript Shell Game
      9. Summary
    2. Automating Mac OS X Applications
      1. Project Preview: The AppleScript Number Guessing Game
      2. Bossing Around Your Mac OS X Applications
      3. Taking Advantage of AppleScripts to Which You Already Have Access
      4. Figuring Out How to Communicate with Mac OS X Applications
      5. Automating Mac OS X Applications
      6. Back to the AppleScript Number Guessing Game
      7. Summary
    3. Debugging Your AppleScripts
      1. Project Preview: The Rock, Paper, Scissors Game
      2. Examining the Three Basic Types of Errors
      3. Dealing with Errors
      4. Building Error Handlers
      5. Monitoring AppleScript Execution
      6. Back to the Rock, Paper, Scissors Game
      7. Summary
    4. Introducing AppleScript Studio
      1. Project Preview: The Tic-Tac-Toe Game
      2. Introducing AppleScript Studio
      3. Project Organization
      4. Getting Comfortable with the Xcode Project Window
      5. Other Key AppleScript Studio Components
      6. Creating Graphical User Interfaces Using Interface Builder
      7. Back to the Tic-Tac-Toe Game
      8. Summary
  8. What’s on the Companion Website?
  9. What Next?
    1. Recommended Reading
    2. Locating AppleScript Studio Resources Online
    3. AppleScript Mailing Lists
  10. Glossary