AppleScript: The Definitive Guide, 2/e

Matt Neuburg

  • 出版商: O'Reilly
  • 出版日期: 2006-02-07
  • 定價: $1,300
  • 售價: 6.0$780
  • 語言: 英文
  • 頁數: 592
  • 裝訂: Paperback
  • ISBN: 0596102119
  • ISBN-13: 9780596102111
  • 立即出貨 (庫存 < 4)

買這商品的人也買了...

商品描述

Description

Mac users everywhere--even those who know nothing about programming--are discovering the value of the latest version of AppleScript, Apple's vastly improved scripting language for Mac OS X Tiger. And with this new edition of the top-selling AppleScript: The Definitive Guide, anyone, regardless of your level of experience, can learn to use AppleScript to make your Mac time more efficient and more enjoyable by automating repetitive tasks, customizing applications, and even controlling complex workflows.


Fully revised and updated--and with more and better examples than ever--AppleScript: The Definitive Guide, 2nd Edition explores AppleScript 1.10 from the ground up. You will learn how AppleScript works and how to use it in a variety of contexts: in everyday scripts to process automation, in CGI scripts for developing applications in Cocoa, or in combination with other scripting languages like Perl and Ruby.



AppleScript has shipped with every Mac since System 7 in 1991, and its ease of use and English-friendly dialect are highly appealing to most Mac fans. Novices, developers, and everyone in between who wants to know how, where, and why to use AppleScript will find AppleScript: The Definitive Guide, 2nd Edition to be the most complete source on the subject available. It's as perfect for beginners who want to write their first script as it is for experienced users who need a definitive reference close at hand.



AppleScript: The Definitive Guide, 2nd Edition begins with a relevant and useful AppleScript overview and then gets quickly to the language itself; when you have a good handle on that, you get to see AppleScript in action, and learn how to put it into action for you. An entirely new chapter shows developers how to make your Mac applications scriptable, and how to give them that Mac OS X look and feel with AppleScript Studio. Thorough appendixes deliver additional tools and resources you won't find anywhere else. Reviewed and approved by Apple, this indispensable guide carries the ADC (Apple Developer Connection) logo.

 

Table of Contents

Preface

Part I. AppleScript Overview

1. Why to Use AppleScript

     The Nature and Purpose of AppleScript

     Is This Application Scriptable?

     Calculation and Repetition

     Reduction

     Customization

     Combining Specialties

2. Where to Use AppleScript

     Script Editor

     Internally Scriptable Application

     Script Runner

     Automatic Location

     Application

     Unix

     Hyperlinks

     Automator

3. Basic Concepts

     Apple Events

     The Open Scripting Architecture

     Script

     Compiling and Decompiling

     Compiled Script Files

     Script Text File

     Applet and Droplet

     Scripting Addition

     Dictionary

     Missing External Referents

     Modes of Scriptability

Part II. The AppleScript Language

4. Introducing the Language

     A Little Language

     Extensibility and Its Perils

     The "English-likeness" Monster

     Object-likeness

     LISP-likeness

     The Learning Curve

5. Syntactic Ground of Being

     Lines

     Result

     Comments

     Abbreviations and Synonyms

     Blocks

     The

6. A Map of the World

     Scope Blocks

     Levels and Nesting

     The Top Level

     Code and the Run Handler

     Variables

7. Variables

     Assignment and Retrieval

     Declaration and Definition of Variables

     Variable Names

8. Script Objects

     Script Object Definition

     Run Handler

     Script Properties

     Script Objects as Values

     Top-Level Entities

     Compiled Script Files as Script Objects

     Inheritance

9. Handlers

     Handler Definition

     Returned Value

     Handlers as Values

     Parameters

     Pass by Reference

     Syntax of Defining and Calling a Handler
     Event Handlers

     The Run Handler

     Recursion

     Power Handler Tricks

10. Scope

     Regions of Scope

     Kinds of Variable

     Scope of Top-Level Entities

     Scope of Locals

     Scope of Globals

     Scope of Undeclared Variables

     Declare Your Variables

     Free Variables

     Redeclaration of Variables

     Closures

11. Objects

     Messages

     Attributes

     Class

     Target

     Get

     It

     Me

     Properties and Elements

     Element Specifiers

     Operations on Multiple References

     Assignment of Multiple Attributes

     Object String Specifier

12. References

     Reference as Target

     Reference as Incantation

     Creating a Reference

     Identifying References

     Dereferencing a Reference

     Trouble with Contents

     Creating References to Variables

     Reference as Parameter

13. Datatypes

     Application

     Machine

     Data

     Boolean

     Integer, Real, and Number

     Date

     String

     Unicode Text

     File and Alias

     List

     Record

14. Coercions

     Implicit Coercion

     Explicit Coercion

     Boolean Coercions

     Number, String, and Date Coercions

     File Coercions

     List Coercions

     Unit Conversions

15. Operators

     Implicit Coercion

     Arithmetic Operators

     Boolean Operators

     Comparison Operators

     Containment Operators

     Concatenation Operator

     Parentheses

     Who Performs an Operation

16. Global Properties

     Strings

     Numbers

     Miscellaneous

17. Constants

18. Commands

     Application Commands

     Standard Commands

     Logging Commands

19. Control

     Branching

     Looping

     Tell

     Using Terms From

     With

     Considering/Ignoring

     Errors

     Second-Level Evaluation

Part III. AppleScript In Action

20. Dictionaries

     Resolution of Terminology

     Terminology Clash

     Nonsensical Apple Events

     Raw Four-Letter Codes

     Multiple-Word Terms

     What's in a Dictionary

     The 'aeut' Resource

     Inadequacies of the Dictionary

21. Scripting Additions

     Pros and Cons of Scripting Additions

     Classic Scripting Additions

     Loading Scripting Additions

     Standard Scripting Addition Commands

22. Speed

     Tools of the Trade

     Apple Events

     List Access

     Scripting Additions

     Context

23. Scriptable Applications

     Targeting Scriptable Applications

     Some Scriptable Applications

24. Unscriptable Applications

     Historical Perspective

     Getting Started with Accessibility

     GUI Scripting Examples

25. Unix

     Do Shell Script

     Osascript

26. Triggering Scripts Automatically

     Digital Hub Scripting

     Folder Actions

     CGI Application

     Timers, Hooks, Attachability, Observability

27. Writing Applications

     Applets

     AppleScript Studio

     Cocoa Scripting

     AppleScript Studio Scriptability

Part IV. Appendixes

A. The AppleScript Experience

B. Apple Events Without AppleScript

C. Tools and Resources

Index

商品描述(中文翻譯)

描述

Mac用戶們,即使對編程一無所知,也正在發現蘋果最新版本的AppleScript的價值,這是蘋果為Mac OS X Tiger開發的大幅改進的腳本語言。而且,隨著這本暢銷書的新版《AppleScript: The Definitive Guide》的問世,無論您的經驗水平如何,任何人都可以學習使用AppleScript,通過自動化重複任務、自定義應用程序甚至控制複雜工作流程,使您的Mac使用更高效、更愉快。

這本全面修訂和更新的《AppleScript: The Definitive Guide, 2nd Edition》從頭到尾探索了AppleScript 1.10。您將學習AppleScript的工作原理以及如何在各種情境中使用它:在日常腳本中進行自動化處理、在Cocoa中開發應用程序的CGI腳本中使用它,或者與Perl和Ruby等其他腳本語言結合使用。

自1991年的System 7以來,AppleScript已經隨著每台Mac一同發貨,其易用性和英語友好的方言對大多數Mac粉絲非常吸引人。無論是想寫第一個腳本的初學者,還是需要一本權威參考書的經驗豐富的用戶,都會發現《AppleScript: The Definitive Guide, 2nd Edition》是最完整的相關資料來源。這本書非常適合初學者,也非常適合經驗豐富的用戶,他們需要一本權威參考書隨時可查。

《AppleScript: The Definitive Guide, 2nd Edition》首先提供了一個相關且有用的AppleScript概述,然後迅速介紹了語言本身;當您對此有了很好的掌握後,您將看到AppleScript的實際應用,並學習如何將其應用於您的工作中。全新的一章向開發人員展示如何使您的Mac應用程序可腳本化,以及如何使用AppleScript Studio為其提供Mac OS X的外觀和感覺。詳細的附錄提供了其他工具和資源,您在其他地方找不到。這本不可或缺的指南經過蘋果的審查和批准,並帶有ADC(蘋果開發者連接)標誌。

目錄

前言
第一部分:AppleScript概述
1. 為什麼使用AppleScript

- AppleScript的性質和目的
- 這個應用程序是否可腳本化
- 計算和重複
- 簡化
- 自定義
- 結合專業知識

2. 在哪裡使用AppleScript

- 腳本編輯器
- 內部可腳本化應用程序
- 腳本運行器
- 自動定位
- 應用程序
- Unix
- 超連結
- Automator

3. 基本概念

- Apple事件
- 開放腳本架構
- 腳本
- 編譯和反編譯
- 編譯腳本文件
- 腳本文本文件
- Applet和Droplet
- 腳本附加功能