AppleScript For Dummies by Tom Trinko at Bookstore UAE
close menu
Bookswagon
search
My Account
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Home > Computing and Information Technology Books > Computer programming / software engineering > AppleScript For Dummies
AppleScript For Dummies

AppleScript For Dummies


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

Spending a little time with this book can save lots of time on the computer!

AppleScript is object-oriented programming language used to write script files to automate tasks and customize applications for the Mac. AppleScript can automate much of what you do with your Mac computer, saving time and helping you be more productive. Businesses and individuals frequently use it for:

  • Batch processing
  • File conversion and manipulation
  • Performing tasks at specified times
  • Transferring information between databases and other applications
  • Creating automated workflows by linking the actions of multiple applications to perform a series of related tasks

Written by Tom Trinko, a Mac man since 1984,and author of articles for MacTutor and MacTech Journal, AppleScript For Dummies, 2nd Edition covers everything from the basics to more advanced stuff, with information on:

  • Finding and installing AppleScript
  • Using AppleScript to automate tasks in programs such as Word, Excel, FileMaker Pro, and the Mac OS Finder
  • Arranging applications to work together to accomplish complex tasks
  • Controlling applications that aren’t even scriptable
  • Taking advantage of tools that make composing AppleScript programs easy and fun
  • Finding additional AppleScript information on the Internet and elsewhere

With this book, you’ll discover how to script Internet activities, iLife applications, and more. Then, instead of letting your computer and/or software dictate how you do things (and often, how you have to do them over and over and over), you take charge! You’ll agree —this book is MacNificent!



Table of Contents:

Introduction 1

Why Should I Spend My Time Reading This Book? 1

How to Use This Book 3

What I Expect You Already Know and Have 4

You know how to use a Mac 4

You’re not a hacker 5

You have AppleScript 5

You know what a path to a file looks like 5

What the Silly Little Pictures Mean 6

Typeface Conventions 7

Part I: Getting Started 9

Chapter 1: A Cannonball Dive into the Scripting Pool 11

Writing Your First Script 11

The first, and in this case only, script line 13

Writing a Second (And Even Better) Script 14

Line 1: Displaying a dialog 16

Line 2: Accessing the user’s choice 18

Line 3: Responding to the user’s choice 18

Line 4: Filling a variable 19

Line 5: Greeting the user 19

Line 6: Examining alternatives 20

Line 7: Macs do have feelings! 20

Line 8: Ending the if 21

Saving Your Work 21

Running Your Script 22

Chapter 2: AppleScript Basics without Stomach Acid 25

What Is Scripting? What If Your Penmanship Is Poor? 25

Apple Events Aren’t Just Parties Anymore! 26

Levels of Scripting 27

What Can I Do with a Script? 29

What Can a Real Expert — You with a Few Months’ Experience — Do with a Script? 31

Chapter 3: Writing a Script without Ink 33

The Path toward a Script 33

Step 1: Figure out what you want to do 34

Step 2: To script or not to script: That is the question 35

Step 3: Define how the script will work 36

Step 4: Write the script 37

Step 5: Test the script 37

Step 6: Find and fix the problems 38

Step 7: Document the script 38

Script Editor: Free and Worth a Lot More 39

The basics 40

Great new stuff 41

Menus aren’t just for meals anymore 42

Wetting Your Whistle by Bossing Around a High-Paid Hacker’s Code 49

Line 1: Pick a database to work with 51

Line 2: Start bossing around FileMaker 51

Line 3: Open the selected database 52

Line 4: Alphabetize the records 52

Line 5: Select the reporters you care about 52

Line 6: How many reporters were selected? 52

Line 7: If there’s at least 1 relevant reporter 53

Line 8: Process each reporter in turn 53

Line 9: Get each reporter’s first name 53

Line 10: Get his/her company’s name 54

Line 11: Start bossing Mariner Write around 54

Line 12: Make a new press release 54

Line 13: Write the salutation 54

Line 14: Let Mariner Write know you’re done 55

Line 15: End of stuff repeated for each reporter 55

Line 16: If you can’t find a good reporter 55

Line 17: Let the script tell you something 56

Line 18: End of the if 57

Line 19: Finish with FileMaker 57

Part II: All You Ever Needed to Know about AppleScript You Learned in Part II 59

Chapter 4: Values: Different Types of Information 61

Values Are Classy Things 61

AppleScript Values 63

Integer 63

Real 64

String or Text 64

List 67

Record 68

Boolean 69

Reference 69

Date 70

Units 71

Constants and global properties 72

Styled text 72

Unicode text 73

Number 73

Data 73

Class 73

File 74

Alias 74

Application 74

Machine 74

Chapter 5: Variables: Data Cupboards 75

Rules for Naming Variables 75

Using Variables 78

When to Use Set and When to Use Copy 79

Chapter 6: Operators: Math without Mistakes 81

Operator? Can You Place This Number? 81

Math Operators 82

The addition operator: + 83

The subtraction operator: – 83

The division operator: / 83

The multiplication operator: * 83

The exponent operator: ^ 83

Other math operators 84

Date arithmetic 84

Logical and Comparison Operators 85

Miscellaneous Operators 86

& 86

as 87

a reference to 88

Precedence: When to Use Parentheses 88

Chapter 7: References: Being Picky about Data 91

What Is a Reference? 91

Different Kinds of Reference Forms 97

arbitrary 97

every 98

filter (called a whose clause by those in the know) 99

ID 100

index 101

middle 103

name 103

property 104

range 105

relative 106

Referencing Files 107

Chapter 8: Commands: Ordering AppleScript Around 109

Basic Commands 110

activate 110

clipboard info 111

copy 112

count 113

current date 114

delay 115

get 116

info for 116

launch 119

list disks 120

list folder 121

mount volume 123

offset 124

path to 126

random number 129

round 130

set 131

set the clipboard to 132

set volume 133

summarize 134

the clipboard 135

time to GMT 135

Advanced Commands 136

do shell script 136

scripting components 138

system attribute 138

ASCII character 140

ASCII number 141

Chapter 9: I/O (I Owe) without Credit Cards 143

I/O Commands 143

display dialog 144

choose from list 149

beep 151

say 151

choose application 152

choose URL 154

choose file 155

choose file name 156

choose folder 157

choose color 158

A Final Word 158

Chapter 10: If: Letting Your Computer Make Decisions So You Can Blame It Later 159

The Ever-Famous if Statement 159

Logical Operators 160

and 161

or 161

=, is, equal, equals, is equal to 162

≠ (option =), is not, isn’t, isn’t equal to, is not equal to, doesn’t equal, does not equal 162

>, is greater than, comes after, is not less than or equal to, isn’t less than or equal to 163

<, is less than, comes before, is not greater than or equal to, isn’t greater than or equal to 163

≥ (Option+Shift+>), >=, is greater than or equal to, is not less than, isn’t less than, does not come before, doesn’t come before 164

≤ (Option+,), <=, is less than or equal to, is not greater than, isn’t greater than, does not come after, doesn’t come after 164

start[s] with, begin[s] with 165

ends with 165

contains 166

does not contain, doesn’t contain 166

is in, is contained by 167

is not in, is not contained by, isn’t contained by 167

not 167

A parting shot 168

How Your Script Can Make Up Its Mind 168

Chapter 11: Repeat: Going in Circles for Fun and Profit 175

The Repeat Statement 175

Searching for a word that may not be in the text file 178

Working with lists and records 180

Finding files containing keywords 181

Using repeat times 182

Using repeat forever 182

Chapter 12: Try: Dealing with Problems without Crashing 185

Using the try Statement — the Simple Way 186

Advanced try Options 190

Chapter 13: Handlers: Organizing Your Script 193

Getting a Handle on Messages 193

Calling a handler with variables 194

Calling a handler with values 195

Understanding a variable scope 197

Passing data between handlers 198

Other handler syntaxes 201

Chapter 14: Properties: Storing Data for Awhile 203

Defining Properties 203

Using Read and Write 204

The read and write Commands 211

get eof 212

read 214

set eof 215

write 216

open for access 217

close access 217

Chapter 15: Deploying Scripts: Cool Ways to Access Scripts 219

Creating a Drag-and-Drop Script Application 219

Testing Your Drag-and-Drop Script 221

Using the Script Menu 222

Writing a Toolbar Script 224

Triggering Scripts with Speech 226

Chapter 16: Autonomous Scripts: Working Unsupervised 227

Writing Autonomous Scripts (Agents) 227

Displaying the Startup Screen 230

Testing Agents 231

Dealing with Quitting 232

Reacting to Changes: Folder Actions 232

Periodically Launching Scripts 235

Launching Scripts at Login and Logout 236

Scripting the Digital Hub 239

Scripts Can Be Applications, Too! 240

Chapter 17: Taking Charge of Applications 241

The Basics of Bossing Around Apps 241

Using a Dictionary without Knowing How the Words Are Spelled 244

Reading a value type (class) entry 244

Reading a command entry 247

Dictionaries aren’t perfect 248

Differentiating between Good Applications and Pond Scum 251

Tell: Getting Applications to Pay Attention 253

Making a Good Recording — Even If You Can’t Sing 256

Chapter 18: Debugging: Fixing Problems without DDT 259

The Art of Debugging 259

Not using global variables 260

Labeling variable names clearly 261

Breaking large scripts into modular handlers 261

Incrementally testing your script 264

Using rapid prototyping 265

Use lots of comments 265

Savvy Troubleshooting 266

Understanding the problem 267

Figuring out where the problem occurs in the script 268

Pinpointing why the error occurs 268

A diversion: Using the Event Log window to see what’s going on in your script 270

Fixing the problem 275

Testing the solution 276

Chapter 19: Scripting Additions: Taking AppleScript to New Heights 277

Working with Scripting Additions 277

Chapter 20: Script Objects: Recycling Scripts for a Healthy Environment 279

Creating a Script Object 279

Using Inheritance 283

Using the continue statement 285

store script 286

load script 288

run script 289

Chapter 21: Miscellaneous Advanced Stuff 291

Timeout: Dealing with Slowpoke Applications 291

Transactions: Dealing with States 292

Considering and Ignoring: Changing the Rules 292

Part III: How to Control the World — or at Least Some Common Programs 295

Chapter 22: Finder/System Tricks without Touching the Mouse 297

Some Quick Finder Tricks 298

Playing Hide and Seek with the Finder 300

Cleaning Up the Desktop by Tiling Windows 300

Showing Free Disk Space 304

Finding Scriptable Applications and Processing Every File to Boot 305

Working with System Events 307

Chapter 23: Business Applications and Microsoft Office 2004 309

FileMaker Pro 309

Scripting and Office: A History 311

Microsoft Word 312

Microsoft Excel 316

Microsoft PowerPoint 319

Chapter 24: Layout and Graphics Applications 321

OS X’s Built-In Graphics Engine 321

Photoshop CS 323

InDesign CS 325

Chapter 25: Scripting the Web 329

Opening a Web Page 329

Scripting Web Surfing 330

Automating Your E-Mail 332

Working with iDisk 334

Working over a Network 335

Automating Web Services 338

Chapter 26: Scripting iLife 341

Scripting iTunes 341

Scripting iPhoto 345

Scripting iDVD 347

Working with DVD Player 349

Working with iCal 350

Chapter 27: GUI Scripting 351

How GUI Scripting Works 351

Addressing an Item 352

Part IV: The Part of Tens 355

Chapter 28: More Than Ten Scriptable Applications 357

Business (Database, Spreadsheets) 357

Charts/Drawing 358

Graphics/Digital Photos 358

Internet-Related (E-Mail, Web Browsers) 359

Miscellaneous 359

Multimedia (Music/Movies) 360

Page Layout 360

Script Launchers/Utilities 360

Utilities 361

Web Development 361

Writing 362

Chapter 29: More Than Ten Scripting Resources 363

Web Sites 363

Mailing Lists/Discussion Boards 364

Tools 364

Scripting Additions 365

The Author or a Reasonable Facsimile Thereof 366

Index 367



About the Author :
Born in Chicago, Tom Trinko has lived a deprived life, never once having butchered a hog. In an attempt to improve the quality of life in Chicago, he pursued his higher education in Pasadena, California, at Cal Tech. He moved to Wisconsin for the better climate and picked up his PhD in physics, graduating with the official title of mad scientist. His first smart move was marrying a woman who worked at Apple and who had an Apple IIe. With that, he was able to extend his professional programming career, which began in 1972, to home computers. His long-suffering wife brought a Mac home in 1984, which marked the start of Tom’s enthusiasm for the only OS for people who want to get work done. He’s ordered the Mac around in Basic, Forth, C, Pascal, and about a billion or so scripting languages. Back when Apple didn’t know any better, he did contract work for Apple’s Developer University. In real life, he works on other platforms, ranging from supercomputers to UNIX workstations, which continually remind him of how spiffy the Mac really is. His current main objective in life is staying more computer literate than his kids.


Best Sellers


Product Details
  • ISBN-13: 9780764574948
  • Publisher: John Wiley & Sons Inc
  • Publisher Imprint: For Dummies
  • Height: 234 mm
  • No of Pages: 416
  • Returnable: N
  • Weight: 608 gr
  • ISBN-10: 0764574949
  • Publisher Date: 27 Aug 2004
  • Binding: Paperback
  • Language: English
  • Returnable: N
  • Spine Width: 23 mm
  • Width: 188 mm


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
AppleScript For Dummies
John Wiley & Sons Inc -
AppleScript For Dummies
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

AppleScript For Dummies

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!