AppleScript Hart Davis Beginners Guide
User Manual:
Open the PDF directly: View PDF
Page Count: 449 [warning: Documents this large are best viewed by clicking the View PDF Link!]
- Contents
- Acknowledgement
- Introduction
- Part I: Getting Started with AppleScript
- 1 Grasping the Essentials of AppleScript
- 2 Up to Speed with AppleScript Editor
- 3 Creating Your First Script
- Opening AppleScript Editor
- Creating tell Statements
- Try This: Opening a Finder Window Showing the Documents Folder
- Saving a Script
- Try This: Saving Your Script
- Creating tell Blocks
- Try This: Using a tell Block
- Adding Comments to Your Code
- Try This: Commenting Out a Line
- Try This: Creating a Comment Block
- Recording Actions into a Script
- Try This: Recording Actions: Repositioning and Resizing the Finder Window
- Examining the Recorded Code
- Try This: Editing the Script
- Dealing with Errors
- Try This: Resolving an Error in Your Code
- Wrapping a Line of Code
- Try This: Breaking Lines of Code Manually
- Opening a Dictionary File
- Try This: Opening the Dictionary File for TextEdit
- Finding the Terms You Need
- Try This: Using the Dictionary File
- Turning a Script into an Application
- Try This: Making an Application from Your Script and Adding It to the Dock
- Part II: Learning Essential AppleScript Programming Techniques
- 4 Working with Variables, Classes, Operators, and Coercions
- 5 Working with Text, Numbers, and Dates
- 6 Working with the Finder, Files, and Folders
- Working with Finder Windows
- Try This: Using Special Folders
- Try This: Using Nested References, Path References, and Alias References
- Try This: Opening, Configuring, and Closing Finder Windows
- Working with Folders
- Try This: Creating, Renaming, and Moving a Folder
- Working with Files
- Renaming a File
- Try This: Creating a File and Opening It
- Mounting and Unmounting Volumes
- 7 Making Decisions in Your Scripts
- Checking a Single Condition with an if… then Statement
- Try This: Using an if… then Statement to Launch an Application If It’s Not Running
- Deciding Between Two Courses of Action with an if… then… else Statement
- Try This: Using an if… then… else Statement
- Choose Among Multiple Courses of Action with an if… then… else if… else Statement
- Try This: Using an if… then… else if… else Statement
- 8 Using Dialog Boxes to Get User Input
- Using Dialog Boxes
- Try This: Adding a Custom Dialog Box to the Set Up Finder and TextEdit Script
- Try This: Returning Text from a Text-Entry Field
- Using Alerts
- Try This: Creating an Alert
- Choosing the Name Under Which to Save a File
- Letting the User Choose from a List of Items
- Try This: Creating a Choose From List Dialog Box
- Letting the User Choose Files, Folders, Applications, and URLs
- Try This: Letting the User Choose a File
- Try This: Using the Choose Application Dialog Box to Open a Document in a Particular Application
- 9 Repeating Actions in Your Scripts
- Getting an Overview of the Types of Loops That AppleScript Provides
- Understanding What Hard-Coding Is and When to Use It
- Repeating Actions Until a Termination Condition Becomes True
- Try This: Using a repeat Loop to Close All Open Finder Windows Except One
- Repeating Actions a Set Number of Times
- Try This: Using a repeat… times Loop Controlled by a Dialog Box
- Repeating Actions Using a Loop Controlled by a Loop Variable
- Try This: Using a Loop Controlled by a Loop Variable
- Repeating Actions for Each Item in a List
- Try This: Using a repeat with list Command to Close Some Finder Windows
- Repeating Actions as Long as a Condition Remains True
- Try This: Using a repeat while Loop
- Repeating Actions Until a Condition Becomes True
- Try This: Using a repeat until Loop
- 10 Debugging and Handling Errors
- Understanding What Happens When an Error Occurs
- Try This: Causing Errors Deliberately
- Suppressing an Error with a Try Block
- Try This: Adding a Try Block to a Script
- Creating an Error Handler
- Try This: Building an Error Handler
- Finding Out Which Errors You Need
- Making Your Scripts Resistant to Errors
- Try This: Creating a Subroutine
- 11 Running Scripts Automatically
- Running a Script Automatically Using a Droplet
- Try This: Creating and Running a Droplet
- Running a Script Automatically with a Folder Action
- Try This: Creating and Using a Folder Action Script
- Running a Script at Login
- Running a Script Repeatedly at Intervals
- Try This: Creating an Application That Uses an Idle Handler
- Running a Script Automatically at Specific Times
- Part III: Automating Major Applications with AppleScript
- 12 Automating iTunes and iPhoto
- 13 Automating Apple Mail
- 14 Automating Microsoft Word
- Launching Word—and Quitting Word
- Understanding the Key Word Objects for AppleScript
- Working with Documents
- Try This: Creating, Saving, and Closing a Document
- Working with Windows and Views
- Working with Text
- Try This: Entering and Formatting Text in a Document
- Using Sections, Page Setup, and Headers and Footers
- Displaying Word’s Built-in Dialog Boxes
- Try This: Adding a Header, Adjusting Margins, and Displaying a Dialog Box
- Running Your Scripts from Word
- 15 Automating Microsoft Excel
- Understanding Excel’s Main Objects
- Launching and Quitting Excel
- Working with Workbooks
- Protecting a Workbook Against Changes
- Try This: Creating, Saving, and Closing a Workbook
- Working with Worksheets and Other Sheets
- Try This: Opening a Workbook and Adding a Worksheet to It
- Creating and Using Ranges of Cells
- Try This: Adding Data to a Workbook
- Using Charts in Your Workbooks
- Try This: Creating a Chart
- Using Find and Replace in Your Scripts
- 16 Automating Microsoft Entourage
- Index