The scripting terminology for the Keynote application class is spread across three suites in the Keynote dictionary:
The Standard Suite Application Class
application n : [see also Keynote Suite, Compatibility Suite] : The application’s top-level scripting object.
contains documents, windows.
frontmost ( boolean r/o ) : Is this the active application?
name ( text r/o ) : The name of the application.
version ( text r/o ) : The version number of the application.
open, exists, quit, print
The Keynote Suite Application Class
application n : [see also Standard Suite, Compatibility Suite] : The Keynote application.
open, quit, print
The Keynote Compatibility Suite application class contains a set of commands for controlling the delivery of presentation documents:
The Keynote Compatibility Suite Application Class
application n : [see also Standard Suite, Keynote Suite] : The Keynote application.
start slideshow, stop slideshow, show next, show previous, show slide switcher, cancel slide switcher, move slide switcher forward, move slide switcher backward, accept slide switcher.
Intrinsic and Hidden Properties
In addition to the three suites shown above, Keynote has intrinsic application properties shared by all applications. These properties can provide the application identifier and the activity state of an application (is the application open).
Also, as a very useful bonus, the Keynote dictionary contains a set of hidden properties, including one for indicating whether Keynote is presenting a document, and whether the slide switcher is visible or not:
Starting and Stopping Presentations
Using elements from the sources and methods shown above, the following script contains a statement for Keynote to stop presenting. This statement will only run if: 1) Keynote is currently launched and running; and 2) a presentation is currently playing:
|01||-- IF KEYNOTE IS ACTIVE AND PLAYING THEN STOP IT|
|02||if running of application "Keynote" is true then|
|03||tell application "Keynote"|
|04||if playing is true then stop the front document|
And a script for presenting the front document. It will start the presentation only if Keynote is open with a document open: