AppleScript in a Nutshell is the first complete
reference to
AppleScript, the popular programming language
that gives both power users and sophisticated enterprise
customers the important ability to automate repetitive
tasks and customize applications. As the Macintosh
continues to expand and solidify its base in the multimedia
and publishing industries, AppleScript is the tool of
choice on this platform for creating sophisticated time-
and money-saving workflow applications (applets). These
applets automate the processing and management of digital
video, imaging, print, and web-based material. AppleScript
is also gaining a foothold in scientific programming, as
technical organizations adopt G4 CPU-based systems for
advanced computing and scientific analysis. Finally, "power
users" and script novices will find that AppleScript is a
great everyday Mac programming tool, similar to
Perl on
Windows NT or
Unix.
In this well-organized and concise reference,
AppleScript programmers will find:
- Detailed coverage of AppleScript Version 1.4 and beyond
on Mac OS 9 and Mac OS X.
- Complete descriptions of AppleScript language features,
such as data types, flow-control statements, functions,
object-oriented features (script objects and libraries),
and other syntactical elements.
- Descriptions and hundreds of code samples on
programming the various "scriptable" system components,
such as the Finder, File Sharing, File Exchange, Network
scripting, Web scripting, Apple System Profiler, the
ColorSync program, and the numerous powerful language
extensions called "osax" or scripting additions.
Most other AppleScript books are hopelessly out of
date.AppleScript in a Nutshell covers the latest
updates and improvements with practical, easy to understand
tips, including:
- Using AppleScript as a tool for distributed computing,
an exciting development that Apple Computer calls "program
linking over IP." Programmers can now do distributed
computing with Macs over TCP/IP networks, including
controlling remote applications with AppleScript and
calling AppleScript methods on code libraries that are
located on other machines.
- Using the Sherlock find application to automate web and
network searching.
- Insights on scripting new Apple technologies such as
Apple Data Detectors, Folder Actions, Keychain Access, and
Apple Verifier.
AppleScript in a Nutshell is a high-end handbook
at a low-end price—an essential desktop reference
that puts the full power of this user-friendly programming
language into every AppleScript user's hands.
Contents
Preface
Part I. Introduction to
AppleScript
Chapter 1. AppleScript: An Introduction
How Is AppleScript Used?
Apple Events
Using Script Runner with OS X
Using OSA Menu with OS 9
Checking Your AppleScript Version
Diving In
Chapter 2. Using Script Editor with OS 9 and OS
X
Script Editor Controls/Commands
Scripting the Script Editor
Part II. AppleScript
Language Reference
Chapter 3. Data Types
alias
boolean
class
constant
data
date
file specification
integer
international text
list
number
real
record
reference
RGB color
string
Styled Clipboard Text
Styled Text
text
Unicode Text
Unit of Measurement Classes
Unit of Measurement Classes
Chapter 4. Operators
&
( )
*
+
-
/ div
<
£ <=
=
>
>=
^
[a] reference to
and
as
begin[s] with
contains
does not contain
does not equal
ends with
is contained by
is not contained by
mod
not
or
Chapter 5. Reference Forms
after
back
before
beginning
first, second, third, fourth, etc.
every
every - from - to -
id
last
middle
name
some
whose
Chapter 6. Variables and Constants
Variables
Constants and Predefined Variables
all caps
all lowercase
anything
application responses
ask
bold
case
condensed
current application
date and time constants
diacriticals
expanded
expansion
false
hidden
hyphens
it
italic
me
missing value
my
no
outline
pi
plain
punctuation
result
return
shadow
small caps
space
strikethrough
subscript
superscript
tab
true
underline
version
white space
yes
Chapter 7. Flow-Control Statements
considering [but ignoring] end [considering]
continue
error
exit [repeat]
if simple statement
if [then] [else if] [else] end [if]
ignoring [but considering] end [ignoring]
repeat end [repeat]
repeat until end [repeat]
repeat while end [repeat]
repeat with {loop variable} from {integer} to {integer}[by
stepVal] end [repeat]
repeat with {loop variable} in {list} end [repeat]
repeat {integer} times end [repeat]
return [return value]
tell simple statement
tell end [tell]
try [on error] [number | from | partial result | to]
end[error | try]
using terms from end [using terms from]
with timeout [of] {integer} second[s] end [timeout]
with transaction [session object] end [transaction]
Chapter 8. Subroutines
Subroutines with Positional Parameters
Subroutines with Labeled Parameters
idle handler
open handler
reopen handler
quit handler
run handler
Chapter 9. Script Objects and Libraries
Script Objects
Libraries
Part III. Scripting Mac
OS 9 Applications
Chapter 10. Apple Guide and Help Viewer
Apple Guide
Help Viewer
Chapter 11. Apple System Profiler
Apple System Profiler
Chapter 12. Keychain Scripting and Apple
Verifier
Keychain Scripting
Apple Verifier
Chapter 13. Desktop Printer Manager
Desktop Print Manager
Chapter 14. Mac OS 9 Finder Commands
Example Finder Scripts
Finder Commands
Chapter 15. Mac OS 9 Finder Classes
Finder Classes
Chapter 16. Network Setup Scripting
Network Setup Scripting
Chapter 17. Scripting Sherlock 2
Sherlock 2
Chapter 18. URL Access Scripting
URL Access Scripting
Part IV. Scripting Mac
OS 9 Control Panels and Extensions
Chapter 19. Appearance Control Panel
Appearance Control Panel
Chapter 20. Apple Data Detectors Extension
Apple Data Detectors
Chapter 21. Apple Menu Options Control
Panel
Apple Menu Options
Chapter 22. Application Switcher Extension
Application Switcher
Chapter 23. ColorSync Extension
ColorSync
Chapter 24. File Exchange Control Panel
File Exchange
Chapter 25. File Sharing Control Panel
File Sharing
Chapter 26. Folder Actions Extension
Folder Actions
Chapter 27. FontSync Control Panel and
Extension
FontSync Control Panel
FontSync Extension
Chapter 28. Location Manager Control Panel
Location Manager
Chapter 29. Memory and Mouse Control Panels
Memory Control Panel
Mouse Control Panel
Chapter 30. Speech Listener and SpeakableItems
Extension
Speech Listener Application
SpeakableItems Extension
Embedded Speech Commands
Chapter 31. Web Sharing
Control Panel
Part V. Scripting the
Mac OS X System
Chapter 32. Scripting the OS X Desktop
Working with Files, Folders, Disks, and Windows in OS
X
Chapter 33. Scripting Mail
Setting Up an Email Message
Exploring the Mail Application Object
Getting Information about an Email Account
Chapter 34. Executing Scripts with the Terminal
App
osacompile
osalang
osascript
Chapter 35. Scripting TextEdit
TextEdit
Part VI.
Appendixes
Appendix A. Standard Scripting Additions
Standard Additions
Standard Additions
Appendix B. AppleScript
Resources
Index