Skip to content

Beginning AppleScript

Best in textbook rentals since 2012!

ISBN-10: 0764574000

ISBN-13: 9780764574009

Edition: 2005

Authors: Stephen G. Kochan

List price: $40.00
Blue ribbon 30 day, 100% satisfaction guarantee!
what's this?
Rush Rewards U
Members Receive:
Carrot Coin icon
XP icon
You have reached 400 XP and carrot coins. That is the daily max!

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.
Customers also bought

Book details

List price: $40.00
Copyright year: 2005
Publisher: John Wiley & Sons, Incorporated
Publication date: 12/17/2004
Binding: Paperback
Pages: 600
Size: 7.50" wide x 9.25" long x 1.50" tall
Weight: 1.914
Language: English

About the Author
Acknowledgments
Introduction
Who This Book Is For
How This Book Is Structured
What You Need to Use This Book
Conventions
Source Code
Errata
p2p.wrox.com
Writing Your First AppleScript Program
Starting with Script Editor
Compiling and Running Your Program
Extending Your First Program
Reporting Errors in Your Programs
An AppleScript Command to Display a Dialog
Understanding the Buttons Parameter in the display dialog Command
Changing the Labels on a Button
Adding an Icon to Your Dialog Box
Multiple AppleScript Commands
Adding Comments to Your Programs
Summary
Exercises
Variables, Classes, and Expressions
Working with Variables
Variable Names and the set Command
Accessing the Value of a Variable and the get Command
Writing Special Variable Names
The Special result Variable
More on Commands and Statements
Commands
Statements
The log Command and the Event Log
Basic Data Type Classes
The string Class
The Integer Class
Small and Double Integer Classes
The real Class
The Boolean Class
The class Command
Basic Data Type Conversions
Coercing a Data Type Using the as Operator
Arithmetic Operators and Expressions
The Date Class
Getting Date Properties
Setting Date Properties
Performing Arithmetic with Dates
Classes of Weights and Measures
Summary
Exercises
Making Decisions
The if Statement
A Single Line Form of the if Statement
AppleScript's Relational Operators
Numeric Tests
String Tests
Date Tests
Getting Data from the User
The if-else Statement
Nested if Statements
The if-else if Statement
Compound Relational Tests
Creating Your First Application
Catching Errors with the try Statement
Summary
Exercises
Program Looping
The repeat...times Statement
The repeat with Statement
Writing a Loop with an Increment
Your First Look at a Dictionary
The repeat while Statement
Using Flags
Another Look at the Triangular Number Program
A Final Look at the Triangular Number Program
A Quick Look at the Concatenation Operator
The repeat until statement
The repeat with Statement for Lists
Setting Up an Infinite Loop with repeat
Summary
Exercises
Working with Strings
Strings, Text, and Unicode Text
The Null String
Review of Concatenation
Getting the Size of a String
Using Special String Characters
Special Properties Used Outside Strings
Escape Characters Used inside Strings
More on Unicode Text
The considering and ignoring Statements
Combining Attributes
Words, Characters, and Paragraphs
Working with Elements
Understanding Text Item Delimiters
Locating Strings inside Strings
Specifying a Range to Get a Substring
More on the Count Command
Using length instead of count
A Quick Note on References
Enhancing the Alarm Clock Program
Summary
Exercises
Working with Lists and Records
Working with Lists
Empty Lists
Counting the Number of Items in a List
Accessing the Items in a List
The choose from list Command
Accessing Items by Class
Enumerating Lists: A Quick Review
The rest and reverse Properties
Modifying Lists
Using Containment Operators with Lists
Multiple Assignments with Lists
List Coercions
A Quick Note about Efficiency and Large Lists
Working with Records
Defining a Record
The result Record from the display dialog Command
Working with Lists of Records
Modifying Records
Retrieving Multiple Properties
Using the Containment Operators with Records
Summary
Exercises
Working with Files
Path Names: Traditional Mac and POSIX-style
Full Path Names
Relative Path Names
File Name Extensions
What's in a Name?
The file Class
File Name Aliases
Reading and Writing Files
The open for access Command
Writing Data with the write Command
Closing a File with the close Command
Getting Information about a File or Folder Using the info for Command
Reading Data with the read Command
More on Using the write Command
Truncating a File Using the set eof Command
Getting the Size of a File Using the get eof Command
Appending Data to the End of a File
Enumerating Disks and Folders
Using the choose file Command to Pick a File
Using the choose folder Command to Pick a Folder
Using the choose file name Command to Pick a File Name
Summary
Exercises
Handlers
Writing a Handler
Passing Parameters to Handlers
Returning Handler Results
Argument Types
Local Variables
Call by Value
Recursive Handlers
Local/Global Variables and Variable Scope
Saving and Loading Handlers
The Apostrophe-s notation
Labeled Parameters
Identifying Parameters with Prepositions
Combining Labeled Parameter Formats
Specifying a Direct Parameter
Using with and without for Boolean Parameters
Specifying Patterns for Parameters
Summary
Exercises
Error Handling
Beeps and Dialogs
The try...on error Statement
More on the on error Clause
Catching a Specific Error by Number
More on Error Numbers and Error-Handling Strategy
The error Command
Summary
Exercises
Working with Applications
Talking to Other Applications: The tell Statement
The One-Liner tell Statement
More on Targets
Using my, me, and its inside tell Blocks
Tell Me Some More
More on Working with the Finder
Looking at the Finder's Dictionary in Greater Detail
The Finder's Classes
Containers
Common File Operations
Common Folder Operations
More on Understanding Finder File References
Beware of the repeat-with Statement!
AppleScript versus the Finder's File Class
Filters
More on Working with Applications
Ignoring Application Responses
Application Timeouts
Applets and Droplets
Stay Open Applications
The run Handler
The quit Handler
The reopen Handler
The idle Handler
Droplets
Summary
Exercises
Scripting iLife Applications
Scripting iTunes
Working with Tracks and Playlists
An iTunes Player Applet
Scripting iPhoto
Scripting iDVD
Summary
Exercises
Script Objects
Defining a Script Object
Script Properties
Initializing Script Properties
Copying Script Objects
Your Program Is a Script Object
Scope of Properties
pi Is a Property
Script Objects Containing Handlers
The Run Handler
Handlers Containing Script Objects
Storing, Loading, and Running Scripts from Files
Script Objects and Object-Oriented Programming
Polymorphism
Inheritance
Using its in Inherited Handlers
The continue Command
Summary
Exercises
Loose Ends
Command Handlers
Using terms from
Using the clipboard
The Script Menu
Folder Actions
Open Scripting Architecture
Scripting Additions
AppleEvents
Recording Scripts
GUI Scripting
Before and After
Creating a Reference to an Object
Web Services: XML-RPC and SOAP
Running Scripts from Terminal
The do shell script Command
The with transaction Statement
Delayed Evaluation with the run script Command
Scheduling Scripts to Run with the cron
Summary
Exercises
Introducing AppleScript Studio
Installing AppleScript Studio
Developing a Simple Application
An iTunes Remote
Summary
Exercises
Exercise Answers
Language Reference
Operators
English Equivalents of Relational Operators
Containment Operators
Built-in Classes
Classes of Weights and Measures
Lists
List Class Properties
Element Specifiers
Records
Record Class Properties
Strings
String Class Properties
Predefined String Properties
Escape Characters
String Elements
Dates
Date Class Properties
Predefined Properties for Working with Dates
Compound Statements
considering
if
ignoring
repeat
tell
try
using terms from
with timeout
with transaction
Commands
activate
adding folder items to
ASCII character
ASCII number
choose application
choose color
choose file
choose file name
choose folder
choose from list
choose URL
clipboard info
close access
closing folder window for
continue
copy
count
current date
delay
display dialog
do shell script
error
exit repeat
get
get eof
get volume settings
handle CGI request
info for
launch
list disks
list folder
load script
log
mount volume
moving folder window for
offset
open for access
open location
opening folder
path to
random number
read
removing folder items from
return
round
run script
say
scripting components
set
set eof
set the clipboard to
set volume
start log
stop log
store script
summarize
system attribute
the clipboard
time to GMT
write
Resources
Errata, etc.
AppleScript Books
Websites
Mailing Lists and Newsgroups
Development Tools
AppleScript Studio
Script Editor
Smile
Script Debugger 3.0
Index