Learn AppleScript 3rd Edition.pdf

(22085 KB) Pobierz
674345878 UNPDF
The most complete book available
covering AppleScript 2 and Mac OS X automation
Learn AppleScript
The Comprehensive Guide to Scripting
and Automation on Mac OS X
THIRD EDITION
Hamish Sanderson  |   Hanaan Rosenthal
Foreword by Dr. William Cook
674345878.039.png 674345878.040.png 674345878.041.png 674345878.042.png 674345878.001.png 674345878.002.png 674345878.003.png 674345878.004.png 674345878.005.png 674345878.006.png 674345878.007.png 674345878.008.png 674345878.009.png 674345878.010.png 674345878.011.png 674345878.012.png 674345878.013.png 674345878.014.png 674345878.015.png 674345878.016.png 674345878.017.png 674345878.018.png 674345878.019.png 674345878.020.png 674345878.021.png 674345878.022.png 674345878.023.png 674345878.024.png 674345878.025.png 674345878.026.png 674345878.027.png 674345878.028.png 674345878.029.png 674345878.030.png 674345878.031.png 674345878.032.png 674345878.033.png 674345878.034.png
Learn AppleScript
The Comprehensive Guide to Scripting and
Automation on Mac OS X, Third Edition
■ ■ ■
Hamish Sanderson and
Hanaan Rosenthal
Download from Wow! eBook <www.wowebook.com>
i
674345878.035.png 674345878.036.png
Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X,
Third Edition
Copyright © 2010 by Hamish Sanderson and Hanaan Rosenthal
All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any
information storage or retrieval system, without the prior written permission of the
copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2361-0
ISBN-13 (electronic): 978-1-4302-2362-7
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, we use the names only in an editorial fashion and
to the benefit of the trademark owner, with no intention of infringement of the trademark.
Publisher and President: Paul Manning
Lead Editor: Douglas Pundick
Technical Reviewer: David A. Coyle
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary
Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie,
Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-
Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Coordinating Editor: Debra Kelly
Copy Editor: Bill McManus
Compositor: MacPS, LLC.
Indexer: BIM Indexing & Proofreading Services
Artist: April Milne
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring
Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail
For information on translations, please e-mail rights@apress.com , or visit www.apress.com .
Apress and friends of ED books may be purchased in bulk for academic, corporate, or
promotional use. eBook versions and licenses are also available for most titles. For more
information, reference our Special Bulk Sales–eBook Licensing web page at
The information in this book is distributed on an “as is” basis, without warranty. Although
every precaution has been taken in the preparation of this work, neither the author(s) nor
Apress shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in this work.
The source code for this book is available to readers at www.apress.com .
ii
Download from Wow! eBook <www.wowebook.com>
674345878.037.png
Contents at a Glance
Contents at a Glance. ............................................................................................................... iii
Contents. .................................................................................................................................... v
Foreword . ............................................................................................................................... xix
About the Authors. .................................................................................................................. xxi
About the Technical Reviewer . .............................................................................................. xxii
Acknowledgments . ............................................................................................................... xxiii
Introduction . ......................................................................................................................... xxiv
Part I: Welcome to AppleScript . ................................................................................................... 1
Chapter 1: Introducing AppleScript . ......................................................................................... 3
Chapter 2: AppleScript in Principle . ....................................................................................... 15
Chapter 3: AppleScript in Practice . ........................................................................................ 33
Part II: Understanding AppleScript . ........................................................................................... 51
Chapter 4: Writing Scripts in AppleScript Editor . ................................................................... 53
Chapter 5: Understanding How Application Scripting Works ................................................. 77
Chapter 6: Learning to Work with AppleScript Objects ........................................................ 143
Chapter 7: Working with Text . .............................................................................................. 163
Chapter 8: Working with Numbers . ...................................................................................... 215
Chapter 9: Working with Dates. ............................................................................................ 241
Chapter 10: Working with Lists and Records . ...................................................................... 267
Chapter 11: Storing Objects in Variables. ............................................................................. 293
Chapter 12: More on Commands . ......................................................................................... 319
Chapter 13: More on Operators and Coercions. .................................................................... 369
Chapter 14: Making Decisions Using Conditionals and Loops . ............................................. 389
Chapter 15: Making Decisions When Dealing with Errors . ................................................... 413
Chapter 16: Interacting with the User . ................................................................................. 437
Chapter 17: Working with Files . ........................................................................................... 471
iii
Download from Wow! eBook <www.wowebook.com>
674345878.038.png
Zgłoś jeśli naruszono regulamin