data-id=apple-event-objects-and-apple-events
Apple Event Objects and Apple Events
This chapter describes the supported Apple event objects, with descriptions of each object’s elements and properties, and the supported Apple events.
data-id=objects
Objects
Acrobat presents the following objects to the Apple event interface:
annotationapplicationbookmarkconversiondocumentLink Annotationmenumenu itempagePDF WindowText Annotation
data-id=50532410_25583
data-id=annotation
annotation
An annotation on a page in a PDF file that corresponds to PDAnnot, an internal Acrobat class. This object was formerly known as PDAnnot.
Acrobat also has two built-in annotation objects. For more information, see Link Annotation and Text Annotation.
Plural form
Annotations
Properties
Left Top Zoom, Fit Page, Fit Width, Fit Height, Fit Rect, Fit BBox, Fit BB Width, Fit BB Height These are described in the PDF Reference.fit type is Left Top Zoom, this specifies the zoom factor; otherwise it is ignored. Setting this property automatically sets fit type to Left Top Zoom.Related methods
data-id=50532410_98408
data-id=application
application
The Acrobat or Acrobat Reader application itself.
Elements
Properties
no vary, fit page, fit width, fit height, and fit visible width.set the note color to {0, 0, 32768}.Single Page, Continuous, Facing, and Continuous - Facing.Points, Inches or Millimeters.ENU represents English.Related methods
data-id=avpageview
AVPageView
Note
Deprecated. Use PDF Window instead.
data-id=50532410_75140
data-id=bookmark
bookmark
A bookmark on a page in a PDF file. Corresponds to Acrobat’s PDBookmark object.
Note
This object was formerly known as
PDBookmark.
Plural form
Bookmarks
Properties
fit type.Left Top Zoom: Sets a specified zoom and a specified location on the page. Fit Page: Sets the zoom factor so that the entire page fits into the window. Fit Width: Sets the zoom factor so that the width of the page fits into the window. Fit Height: Sets the zoom factor so that the height of the page fits into the window. Fit Rect: Sets the zoom factor so that the specified rectangle fits into the window. Fit BBox: Sets the zoom so that the rectangle enclosing all marks on the page (known as the bounding box) fits into the window. Fit BB Width: Sets the zoom factor so that the width of the bounding box fits into the window. Fit BB Height: Sets the zoom factor so that the height of the bounding box fits into the window.fit type is Left Top Zoom ; ignored otherwise. Setting this property automatically sets fit type to Left Top Zoom.Related methods
data-id=50532410_56571
data-id=conversion
conversion
A file type converter that exports PDF files into other formats. Conversions correspond to the list of formats specified in the Acrobat Save As menu. A list of formats can be obtained as follows:
get every conversion
Properties
Related methods
data-id=50532410_48845
document
Represents a single open document in Acrobat or Acrobat Reader.
Elements
some keyword in AppleScript. No document has more than one PDF Window.Plural form
documents
Properties
just pages, pages and thumbs, or pages and bookmarks.Related methods
- bring to front
- clear selection
- close
- count
- create thumbs
- delete
- delete pages
- delete thumbs
- find next note
- find text
- get info
- insert pages
- maximize
- print pages
- replace pages
- save
- set info
data-id=50532410_79350
data-id=eps-conversion
EPS Conversion
A file type converter that exports PDF files into EPS format.
Properties
Inherits from PostScript Conversion.
Related methods
data-id=50532410_90412
data-id=link-annotation
Link Annotation
A link annotation on a page in a PDF file. Can only be used as the target of a make event. All other access is via the annotation class.
Note
This object was formerly known as PDLinkAnnot.
Properties
Inherits from annotation.
Related methods
data-id=50532410_45214
data-id=menu
menu
A menu in the Acrobat or Acrobat Reader menu bar.
Elements
Properties
Related methods
data-id=50532410_78053
data-id=menu-item
menu item
A menu item contained within a menu in Acrobat or Acrobat Reader.
Properties
Related methods
data-id=50532410_24065
page
A single page in the PDF representation of a document. Corresponds to Acrobat’s internal PDPage object.
Note
This object was formerly known as
PDPage.
Elements
Plural form
Pages
Properties
Related methods
data-id=pdannot
PDAnnot
Note
Deprecated. Use annotation instead.
data-id=pdbookmark
PDBookMark
Note
Deprecated. Use bookmark instead.
data-id=50532410_21206
data-id=pdlinkannot
PDLinkAnnot
Note
Deprecated. Use Link Annotation instead.
data-id=pdpage
PDPage
Note
Deprecated. Use page instead.
data-id=pdtextannot
PDTextAnnot
Note
Deprecated. Use Text Annotation instead.
data-id=50532410_29037
data-id=pdf-window
PDF Window
The area of the Acrobat or Acrobat Reader window that displays the contents of a page within the document. Corresponds to the Acrobat internal AvPageView object. A document that is not visible does not have a PDF Window.
Note
This object was formerly known as
AVPageView.
Elements
Properties
no vary, fit page, fit width, fit height, and fit visible width.Related methods
- go backward
- go forward
- goto
- goto next
- goto previous
- read page down
- read page up
- scroll
- select text
- zoom
data-id=50532410_17521
data-id=postscript-conversion
PostScript Conversion
A file type converter that exports PDF files into PostScript format.
Properties
Inherits other properties from conversion.
Related methods
data-id=50532410_22569
data-id=text-annotation
Text Annotation
A PDF text annotation (note) on a page in a PDF file. Can only be used as the target of a make event. All other access is via the annotation class.
Note
This object was formerly known as
TextAnnot.
Properties
Inherits from annotation.
Related methods
data-id=required-suite-events
Required suite events
The following events are sent by the Finder to all applications:
openprintquitrun
Note
Most of these events have counterparts in the Core suite that have greater functionality. The Required suite is not listed in the AppleScript dictionary, even though it is implemented.
Acrobat Reader also supports the Required suite events, but no others.
data-id=50532410_99533
data-id=open
open
Opens a file.
Syntax
open [reference]
Parameters
data-id=50532410_29870
data-id=print
Prints one or more files.
Syntax
print
[reference]
Parameters
data-id=50532410_37698
data-id=quit
quit
Terminates an application. For information on a variant event in the Core suite that accepts options, see quit.
Syntax
quit
data-id=50532410_40886
data-id=run
run
Launches the application and invokes its standard startup procedures.
Syntax
run
data-id=core-suite-events
Core suite events
Acrobat supports the following subset of the Core suite of Apple events:
closecountdeleteexistsgetmakemoveopenquitsaveset
data-id=50532410_39856
data-id=close
close
Closes a document.
Syntax
close
[reference] saving
[constant] linearize
[boolean]
Parameters
yes: Save the document. no: Do not save the document. ask: Ask the user whether to save the document. The default value is ask.Related events
data-id=50532410_16155
data-id=count
count
Counts the number of instances of a particular class.
Syntax
count
[type class] of
[reference]
Parameters
Note
There is an alternate form using the keyword
eachin which the parameters are reversed:
count
[reference] each
[type class]
Returns
An integer specifying the number of elements.
AppleScript example
count annotation of document "dev_acro.pdf"
count menu item of menu "View"
count document 1 each bookmark
data-id=50532410_41487
data-id=delete
delete
Deletes one or more objects.
Syntax
delete
[reference]
Parameters
Related events
AppleScript example
delete first bookmark of document "test.pdf"
data-id=50532410_24542
data-id=exists
exists
Tests whether a specified object exists.
Syntax
[reference] exists
exists
[reference]
Parameters
Returns
true if the object exists, false otherwise.
AppleScript example
exists second document
second document exists
data-id=50532410_32661
data-id=get
get
Retrieves the value of an object or property.
Syntax
get [reference] as [class]
Note
The keyword
getis optional.
Parameters
Returns
The value of the specified property or object. If the specified object does not exist, no result is returned.
Related events
AppleScript example
get the name of last bookmark
get the index of last bookmark as string
data-id=50532410_24328
data-id=make
make
Creates a new object.
Syntax
make
new [
type class] at
[location reference] with data
[anything] with properties
[record]
Parameters
Returns
A reference to the newly created object.
Related events
AppleScript example
set myAnnotation to make TextAnnotation at beginning
set name of myAnnotation to "Werner Heisenberg"
set contents of myAnnotation to "Might have been here"
data-id=50532410_34612
data-id=move
move
Moves a page object.
Syntax
move
[reference] to
[location reference]
Parameters
Returns
A reference to the page that is moved.
AppleScript example
move page 3 to before page 1
data-id=50532410_41641
data-id=open-1
data-id=id1
open
Opens a document or documents.
Syntax
open
[list of alias] invisible
[boolean] options
[string]
Parameters
false.Related events
data-id=50532410_14269
data-id=quit-1
data-id=id2
quit
Causes the Acrobat application to quit.
Syntax
quit
saving [constant]
Parameters
yes: Save the document. no: Do not save the document. ask: If the documents have been modified, ask the user whether to save them. The default value is ask.AppleScript example
quit saving yes
data-id=50532410_32794
data-id=save
save
Saves a document.
Syntax
save
[reference] to
[file specification] using
[reference] linearize[
boolean]
Parameters
to parameter is equivalent to doing a Save As. You can save a document in one of the supported formats with the using parameter.AppleScript example
save document 1 to file "MyHardDrive:tempBig.ps" using PostScript Conversion with embedded fonts, images, preview, and annotation without binary given postScript level: 1
data-id=50532410_41279
data-id=set
set
Sets an object’s data or properties.
Syntax
set
[reference] to
[anything]
Parameters
Related events
AppleScript example
set the name of first bookmark to "Chapter 1"
data-id=acrobat-application-events
Acrobat application events
This section describes a number of Acrobat API calls for the Apple event interface that are specific to Acrobat applications. The supported events in this suite are:
bring to frontclear selectionclose all docscreate thumbsdelete pagesdelete thumbsexecutefind next notefind textget infogo backwardgo forwardgotogoto nextgoto previousinsert pagesis toolbutton enabledmaximizeperformprint pagesread page downread page upremove toolbuttonreplace pagesscrollselect textset infozoom
Apple encourages the use of an application’s signature as the name of its class for application-specific Apple events. The string CARO is the name of the class for Acrobat-specific Apple events:
#define kAEAcrobatViewerClass 'CARO'
AppleScript does not need this information.
data-id=50532410_19936
data-id=bring-to-front
bring to front
Brings the specified document’s window to the front.
Syntax
bring to front
[reference]
Parameters
AppleScript example
bring to front document "AppleEvt.pdf"
Apple event ID
kAEBringToFront ('bfrt')
data-id=50532410_33043
data-id=clear-selection
clear selection
Clears the document’s current selection, if any.
Syntax
clear selection
[reference]
Parameters
Related events
AppleScript example
clear selection document "PLUGINS.PDF"
Apple event ID
kAEClearSelection ('clsl')
data-id=50532410_31136
data-id=close-all-docs
close all docs
Closes all documents.
Syntax
close all docs
saving
[constant]
Parameters
yes: Save the document. no: Do not save the document. ask: If the document has been modified, ask the user whether to save it. The default value is ask.Related events
AppleScript example
close all docs
Apple event ID
kAECloseAllDocs ('cldc')
data-id=50532410_15865
data-id=create-thumbs
create thumbs
Creates thumbnail images for all pages in the document.
Syntax
create thumbs
[reference]
Parameters
Related events
AppleScript example
create thumbs document "roadmap.pdf"
Apple event ID
kAECreateThumbs ('crtb')
data-id=50532410_15460
data-id=delete-pages
delete pages
Deletes the specified pages in the document.
Syntax
delete pages
[reference] first
[integer] last [
integer]
Parameters
Related events
AppleScript example
delete pages document "AppleEvt.pdf" first 1 last 3
Apple event ID
kAEDeletePages ('dlpg')
Apple event parameters
keyAEFirstPage ('frpg')
keyAELastPage ('lapg'')
data-id=50532410_29225
data-id=delete-thumbs
delete thumbs
Deletes all thumbnails from the document.
Syntax
delete thumbs
[reference]
Parameters
Related events
AppleScript example
delete thumbs document "AppleEvt.pdf"
Apple event ID
kAEDeleteThumbs ('dltb')
data-id=50532410_21312
data-id=execute
execute
Executes the specified menu item.
Syntax
execute
[reference]
Parameters
AppleScript example
activate
execute menu item "Open"
Apple event ID
kAEExecute ('exec')
data-id=50532410_15335
data-id=find-next-note
find next note
Finds and selects the next text note in a document.
Syntax
find next note
[reference] wrap around
[boolean]
Parameters
true, the search wraps around; otherwise it does not. The default value is false.Returns
The text annotation found.
Related events
AppleScript example
find next note document "dev_acro.pdf"
Apple event ID
kAEFindNextNote ('fnnt')
Apple event parameters
keyAEWrapAround ('wrar')
data-id=50532410_15620
data-id=find-text
find text
Finds text in a document.
Syntax
find text
[reference] string
[international text] case sensitive
[boolean] whole words
[boolean] wrap around
[boolean]
Parameters
false.false.true, the search wraps around; otherwise it does not. The default value is false.Related events
AppleScript example
find text document "PLUGINS.PDF" string "Develop" whole words true
Apple event ID
kAEFindText ('ftxt')
Apple event parameters
keyAESearchString ('sstr')
keyAECaseSensitive ('case')
keyAEWholeWordsOnly ('whwd')
keyAEWrapAround ('wrar')
data-id=50532410_19217
data-id=get-info
get info
Gets the value of the specified key in the document’s Info dictionary.
Syntax
get info
[reference] key
[international text]
Parameters
Info dictionary entry.Info dictionary key whose value is to be obtained. The predefined keys are: Creator, Producer, CreationDate, Author, Title, Subject, and Keywords. None of these is required in the PDF file.Returns
A string containing the specified key’s value, or an empty string if the key is not found.
AppleScript example
get info document "PLUGINS.PDF" key "CreationDate"
Apple event ID
kAEGetInfo ('gnfo')
Apple event parameters
keyAEInfoKey ('inky')
data-id=50532410_33904
data-id=go-backward
go backward
Goes to the previous view in the stored view history. Does nothing if the current view is the first view in the history.
Syntax
go backward
[reference]
Parameters
Related events
AppleScript example
go backward first PDF Window
Apple event ID
kAEGoBack ('gbck')
data-id=50532410_30533
data-id=go-forward
go forward
Goes to the next view in the stored view history. Does nothing if the current view is the last view in the history.
Syntax
go forward
[reference]
Parameters
Related events
AppleScript example
go forward first PDF Window
Apple event ID
kAEGoForward ('gfwd')
data-id=50532410_16433
data-id=goto
goto
Displays the page that has the specified page number.
Syntax
goto
[reference] page
[integer]
Parameters
Related events
AppleScript example
goto first PDF Window page 2
Apple event ID
kAEGotoPage ('gtpg')
Apple event parameters
keyAEPageNumber ('pg #')
data-id=50532410_24656
data-id=goto-next
goto next
Displays the next page after the one currently displayed in the PDF Window. Does nothing if the current page is the last page in the document.
Syntax
goto next
[reference]
Parameters
Related events
AppleScript example
goto next first PDF Window
Apple event ID
kAEGotoNextPage ('nxpg')
data-id=50532410_21200
data-id=goto-previous
goto previous
Displays the previous page before the one currently displayed in the PDF Window. Does nothing if the current page is the first page in the document.
Syntax
goto previous
[reference]
Parameters
Related events
AppleScript example
goto previous first PDF Window
Apple event ID
kAEGotoPrevPage ('pvpg')
data-id=50532410_35783
data-id=insert-pages
insert pages
Inserts one or more pages from one document into another.
Syntax
insert pages
[reference] after
[integer] from
[reference] starting with
[integer] number of pages
[integer] insert bookmarks
[boolean]
Parameters
true.Related events
AppleScript example
insert pages document "AppleEvt.pdf" after 2 from document "dev_acro.pdf" starting with 1 number of pages 4
Apple event ID
kAEInsertPages ('inpg')
Apple event parameters
keyAEInsertAfter ('inaf')
keyAESourceDoc ('srdc')
kAESourceStartPage ('stpg')
keyAENumPages ('nmpg')
keyAEInsertBookmarks ('inbm')
data-id=50532410_40528
data-id=is-toolbutton-enabled
is toolbutton enabled
Determines whether the specified toolbar button is enabled.
Syntax
is toolbutton enabled named
[international text]
Parameters
Returns
true if the toolbar button is enabled, false otherwise.
Related events
AppleScript example
is toolbutton enabled named "AcroSrch:Query"
Apple event ID
kAEIsToolButtonEnabled ('tben')
Apple event parameters
keyAEButtonname ('tbnm')
data-id=50532410_26208
data-id=maximize
maximize
Sets the document’s window size to either its maximum or original size.
Syntax
maximize
[reference] max size
[integer]
Parameters
true, the document’s window is set to full size. If false, the window is returned to its original size.AppleScript example
maximize document "AppleEvt.pdf" max size false
Apple event ID
kAEMaximize ('maxi')
Apple event parameters
keyAEMaxSize ('mxsz')
data-id=50532410_27016
data-id=perform
perform
Executes a bookmark’s or link annotation’s action.
Syntax
perform
[reference]
Parameters
AppleScript example
perform last bookmark
Apple event ID
kAEPerform ('prfm')
data-id=50532410_40027
data-id=print-pages
print pages
Prints one or more pages from a document without displaying a modal Print dialog box.
Syntax
print pages
[reference] first
[integer] last
[integer] PS Level
[integer] binary output
[boolean] shrink to fit
[boolean]
Parameters
false.false.AppleScript example
print pages document "AppleEvt.pdf" first 1 last 3 PS Level 2 binary output true shrink to fit true
Apple event ID
kAEPrintPages ('prpg')
Apple event parameters
keyAEFirstPage ('frpg')
keyAELastPage ('lapg')
keyAEPSLevel ('pslv')
keyAEBinaryOK ('binO')
keyAEShrinkToFit ('s2ft')
data-id=50532410_32063
data-id=read-page-down
read page down
Scrolls forward through the document by one screen.
Syntax
read page down
[reference]
Parameters
Related events
AppleScript example
read page down first PDF Window
Apple event ID
kAEReadPageDown ('pgdn')
data-id=50532410_37225
data-id=read-page-up
read page up
Scrolls backward through the document by one screen.
Syntax
read page up
[reference]
Parameters
Related events
AppleScript example
read page up first PDFPageWindow
Apple event ID
kAEReadPageUp ('pgup')
data-id=50532410_11291
data-id=remove-toolbutton
remove toolbutton
Removes the specified button from the toolbar.
Syntax
remove toolbutton named
[international text]
Parameters
Related events
AppleScript example
remove toolbutton named "ZoomIn"
Apple event ID
kAERemoveToolButton ('rmtb')
Apple event parameters
keyAEButtonname ('tbnm')
data-id=50532410_27808
data-id=replace-pages
replace pages
Replaces one or more pages in a document with pages from another document.
Syntax
replace pages
[reference] over
[integer] from
[reference] starting with
[integer] number of pages
[integer] merge notes
[boolean]
Parameters
true.Related events
AppleScript example
replace pages document "AppleEvt.pdf" over 2 from document "dev_acro.pdf" starting with 1 number of pages 4 merge notes false
Apple event ID
kAEReplacePages ('rppg')
Apple event parameters
keyAEDestStartPage ('dtpg')
keyAESourceDoc ('srdc')
keyAESourceStartPage ('stpg')
keyAENumPages ('nmpg')
keyAEMergeNotes ('mgnt')
data-id=50532410_21493
data-id=scroll
scroll
Scrolls the view of a page by the specified amount.
Syntax
scroll
[reference] X Amount
[integer] Y Amount
[integer]
Parameters
Related events
AppleScript example
scroll first PDFWindow X Amount 20 Y Amount 100
Apple event ID
kAEScroll ('scrl')
Apple event parameters
keyAEXDelta ('xdlt')
keyAEYDelta ('ydlt')
data-id=50532410_27478
data-id=select-text
select text
Selects text as specified by either character or word offsets.
Syntax
select text
[reference] from words
[list of integer] from chars
[list of integer]
Parameters
Related events
AppleScript example
repeat with i from 1 to 10
repeat with j from 1 to (10 - i)
select text from words {i, j}
end repeat
end repeat
Apple event ID
kAESetTextSelection ('stxs')
Apple event parameters
keyAEWordList ('fmwd')
keyAECharList ('fmch')
data-id=50532410_18444
data-id=set-info
set info
Sets the value of a specified key in the document’s Info dictionary
Syntax
set info
[reference] key
[international text] value
[international text]
Parameters
Info dictionary entry.Info dictionary key whose value is to be set.AppleScript example
set info document "PlugIns.pdf" key "Author"
value "Wolfgang Pauli"
Apple event ID
kAESetInfo ('snfo')
Apple event parameters
keyAEInfoKey ('inky')
keyAEInfoValue ('invl')
data-id=50532410_35096
data-id=zoom
zoom
Changes the zoom level of the specified PDF Window.
Syntax
zoom
[reference] to
[small real]
Parameters
AppleScript example
zoom first PDFWindow to 150
Apple event ID
kAEZoomTo ('zmto')
Apple event parameters
keyAEZoomFactor ('zmft')
data-id=miscellaneous-events
Miscellaneous events
Acrobat provides an Apple event that does not fall into one of the regular suites: do script
data-id=50532410_82140
data-id=do-script
do script
Executes the specified JavaScript script.
Syntax
do script
[international text] file
[alias]
Parameters
Returns
Result of JavaScript execution as text.
AppleScript example
do script MyJavaScriptFile.js