THÔNG TIN TÀI LIỆU
Click here to show toolbars of the Web Online Help System: show toolbars
•
Table of
Contents
• Index
• Reviews
• Examples
•
Reader
Reviews
• Errata
AppleScript in a Nutshell
By Bruce W. Perry
Publisher: O'Reilly
Pub Date: June 2001
ISBN: 1-56592-841-5
Pages: 526
Slots: 1
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. 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.
This HTML Help has been published using the chm2web software.
Click here to show toolbars of the Web Online Help System: show toolbars
•
Table of
Contents
• Index
• Reviews
• Examples
•
Reader
Reviews
• Errata
AppleScript in a Nutshell
By Bruce W. Perry
Publisher: O'Reilly
Pub Date: June 2001
ISBN: 1-56592-841-5
Pages: 526
Slots: 1
Copyright
Preface
Organization of This Book
Conventions Used in This Book
How to Contact Us
Acknowledgments
Part I: Introduction to AppleScript
Chapter 1. AppleScript: An Introduction
Section 1.1. How Is AppleScript Used?
Section 1.2. Apple Events
Section 1.3. Using Script Runner with OS X
Section 1.4. Using OSA Menu with OS 9
Section 1.5. Checking Your AppleScript Version
Section 1.6. Diving In
Chapter 2. Using Script Editor with OS 9 and OS X
Section 2.1. Script Editor Controls/Commands
Section 2.2. 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
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
m od
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
Section 6.1. Variables
Section 6.2. Constants and Predefined Variables
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
Section 8.1. Subroutines with Positional Parameters
Section 8.2. Subroutines with Labeled Parameters
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
Section 14.1. Example Finder Scripts
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
Section 32.1. Working with Files, Folders, Disks, and Windows in OS X
Chapter 33. Scripting Mail
Section 33.1. Setting Up an Email Message
Section 33.2. Exploring the Mail Application Object
Section 33.3. 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
Section B.1. Apple Computer AppleScript URLs
Section B.2. AppleScript FAQs, Mailing Lists, and Tutorials
Section B.3. Macintosh Scripting Sites
Section B.4. Commercial AppleScript Development Environments
Section B.5. Freeware AppleScript Development Environments
Colophon
Index
This HTML Help has been published using the chm2web software.
Click here to show toolbars of the Web Online Help System: show toolbars
Copyright © 2002 O'Reilly & Associates, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered
trademarks of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and
sellers to distinguish their products are claimed as trademarks. Where those designations
appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the
designations have been printed in caps or initial caps. The association of the image of a
Boston terrier and the topic of AppleScript is a trademark of O'Reilly & Associates, Inc.
Apple Computer, Inc. boldly combined open source technologies with its own programming
efforts to create Mac OS X, one of the most versatile and stable operating systems now
available. In the same spirit, Apple has joined forces with O'Reilly & Associates to bring you an
indispensable collection of technical publications. The ADC logo indicates that the book has
been technically reviewed by Apple engineers and is recommended by the Apple Developer
Connection.
Apple, Macintosh, AppleScript, Mac OS, and Mac OS X are registered trademarks of Apple,
Inc.
While every precaution has been taken in the preparation of this book, the publisher assumes
no responsibility for errors or omissions, or for damages resulting from the use of the
information contained herein.
This HTML Help has been published using the chm2web software.
Click here to show toolbars of the Web Online Help System: show toolbars
[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [Y]
This HTML Help has been published using the chm2web software.
[...]... automating software workflows In workflows, one or more separate software programs cooperate in a sequence of actions to complete a job This means that launching an AppleScript can orchestrate several actions that involve software applications that are not otherwise designed to share data or call each other's menu commands AppleScript does the calling of each program's commands (targeting them in a. .. how AppleScript stores data in memory), operators (such as the common Math operators and the string-concatenation operator "&"), and how to set AppleScript variables and create user-defined functions, as well as advanced features, such as creating object-oriented script objects (Chapter 9) Chapter 3 This chapter describes the built -in AppleScript data types, including string, integer, real, list, and... considered a near paragon of scriptability Attachable means that you can create a script and then attach it to a program, so that the script is added to the program's internal menus Applications usually implement attachability with Mac OS 9 by providing a folder for scripts and a menu item on their menubars that lists these available scripts Figure 1-2 shows a menubar that contains a list of attached scripts... Folder:Scripting Additions folder They are stored in more than one location in Mac OS X, including /System/ Library/ScriptingAdditions/ Examples of two scripitng addition commands that are often used are display dialog (see Example 1-1 ) and current date The latter command returns a date object that contains data about today's date and time The Standard Additions are installed with the Mac OS There is a large database... memory they have using this measurement display dialog is an often-used extension to the built -in AppleScript language called a scripting addition, which I explain later in this chapter (Appendix A, of the book is devoted to descriptions of the standard scripting additions that are installed with Mac OS 9 and OS X) display dialog shows a dialog window containing the message label that you specify in the... dictionary supports the scaling and rotating of image files) In addition, the AppleScript engineers are apparently working on ways to let AppleScript interact with the command-line shells that come with OS X, such as the Bourne shell OS X already permits the launching of AppleScripts from a shell (see Chapter 34) 1.1.2 Attachability/Recordability If an application is either attachable or recordable (or... should and can use AppleScript? The following users come to mind right away: system administrators who are automating tasks with networks and applications; web and graphics professionals who want to control the development of web sites and publications; scientists, mathematicians, and engineers who require applets to make calculations and automate their own software tools, as well as day-to-day programmers... Perl, and Java Nevertheless, this section will describe what you can do with AppleScript and three Mac OS X programs that can be used with AppleScript: Mail, Terminal application (a command-line tool), and TextEdit Part V begins with a discussion of AppleScript and scripting the new Mac OS X Finder, which is the OS 9 Finder after a major facelift Chapter 32 This chapter explains some of the familiar Finder-like... Computer's new email application, aptly called "Mail." This chapter provides descriptions and code examples on setting up a new mail message and getting information about an email account Chapter 34 Terminal application is the command-line tool or interface (a window or shell that you type script commands into) that comes with Mac OS X This chapter shows how you can create, compile, and execute AppleScripts... their own applets, is not matched by any other platform's programming language Yet, only a small percentage of Macintosh users are even aware that AppleScript is installed with their operating system Those who are aware of AppleScript' s presence on their machine often do not take full advantage of this tool to automate their daily computing activities, both on their local machine and over the Internet . designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association of the image. examples on setting up a new mail message and getting information about an email account. Chapter 34 Terminal application is the command-line tool or interface (a window or shell that you type. own applets, is not matched by any other platform's programming language. Yet, only a small percentage of Macintosh users are even aware that AppleScript is installed with their operating
Ngày đăng: 25/03/2014, 10:39
Xem thêm: o'reilly - applescript in a nutshell