You are previewing Beginning AppleScript®.
O'Reilly logo
Beginning AppleScript®

Book Description

What is this book about?

Geared toward programmers with no prior development knowledge, Beginning AppleScript serves as a comprehensive guide to using AppleScript on the Mac OS X platform. This title introduces the reader to AppleScript, and then illustrates how to efficiently start writing scripts through sample programs as each concept is introduced. Exercises at the end of each chapter allow the reader to test and demonstrate their knowledge on how to write functional scripts. The appendices include a list of other resources for additional developer information, and a summary of the language suitable for reference.

Table of Contents

  1. Copyright
  2. About the Author
  3. Credits
  4. Dedication
  5. Acknowledgments
  6. Introduction
  7. Writing Your First AppleScript Program
    1. Starting with Script Editor
    2. Compiling and Running Your Program
    3. Extending Your First Program
    4. An AppleScript Command to Display a Dialog
    5. Understanding the Buttons Parameter in the display dialog Command
    6. Multiple AppleScript Commands
    7. Adding Comments to Your Programs
    8. Summary
    9. Exercises
  8. Variables, Classes, and Expressions
    1. Working with Variables
    2. More on Commands and Statements
    3. Basic Data Type Classes
    4. Basic Data Type Conversions
    5. Arithmetic Operators and Expressions
    6. The Date Class
    7. Summary
    8. Exercises
  9. Making Decisions
    1. The if Statement
    2. AppleScript's Relational Operators
    3. The if-else Statement
    4. Nested if Statements
    5. The if-else if Statement
    6. Compound Relational Tests
    7. Creating Your First Application
    8. Catching Errors with the try Statement
    9. Summary
    10. Exercises
  10. Program Looping
    1. The repeat...times Statement
    2. The repeat with Statement
    3. The repeat while Statement
    4. Using Flags
    5. The repeat until statement
    6. The repeat with Statement for Lists
    7. Setting Up an Infinite Loop with repeat
    8. Summary
    9. Exercises
  11. Working with Strings
    1. Strings, Text, and Unicode Text
    2. Review of Concatenation
    3. Getting the Size of a String
    4. Using Special String Characters
    5. The considering and ignoring Statements
    6. Words, Characters, and Paragraphs
    7. Locating Strings inside Strings
    8. More on the Count Command
    9. Enhancing the Alarm Clock Program
    10. Summary
    11. Exercises
  12. Working with Lists and Records
    1. Working with Lists
    2. Working with Records
    3. Summary
    4. Exercises
  13. Working with Files
    1. Path Names: Traditional Mac and POSIX-style
    2. What's in a Name?
    3. The file Class
    4. File Name Aliases
    5. Reading and Writing Files
    6. Enumerating Disks and Folders
    7. Summary
    8. Exercises
  14. Handlers
    1. Writing a Handler
    2. Passing Parameters to Handlers
    3. Returning Handler Results
    4. Argument Types
    5. Local Variables
    6. Call by Value
    7. Recursive Handlers
    8. Local/Global Variables and Variable Scope
    9. Saving and Loading Handlers
    10. Labeled Parameters
    11. Specifying Patterns for Parameters
    12. Summary
    13. Exercises
  15. Error Handling
    1. Beeps and Dialogs
    2. The try...on error Statement
    3. The error Command
    4. Summary
    5. Exercises
  16. Working with Applications
    1. Talking to Other Applications: The tell Statement
    2. More on Working with the Finder
    3. More on Working with Applications
    4. Applets and Droplets
    5. Summary
    6. Exercises
  17. Scripting iLife Applications
    1. Scripting iTunes
    2. Scripting iPhoto
    3. Scripting iDVD
    4. Summary
    5. Exercises
  18. Script Objects
    1. Defining a Script Object
    2. Script Properties
    3. Your Program Is a Script Object
    4. Script Objects Containing Handlers
    5. Handlers Containing Script Objects
    6. Storing, Loading, and Running Scripts from Files
    7. Script Objects and Object-Oriented Programming
    8. Summary
    9. Exercises
  19. Loose Ends
    1. Command Handlers
    2. Using terms from
    3. Using the clipboard
    4. The Script Menu
    5. Folder Actions
    6. Open Scripting Architecture
    7. Scripting Additions
    8. AppleEvents
    9. Recording Scripts
    10. GUI Scripting
    11. Before and After
    12. Creating a Reference to an Object
    13. Web Services: XML-RPC and SOAP
    14. Running Scripts from Terminal
    15. The do shell script Command
    16. The with transaction Statement
    17. Delayed Evaluation with the run script Command
    18. Scheduling Scripts to Run with the cron
    19. Summary
    20. Exercises
  20. Introducing AppleScript Studio
    1. Installing AppleScript Studio
    2. Developing a Simple Application
    3. An iTunes Remote
    4. Summary
    5. Exercises
  21. Exercise Answers
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
  22. Language Reference
    1. Operators
    2. Built-in Classes
    3. Lists
    4. Records
    5. Strings
    6. Dates
    7. Compound Statements
    8. Commands
  23. Resources
    1. Errata, etc.
    2. AppleScript Books
    3. Websites
    4. Mailing Lists and Newsgroups
    5. Development Tools
  24. Index