AppleScript support in the iWork for Mac apps is improved in Numbers 3.1 and later, Pages 5.2 and later, and Keynote 6.2 and later.
AppleScript is one of two technologies offered by OS X Mountain Lion that make it easy to automate repetitive actions on your Mac. AppleScript is “programming for the rest of us.” It can record and play back things that you do (if the application was written to allow the recording — Finder, for example, was), such as opening an application or clicking a button. Download the “Button Click Image Capture” AppleScript file. Camera Settings Change. The camera settings can be set via SecuritySpy's built-in web server, and so to set the settings from AppleScript, simple scripts can be written that post data to the web server. The example below turn motion detection off and on for camera 0.
The AppleScript dictionary contains the available AppleScript commands for Pages, Numbers, and Keynote. To view the dictionary:
- Open the AppleScript Editor in Applications > Utilities.
- Choose File > Open Dictionary.
- Select Pages, Numbers, or Keynote. Click Choose. If you have an earlier version of the app installed, make sure to select the correct version in the list.
Additional information
More information about using AppleScript in the iWork for Mac apps is available on third-party websites such as Mac OS X Automation and iWork Automation.
To learn how to do a Mail Merge using AppleScript in Pages 5.5 and later or Numbers 3.5 and later, visit the Mail Merge section of the iWork Automation site.
2 0 likes 11,979 views Last modified Apr 10, 2014 8:53 AM
Getting started
Software
Although there are 3rd party editors available, you don't need any external software to write, compile or run AppleScript scripts. OS X comes bundled with the AppleScript Editor, which you can find on your startup disk at /Applications/Utilities/AppleScript Editor.app.
Learning Guides
Two widely recommended books for those just starting out with Applescript are
Apple Training Series: AppleScript 1-2-3
Sal Soghoian (Author), Bill Cheeseman (Author)
Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X
Hamish Sanderson (Author), Hanaan Rosenthal (Author)
These are available from large online book retailers and distributors in electronic and print format at quite reasonable prices (at time of writing they're around $20-$25 each). Each is a substantial volume that will serve both as tutorial and reference work.
There are many other books available, but I can personally recommend both the above as highly valuable. 'AppleScript 1-2-3' is probably the better of the two if you are new to AppleScript and to computer programming in general. It is one of the few computer books I've come across that genuinely lives up to the promise of 'no previous experience required'. 'Learn AppleScript' covers some more advanced topics and treats some of the same topics in more depth. The two books are best seen as complementaries rather than alternatives.
Apple provides some free resources, the most useful of which is:
Applescript Editor Download Mac Software
The AppleScript Language Guide
There is an inconspicuous 'PDF' icon at the top right of that page which will allow you to download the entire guide in PDF form, which may be more convenient than reading the online HTML version.
The AppleScript Overview
may also be of interest, though it is largely aimed at developers wishing to make their apps scriptable with AppleScript, rather than for those using AppleScript for scripting. However, if you would like or need a better conceptual understanding of AppleScript and how it fits in with the entire OS X ecology, this will be of interest.
Getting Started with AppleScript
You may often find references in Apple documentation to something called 'Getting Started with AppleScript' but without a link.
This, and pretty much all other public domain documentation for AppleScript, has been collated on an third-party (i.e, not hosted, supported or endorsed by Apple, Inc.) site here:
Getting help
OS X Technologies is the ASC forum for most AppleScript questions,
but they also do appear on the Developer's forum too.
Perhaps the largest active community of expert and novice AppleScripters alike can be found on the Apple AppleScript mailing list:
A useful external resource both for problem solving and general reference is
http://macscripter.net.
The following site also lists a number of useful links and AppleScript resources:
Using 'do shell script'
One of AS's biggest strengths is its ability to incorporate shell scripts through the 'do shell script' command. However, this is often a source of frequent questions from new scripters. See this article for reference on the ins-and-outs of using shell scripts with AS:
Applescript Editor For Windows
Distributing your work
How do I protect my source code?
If you distribute your app without creating a 'run only' version, others will be able to see and modify your source code. To create a 'run only' version use File > Export... and change the File Format: to 'Application'. Check the 'run only' option at the bottom of the dialogue. Note that in earlier versions of the AppleScript Editor and as stated in some of the learning guides above, the 'run only' option was found in File > Save As...' . That is no longer the case.
How do I set the version number for my public releases?
Applescript Editor Download Mac Installer
See https://discussions.apple.com/thread/3132455
Applescript Editor
How do I create an 'Application Support' folder for my app?
Apple Applescript
See https://discussions.apple.com/thread/4885832?answerId=21505599022#21505599022