OmniGraffle 7 Omni Automation API

Alert • Application • Array • Audio • Audio.Alert • Calendar • Canvas • CanvasSizingMode • Color • ColorSpace • Console • Credentials • Crypto • Crypto.SHA256 • Crypto.SHA384 • Crypto.SHA512 • Data • DateComponents • Decimal • Device • DeviceType • Document • GraffleDocument • Email • Error • FilePicker • FileSaver • FileWrapper • FileWrapper.ReadingOptions • FileWrapper.Type • FileWrapper.WritingOptions • FillType • Form • Form.Field • Form.Field.Checkbox • Form.Field.Date • Form.Field.MultipleOptions • Form.Field.Option • Form.Field.Password • Form.Field.String • Formatter • Formatter.Date • Formatter.Decimal • Formatter.Duration • Formatter.Date.Style • Function • Graphic • Group • Subgraph • Table • Line • Solid • Shape • GraphicView • Grid • HierarchicalDirection • HopType • HorizontalAlignment • HorizontalTextAlignment • Image • ImageReference • ImageSizing • Layer • Layout • LayoutType • LineCap • LineJoin • LineType • Locale • MenuItem • NSWindow • Notification • OGOutlineNode • Pasteboard • Pasteboard.Item • PlugIn • PlugIn.Action • PlugIn.Handler • PlugIn.Handler.Registration • PlugIn.Library • Point • Portfolio • Preferences • Promise • Rect • Selection • ShapeCombination • SharePanel • Size • Speech • Speech.Boundary • Speech.Synthesizer • Speech.Utterance • Speech.Voice • Speech.Voice.Gender • Stencil • StringEncoding • StrokeDash • StrokeType • TextAutosizing • TextFlow • TimeZone • Timer • ToolbarItem • TypeIdentifier • URL • URL.Access • URL.Bookmark • URL.Components • URL.FetchRequest • URL.FetchResponse • URL.QueryItem • Version • VerticalAlignment • VerticalTextPlacement • XML • XML.Document • XML.Document.Configuration • XML.Element • XML.WhitespaceBehavior • XML.WhitespaceBehavior.Type

Alert

An alert interface for displaying information to the user, blocking further interaction until the alert is dismissed.

Constructors

new Alert(title: String, message: String)Alert

Create a new alert panel with the given title and text contents.

Instance Functions

function show(callback: Function(‍option: Number) or null)Promise of Number

Displays the alert. If no options have yet been added, a default “OK” option is added. Once the user selects an option, the alert is dismissed. If a callback function was supplied, it is invoked with the zero-based index of the selected option as its argument. A Promise is returned as well, which may also be used to collect the result of the Alert.

function addOption(string: String)

Adds an option button to the alert.

Application

An object representing the OmniGraffle application itself. The type of the global variable app.

Instance Functions

function openDocument(from: Document or null, url: URL, completed: Function(‍documentOrError: Document or Error, alreadyOpen: Boolean))

Attempts to open the specified document and return a reference to it asynchronously. If the document is already open, the reference is passed along. Note that due to platform sandboxing restrictions, opening the document may fail if the application doesn’t have currently permission to access the given URL. The document, if any, that is associated with the calling script can be passed along to help grant permission to open the new document. The passed in function will be passed two argument. The first will be either either the Document or an Error. On success, the second argument is a Boolean specifying whether the document was already open.

Instance Properties

var buildVersionVersion read-only

The internal build version number for the app. See also userVersion.

var commandKeyDownBoolean read-only

Whether the Command key is currently down.

var controlKeyDownBoolean read-only

Whether the Control key is currently down.

var nameString read-only

Application name.

var optionKeyDownBoolean read-only

Whether the Option key is currently down.

var platformNameString read-only

Returns a string describing the current platform, currently "iOS" or "macOS".

var shiftKeyDownBoolean read-only

Whether the Shift key is currently down.

var stencilsArray of Stencil read-only

List of stencils that OmniGraffle currently has available.

var userVersionVersion read-only

The user-visible version number for the app. See also buildVersion.

var versionString read-only

Deprecated: Recommend using either userVersion or buildVersion.

For backwards compatibility with existing scripts, this returns the same result as buildVersion.versionString. We recommend using either the user-visible userVersion or the internal buildVersion instead, which are more clear about which version they’re returning and provide their results as Version objects which can be semantically compared with other Version objects.

Array

The built-in JavaScript Array constructor.

Audio

Class Functions

function playAlert(alert: Audio.Alert or null, completed: Function(‍‍) or null)

Play the specified Audio.Alert. On macOS, if no alert is specified, the user’s default alert sound will be played. On iOS, there is no default alert sound and nothing will be done without specifying an alert.

Audio.Alert

Constructors

new Audio.Alert(url: URL)Audio.Alert

Calendar

Class Properties

var buddhistCalendar read-only

var chineseCalendar read-only

var copticCalendar read-only

var currentCalendar read-only

The user’s preferred calendar

var ethiopicAmeteAlemCalendar read-only

var ethiopicAmeteMihretCalendar read-only

var gregorianCalendar read-only

The Gregorian calendar.

var hebrewCalendar read-only

var indianCalendar read-only

var islamicCalendar read-only

var islamicCivilCalendar read-only

var islamicTabularCalendar read-only

var islamicUmmAlQuraCalendar read-only

var iso8601Calendar read-only

var japaneseCalendar read-only

var persianCalendar read-only

var republicOfChinaCalendar read-only

Instance Functions

function dateByAddingDateComponents(date: Date, components: DateComponents)Date or null

Returns a new Date by adding the given DateComponents, or null if no date could be calculated.

function dateFromDateComponents(components: DateComponents)Date or null

Returns a new Date from the given DateComponents, or null if no date could be calculated.

function dateComponentsFromDate(date: Date)DateComponents

Returns a new DateComponents for the given Date.

function dateComponentsBetweenDates(start: Date, end: Date)DateComponents

Returns the difference from the start Date to the end Date as a DateComponents.

function startOfDay(date: Date)Date

Returns a Date for the first moment of the day containing the given Date according to this Calendar.

Instance Properties

var identifierString read-only

The ISO identifier for the calendar.

var localeLocale or null read-only

The locale of the calendar.

var timeZoneTimeZone read-only

The time zone of the calendar.

Canvas

Instance Functions

function layout()

Perform automatic layout of all graphics on this canvas.

function layoutGraphics(graphics: Array of Graphic)

Perform automatic layout of only the given graphics (all of which need to be on this canvas).

function addShape(shapeName: String, bounds: Rect)Shape

Create a new graphic of a given shape and place it on the first visible and unlocked layer.

function newShape()Shape

Create a zero-sized rectangle (presumably to be modified further) and place it on the first visible and unlocked layer.

function newLayer()Layer

Create a new (top-most) layer.

function addLine(start: Point, end: Point)Line

Create a new line between two points and place it on the first visible layer.

function newLine()Line

Create a new zero-length line (presumably to be modified further) and place it on the first visible layer.

function addText(text: String, origin: Point)Solid

Create a new shape containing text (with no stroke or shadow) and place it on the first visible layer.

function connect(from: Graphic, to: Graphic)Line

Create a new line connecting two existing graphics.

function duplicate(graphics: Array of Graphic)Array of Graphic

Duplicate existing graphics onto new graphics placed upon this canvas. The original graphics may be from elsewhere - such as from another canvas, a stencil, or another document.

function orderBefore(model: Canvas)

Reorder this canvas to be before another canvas in this document.

function orderAfter(model: Canvas)

Reorder this canvas to be after another canvas in this document.

function remove()

Remove this canvas from the document, deleting it.

function graphicWithId(id: Number)Graphic or null

Get the graphic with the given id, if it exists on this canvas.

function graphicWithName(name: String)Graphic or null

Get the first graphic with the given name, if any. Note that most graphics do not have names unless they are explicitly set; instead they will be displayed using a placeholder string (such as “Rectangle”) in the outline.

function allGraphicsWithUserDataForKey(data: String, key: String)Array of Graphic

Get all graphics with the given data string for the user data key.

function graphicWithUserDataForKey(data: String, key: String)Graphic or null

Get the first graphic with the given data string for the user data key, if any.

function combine(shapes: Array of Shape, operation: ShapeCombination, replaceOriginal: Boolean or null)Shape or null

function onGraphicChanged(handler: PlugIn.Handler)PlugIn.Handler.Registration or null

A handler called when any graphic on this canvas changes any properties.

Instance Properties

var autosizesDownBoolean

Should the canvas automatically grow when graphics are added below the current bounds.

var autosizesLeftBoolean

Should the canvas automatically grow when graphics are added to the left of the current bounds.

var autosizesRightBoolean

Should the canvas automatically grow when graphics are added to the right of the current bounds.

var autosizesUpBoolean

Should the canvas automatically grow when graphics are added above the current bounds.

var backgroundSolid read-only

A solid graphic representing the canvas background. Its fill and image properties determine the canvas background appearance.

var canvasSizeIsMeasuredInPagesBoolean

var canvasSizingModeCanvasSizingMode

var columnAlignmentVerticalAlignment

Setting for how graphics ought to be aligned vertically.

var graphicsArray of Graphic read-only

All graphics upon this canvas.

var gridGrid read-only

Settings for the major and minor grids, if any.

var horizontalPagesNumber

Number of printer pages wide.

var idNumber read-only

A unique (within this document) identifying number for this canvas.

var layersArray of Layer read-only

All layers of this canvas.

var layoutInfoLayout read-only

The automatic layout information describing how graphics should be arranged.

var nameString

The title of this canvas.

var outlineRootOGOutlineNode read-only

Builds a model of all shapes in the canvas as a hierarchical outline (as in hierarchical auto layout) and returns the root of that outline.

var pageSizeSize read-only

Size of each page in points.

var rowAlignmentHorizontalAlignment

Setting for how graphics ought to be aligned horizontally.

var shapesArray of Shape read-only

var sizeSize

Overall size in points.

var spaceBetweenObjectsInColumnNumber

Setting for how graphics ought to be spaced out vertically.

var spaceBetweenObjectsInRowNumber

Setting for how graphics ought to be spaced out horizontally.

var verticalPagesNumber

Number of printer pages tall.

CanvasSizingMode

Class Properties

var FitCanvasSizingMode read-only

Resizes to fit its contents.

var FixedCanvasSizingMode read-only

Specific size in pages or in points.

var InfiniteCanvasSizingMode read-only

No specific size and no canvas edges.

var allArray of CanvasSizingMode read-only

Color

Class Functions

function RGB(r: Number, g: Number, b: Number, a: Number or null)Color

Makes a new color in the RGB colorspace, with the given components. If the alpha component is not given, 1.0 is used.

function HSB(h: Number, s: Number, b: Number, a: Number or null)Color

Makes a new color in the HSB colorspace, with the given components. If the alpha component is not given, 1.0 is used.

function White(w: Number, a: Number or null)Color

Makes a new color in the White colorspace, with the given components. If the alpha component is not given, 1.0 is used.

Class Properties

var blackColor read-only

A color in the White colorspace with white component of 0.0.

var blueColor read-only

A color in the RGB colorspace with components (0, 0, 1, 1).

var brownColor read-only

A color in the RGB colorspace with components (0.6, 0.4, 0.2, 1).

var clearColor read-only

A color in the White colorspace with white component of 0.0 and alpha of 0.0 (“transparent black”).

var cyanColor read-only

A color in the RGB colorspace with components (0, 1, 1, 1).

var darkGrayColor read-only

A color in the White colorspace with white component of 0.333.

var grayColor read-only

A color in the White colorspace with white component of 0.5.

var greenColor read-only

A color in the RGB colorspace with components (0, 1, 0, 1).

var lightGrayColor read-only

A color in the White colorspace with white component of 0.667.

var magentaColor read-only

A color in the RGB colorspace with components (1, 0, 1, 1).

var orangeColor read-only

A color in the RGB colorspace with components (1, 0.5, 0, 1).

var purpleColor read-only

A color in the RGB colorspace with components (1, 0, 1, 1).

var redColor read-only

A color in the RGB colorspace with components (1, 0, 0, 1).

var whiteColor read-only

A color in the White colorspace with white component of 1.0.

var yellowColor read-only

A color in the RGB colorspace with components (1, 1, 0, 1).

Instance Functions

function blend(otherColor: Color, fraction: Number)Color or null

Returns a new color that is a linear combination of the receiver and fraction of the other color (so, a fraction of 1.0 would just return the otherColor. If the colors cannot be blended (for example, if they cannot be converted to the same colorspace), then null is returned.

Instance Properties

var alphaNumber read-only

Returns the alpha component of the color.

var blueNumber read-only

Returns the blue component of the color, after converting to a RGB colorspace.

var brightnessNumber read-only

Returns the brightness component of the color, after converting to a HSB colorspace.

var colorSpaceColorSpace read-only

Returns the colorspace of the instance.

var greenNumber read-only

Returns the green component of the color, after converting to a RGB colorspace.

var hueNumber read-only

Returns the hue component of the color, after converting to a HSB colorspace.

var redNumber read-only

Returns the red component of the color, after converting to a RGB colorspace.

var saturationNumber read-only

Returns the saturation component of the color, after converting to a HSB colorspace.

var whiteNumber read-only

Returns the white component of the color, after converting to a White colorspace.

ColorSpace

Class Properties

var CMYKColorSpace read-only

A colorspace with cyan, magenta, yellow, black, and alpha components.

var HSBColorSpace read-only

A colorspace with hue, saturation, and value (or brightness) components.

var NamedColorSpace read-only

A space for named colors, like system defined colors, or specific color palette spaces.

var PatternColorSpace read-only

A colorspace that wraps a pattern image.

var RGBColorSpace read-only

The sRGB colorspace with red, green, blue, and alpha components.

var WhiteColorSpace read-only

A colorspace with white and alpha components.

var allArray of ColorSpace read-only

Console

The Console allows scripts to log debugging, warning, or error information where it can be viewed in the system console or in the console output area. A single instance of Console is available to scripts as the console global variable.

Instance Functions

function log(message: Object, additional: Array of Object or null)

Appends a line to the application console formed by concatenating the given message (after converting it to a String), any additional arguments separated by spaces, and finally a newline.

function error(message: Object, additional: Array of Object or null)

function info(message: Object, additional: Array of Object or null)

function warn(message: Object, additional: Array of Object or null)

Just calls Console.log, currently.

function clear()

Clears the console in the user-visible window.

Credentials

The Credentials class allows storage of private username and password pairs, URL.Bookmark instances, and possibly other sensitive information in the future. Instances are tied to a single plug-in and single application, and may only be created in plug-ins when they are being loaded.

For example, when a PlugIn.Action is being created, you could use the following pattern:

 (() => {
     let credentials = new Credentials();

     var action = new PlugIn.Action(function(selection) {
         // ... use the captured credentials ...
     });

     return action;
 })();

Attempts to create Credential instances elsewhere will throw an error. Care should be taken to store instances in anonymous closures as above, and not pass them to or store them on other objects.

Credentials are keyed off a service identifier, which your plug-in can define however it likes.

Constructors

new Credentials()Credentials

Creates a new Credentials instance for the currently loading plug-in. Throws an error if called outside of plug-in loading.

Instance Functions

function read(service: String) → Object or null

Looks up the current credentials for a given service identifier. If credentials have previously been stored, an object will be returned containing "user" an "password" properties.

function write(service: String, username: String, password: String)

Creates or updates an existing credential, storing the username and password for this service securely in the Keychain.

function remove(service: String)

Deletes any currently stored credentials for the specified service, either a username and password or a URL bookmark.

function readBookmark(service: String)URL.Bookmark or null

Reads the entry for the given service identifier and attempts to return it as a URL.Bookmark, or null if no such entry exists.

function writeBookmark(service: String, bookmark: URL.Bookmark)

Stores the URL.Bookmark persistently for later access.

Crypto

Crypto provides access to some of Apple’s CryptoKit

Class Functions

function randomData(length: Number)Data

Copy length bytes of cryptographically secure random data.

Crypto.SHA256

The SHA–256 hash function.

Constructors

new Crypto.SHA256()Crypto.SHA256

Create a new SHA–256 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize()Data

Finalize any remaining digest process and return the result of the hash function.

Crypto.SHA384

The SHA–384 hash function.

Constructors

new Crypto.SHA384()Crypto.SHA384

Create a new SHA–384 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize()Data

Finalize any remaining digest process and return the result of the hash function.

Crypto.SHA512

The SHA–512 hash function.

Constructors

new Crypto.SHA512()Crypto.SHA512

Create a new SHA–512 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize()Data

Finalize any remaining digest process and return the result of the hash function.

Data

A generic bag of bytes. Mainly useful to be interpreted / converted to some other type.

Class Functions

function fromString(string: String, encoding: StringEncoding or null)Data

Convert the string to a Data using the given encoding, or UTF8 if none is specified.

function fromBase64(string: String)Data

Instance Functions

function toString(encoding: StringEncoding or null)String

Convert to a String, assuming that this Data using the specified encoding, or UTF8 if none is given.

function toBase64()String

Convert to a Base–64 encoded string.

Instance Properties

var lengthNumber read-only

Number of bytes in this data.

var toObjectObject or null read-only

DateComponents

Constructors

new DateComponents()DateComponents

Instance Properties

var dateDate or null read-only

var dayNumber or null

var eraNumber or null

var hourNumber or null

var minuteNumber or null

var monthNumber or null

var nanosecondNumber or null

var secondNumber or null

var timeZoneTimeZone or null

var yearNumber or null

Decimal

The Decimal class provides support for operating on base–10 numbers, which may not be exactly representable by types like the built-in JavaScript Number class. Note that Decimal does not use the built-in arithmetic operations; for example, to add two Decimal instances, you must use the add() function.

Class Functions

function fromString(string: String)Decimal

Parses the given string into a Decimal. If the string cannot be parsed, notANumber is returned.

Class Properties

var maximumDecimal read-only

Returns the maximum representable Decimal value.

var minimumDecimal read-only

Returns the minimum representable Decimal value.

var notANumberDecimal read-only

Returns a Decimal that represents a non-number value. Any arithmetic operations involving non-number values will return notANumber.

var oneDecimal read-only

Returns a Decimal representing one.

var zeroDecimal read-only

Returns a Decimal representing zero.

Instance Functions

function toString()String

Converts the Decimal to a String representation.

function add(number: Decimal)Decimal

Generates a new Decimal by adding the argument and the receiver.

function subtract(number: Decimal)Decimal

Generates a new Decimal by subtracting the argument from the receiver.

function multiply(number: Decimal)Decimal

Generates a new Decimal by multiplying the argument and the receiver.

function divide(number: Decimal)Decimal

Generates a new Decimal by dividing the receiver by the argument.

function compare(number: Decimal)Number

Compares the receiver and argument. If the receiver is less than the argument, –1 is returned. If the receiver is greater than the argument, 1 is returned. Otherwise, 0 is returned. notANumber is considered less than any valid number, and equal to itself.

function equals(number: Decimal)Boolean

Returns true if the receiver and argument represent the same number (or both are notANumber), and false otherwise.

Device

Class Properties

var currentDevice read-only

The device the current application is running on.

Instance Properties

var iOSBoolean read-only

A convenience that returns true on iPhone and iPad devices

var iPadBoolean read-only

A convenience that returns true only on iPad devices, but not on iPhone devices.

var macBoolean read-only

A convenience that returns true only on Mac devices.

var operatingSystemVersionVersion read-only

The current operation system version running on the device

var typeDeviceType or null read-only

The general type of the current device

var visionProBoolean read-only

A convenience that returns true only on Apple Vision Pro devices.

DeviceType

Class Properties

var allArray of DeviceType read-only

var iPadDeviceType read-only

An iPad

var iPhoneDeviceType read-only

An iPhone

var macDeviceType read-only

A Mac device

var visionProDeviceType read-only

An Apple Vision Pro

Document

Class Functions

function makeNew(resultFunction: Function(‍document: Document or Error) or null)Promise of Document

Create a new document, which can be populated with data and then presented. On iOS, if the document is not presented by the time the resultFunction returns, it will be closed. On macOS, the document will be left around and accessible to the running script. resultFunction is executed before any functions tethered to the result Promise are executed. Returns a Promise that will yield the new document or an error.

function makeNewAndShow(resultFunction: Function(‍document: Document or Error) or null)Promise of Document

Create a new document and presents it. Returns a Promise that will yield the new document or an error.

Instance Functions

function close(didCancel: Function(‍document: Document) or null)

Close this document. If for some reason the document cannot be closed, the didCancel function may be called at some point in the future, with the original document as the single argument. For example, on the Mac the user may review unsaved changes and may cancel the close operation. If the document is closed, the didCancel function will not be called at all.

function save()

Save this document.

function fileWrapper(type: String or null)FileWrapper

Deprecated: Please use makeFileWrapper() instead. Returns a new FileWrapper representing the contents of the document formatted as the specified type, or its current fileType if a null is passed for the type.

function makeFileWrapper(baseName: String, type: String or null)Promise of FileWrapper

Generates a FileWrapper representing the contents of the document formatted as the specified type, or its current fileType if a null is passed for the type. Returns a Promise that will yield the file wrapper or an error. The returned file wrapper will have a name based off the given baseName and the default path extension for the requested file type.

function undo()

Undo the last done action.

function redo()

Redo the last undone action.

function show(completed: Function(‍‍) or null)

Presents the document, ordering the window forward on macOS, and possibly closing the existing document and opening the new on on iOS. Calls the completion function once the document is shown.

Instance Properties

var canRedoBoolean read-only

Whether there are currently any actions that can be redone.

var canUndoBoolean read-only

Whether there are currently any actions that can be undone.

var fileTypeString or null read-only

The file type identifier the document uses when saving, if set.

var nameString or null read-only

Document name.

var writableTypesArray of String read-only

A list of all of the file types that this document can be written as.

GraffleDocument : Document

An OmniGraffle document.

Instance Functions

function addLocalizations(text: String)

Instance Properties

var portfolioPortfolio read-only

var windowsArray of NSWindow read-only

Email

A set of parameters for generating an email.

Constructors

new Email()Email

Instance Functions

function generate()

Presents the generated email to the user for them to send (or discard). On iOS, any included attachment FileWrappers that are directories will be converted to Zip files.

Instance Properties

var blindCarbonCopyString or Array of String or null

var bodyString or null

var carbonCopyString or Array of String or null

var fileWrappersArray of FileWrapper

var receiverString or Array of String or null

var subjectString or null

Error

The built-in JavaScript Error constructor.

Instance Properties

var causedByUserCancellingBoolean read-only

Returns true for errors that are caused by the user cancelling an operation. For example, if the user selects the Cancel button in a FilePicker, the Promise will signal an error that reflects this.

FilePicker

A FilePicker allows the user to select URLs for files via the system-supplied file picking interface.

Constructors

new FilePicker()FilePicker

Returns a new FilePicker with default settings.

Instance Functions

function show()Promise of Array of URL

Presents the system file selection interface to the user, allowing them to choose one or more files of the given types. The returned Promise will yield the chosen URLs on success. If the user cancels chosing, the Promise will be rejected. Note that even when picking a single file or folder, the result will be an array of URLs.

Instance Properties

var foldersBoolean

If true, then folders may be selected, but not files. In this case, types is ignored. Defaults to false.

var messageString

A message to display describing what files are being picked. This is currently only supported on macOS.

var multipleBoolean

If true, then multiple files may be selected. Defaults to false.

var typesArray of TypeIdentifier or null

The file types that will be allowed. If null, all file types will be allowed. Defaults to null.

FileSaver

A FileSaver allows the user to save a FileWrapper to a URLs via the system-supplied file picking interface.

Constructors

new FileSaver()FileSaver

Returns a new FileSaver with default settings.

Instance Functions

function show(fileWrapper: FileWrapper)Promise of URL

Presents the system file saving interface to the user, allowing them to choose a location and file name to save the file wrapper. The returned Promise will yield the chosen URL on success. If the user cancels chosing, the Promise will be rejected.

Instance Properties

var messageString

A message to display describing what file is being saved. This is currently only supported on macOS.

var nameLabelString

The label shown next to the user-editable file name field. This is currently only supported on macOS.

var promptString

The prompt shown on the the save button. This is currently only supported on macOS.

var typesArray of TypeIdentifier or null

The file types that will be allowed. If null, all file types will be allowed. Defaults to null.

FileWrapper

Class Functions

function withContents(name: String or null, contents: Data)FileWrapper

Returns a new FileWrapper that represents a flat file containing the given data.

function withChildren(name: String or null, children: Array of FileWrapper)FileWrapper

Returns a new FileWrapper that represents a directory with the given child file wrappers. Each child file wrapper must have a unique name specified.

function fromURL(url: URL, options: Array of FileWrapper.ReadingOptions or null)FileWrapper

Reads a FileWrapper from an existing URL.

Instance Functions

function childNamed(name: String)FileWrapper or null

Returns the child file wrapper with the specified name, or null if the receiver is not a directory or doesn’t have a child with that name.

function filenameForChild(child: FileWrapper)String or null

Returns the unique file name that will be used for the given child FileWrapper, or null if this file wrapper is not a child of the receiver.

function write(url: URL, options: Array of FileWrapper.WritingOptions or null, originalContentsURL: URL or null)

Writes the FileWrapper to the given URL. NOTE: Any existing file or folder at the desination URL will be replaced. Care must be taken when developing scripts to avoid unintended data loss.

Instance Properties

var childrenArray of FileWrapper read-only

Returns an Array of child FileWrappers, if this represents a directory. Otherwise, an empty array is returned.

var contentsData or null read-only

Returns the regular file contents of the wrapper, if this represents a regular file. Otherwise, null is returned.

var destinationURL or null read-only

Returns the destination if this represents a symbolic link. Otherwise, null is returned.

var filenameString or null

Returns the actual file name that was last read for this file wrapper. Depending on the names of other sibling wrappers, this may not be what file name will be written.

var preferredFilenameString or null

Returns the preferred file name that should be used when writing the file wrapper if no other file in the same parent directory wrapper is in use.

var typeFileWrapper.Type read-only

Returns the type of this FileWrapper.

FileWrapper.ReadingOptions

Class Properties

var ImmediateFileWrapper.ReadingOptions read-only

Whether the contents are read immediately, or (by default) as the file wrappers are accessed.

var WihtoutMappingFileWrapper.ReadingOptions read-only

Allow disabling file mapping.

var allArray of FileWrapper.ReadingOptions read-only

FileWrapper.Type

Class Properties

var DirectoryFileWrapper.Type read-only

A FileWrapper that represents a directory with zero or more child wrappers.

var FileFileWrapper.Type read-only

A FileWrapper that represents a regular file with data contents.

var LinkFileWrapper.Type read-only

A FileWrapper that represents a symbolic link to another location.

var allArray of FileWrapper.Type read-only

FileWrapper.WritingOptions

Class Properties

var AtomicFileWrapper.WritingOptions read-only

Write the entire FileWrapper atomically, so that either the entire file package is replaced or none of it is.

var UpdateNamesFileWrapper.WritingOptions read-only

On successful writing, update the filename of each file wrapper recursively so that following writes can use performance optimizations using hard links.

var allArray of FileWrapper.WritingOptions read-only

FillType

Class Properties

var EvenOddFillType read-only

Even/odd rule Solid.

var GradientFillType read-only

Gradient.

var LinearFillType read-only

Linear Gradient.

var MarkerFillType read-only

Marker.

var NoneFillType read-only

No Fill.

var PlasticFillType read-only

Plastic.

var RadialFillType read-only

Radial Gradient.

var SolidFillType read-only

Solid.

var SquiggleFillType read-only

Squiggle.

var StippleFillType read-only

Stipple.

var allArray of FillType read-only

Form

Form provides a mechanism to collect input from the user. Each form contains one or more instances of subclasses of Field, which are given a key. As the form is filled out, values object is populated with the values from the user interface.

Constructors

new Form()Form

Instance Functions

function addField(field: Form.Field, index: Number or null)

Adds the new Field to the Form, at the indicated position, or at the end if no position is specified. If the field has a default value, it will be added to the values result object immediately.

function removeField(field: Form.Field)

Removes the Field from theForm. Any entry in thevalues` for this field will be removed as well.

function show(title: String, confirmTitle: String)Promise of Form

Present the Form to the user, and return a Promise to be fullfilled or rejected when the user commits or cancels the form.

Instance Properties

var fieldsArray of Form.Field read-only

The current Field instances in the form, which will be visible to the user entering input.

var validateFunction(‍Form: Form)Boolean or null

A function to check whether the entered values are acceptable. The form to validate is passed as the argument and the function is expected to return a boolean result or null to perform default validation. If an Error is thrown, it’s message will be displayed in the form as the reason for validation failure. Note that the validation function may add or remove fields and update entries in the values object (which will cause the interface to be updated). This is called any time the user edits values, or a field is added or removed. If no validate function is specified or it returns null, some per-field default validation will be performed (see Form.Field.Option. If the validate function returns a boolean result, no default validation will be performed.

var valuesObject read-only

An object with the collected values for each field, stored under the key for that field.

Form.Field

A single entry for a user input value in a Form. Each field can only be added to a single Form. This class cannot be constructed directly.

Instance Properties

var displayNameString or null read-only

Human readable string used as the label for this field.

var keyString read-only

Key to use when storing the value for this field in the containing form’s values object.

Form.Field.Checkbox : Form.Field

Constructors

new Form.Field.Checkbox(key: String, displayName: String or null, value: Boolean or null)Form.Field.Checkbox

Returns a new Checkbox field, optionally with an initial value (which will be false if no value is specified).

Form.Field.Date : Form.Field

Constructors

new Form.Field.Date(key: String, displayName: String or null, value: Date or null, formatter: Formatter.Date or null)Form.Field.Date

Returns a new Date field, optionally with an initial value, and optionally a date formatter. If no formatter is specified, a default one will be created that follows the user’s date formatting preferences to display and determine component ordering when parsing dates. Relative dates like “1d”, “tomorrow”, “now” can also be entered.

Form.Field.MultipleOptions : Form.Field

Constructors

new Form.Field.MultipleOptions(key: String, displayName: String or null, options: Array of Object, names: Array of String or null, selected: Array of Object)Form.Field.MultipleOptions

Returns a new MultipleOptions field, allowing the user to pick multiple items from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An array of zero or more initially selected objects (which must be members of the options array) may also be given. An empty array is valid input for the initially selected items. Additionally, it is valid for MultipleOptions fields to have a value that is an empty array.

Form.Field.Option : Form.Field

Constructors

new Form.Field.Option(key: String, displayName: String or null, options: Array of Object, names: Array of String or null, selected: Object or null, nullOptionTitle: String or null)Form.Field.Option

Returns a new Option field, allowing the user to pick from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An initially selected object (which must be a member of the options array) may also be given. If the field is not configured to allow a null value and no initially selected value is specified, the user must select a value before the field is considered valid under the default form validation.

Instance Properties

var allowsNullBoolean

If set to true, an option will be added to allow selecting null.

var nullOptionTitleString or null

If null is allowed, this will be used for the title of that option. Otherwise a default title will be used.

Form.Field.Password : Form.Field

A field for text-based input, optionally using a Formatter to convert the string value into a different type.

Constructors

new Form.Field.Password(key: String, displayName: String or null, value: String or null)Form.Field.Password

Returns a new Password field, optionally with an initial value. The displayed text will be obscured.

Form.Field.String : Form.Field

A field for text-based input, optionally using a Formatter to convert the string value into a different type.

Constructors

new Form.Field.String(key: String, displayName: String or null, value: Object or null, formatter: Formatter or null)Form.Field.String

Returns a new String field, optionally with an initial value and formatter. If a formatter is specified, the value should be of the output type from the formatter or null. If no formatter is specified, the value should be a string or null.

Formatter

Formatter.Date : Formatter

Class Functions

function withStyle(dateStyle: Formatter.Date.Style, timeStyle: Formatter.Date.Style or null)Formatter.Date

A formatter that will display dates according to the specified date and time formats selected in system settings.

function withFormat(format: String)Formatter.Date

Returns a formatter with a specific ICU date format and the user’s current locale, calendar, and timeZone. See http://userguide.icu-project.org/formatparse/datetime/ for details on date format strings.

Class Properties

var iso8601Formatter.Date read-only

Return a date formatter that produces ISO–8601 formatted dates, using the Gregorian calendar and the UTC time zone.

Instance Functions

function stringFromDate(date: Date)String

function dateFromString(string: String)Date or null

Instance Properties

var calendarCalendar

var dateFormatString read-only

var localeLocale

var timeZoneTimeZone

Formatter.Decimal : Formatter

This formatter class formats and parses Decimal-valued strings (note, not Number values).

Class Functions

function currency(code: String or null)Formatter.Decimal

Returns a new formatter that will display the value as a currency value. An ISO currency code may be specified to pick a specific currency, or null may be passed to use the default currency for the user’s locale. If the argument is not a valid currency code, an error will be thrown.

Class Properties

var currencyCodesArray of String read-only

Deprecated: Please use the currencyCode property on Locale instead. Returns the list of known ISO currency codes

var customFormatter.Decimal read-only

Returns a new formatter that can be configured with custom settings.

var decimalFormatter.Decimal read-only

Returns a new number formatter that will use both a decimal separator.

var percentFormatter.Decimal read-only

Returns a new number formatter that will display the value as a percentage.

var percentWithDecimalFormatter.Decimal read-only

Returns a new number formatter that will display the value as a percentage with a decimal separator.

var plainFormatter.Decimal read-only

Returns a new number formatter that will not use any separators.

var thousandsAndDecimalFormatter.Decimal read-only

Returns a new number formatter that will use both a thousands and decimal separator.

Instance Functions

function stringFromDecimal(number: Decimal)String or null

Format a Decimal as a string, based on the rules set on the formatter.

function decimalFromString(string: String)Decimal or null

Parses a Decimal from a string, based on the rules set on the formatter. Returns null if the value was not recognized.

Instance Properties

var decimalSeparatorString

The string to display between the whole portion of a number and the decimal portion.

var negativeFormatString

A format string to use for negative values.

var positiveFormatString

A format string to use for positive values.

var thousandsSeparatorString or null

The string to display between groups of digits representing powers of a thousand.

var zeroSymbolString or null

The string to use when displaying a zero value. If this is null, the positiveFormat is used.

Formatter.Duration : Formatter

Constructors

new Formatter.Duration()Formatter.Duration

Instance Functions

function stringFromDecimal(number: Decimal)String or null

function decimalFromString(string: String)Decimal or null

Instance Properties

var hoursPerDayNumber

var hoursPerWeekNumber

var useVerboseFormatBoolean

Formatter.Date.Style

Class Properties

var FullFormatter.Date.Style read-only

Use the user’s “full” format as selected in system settings.

var LongFormatter.Date.Style read-only

Use the user’s “long” format as selected in system settings.

var MediumFormatter.Date.Style read-only

Use the user’s “medium” format as selected in system settings.

var ShortFormatter.Date.Style read-only

Use the user’s “short” format as selected in system settings.

var allArray of Formatter.Date.Style read-only

Function

The built-in JavaScript Function constructor.

Graphic

An individual graphic element on a canvas. Graphic is an abstract superclass (that is, no actual Graphic objects exist, only more specialized sub-types of Graphic such as Line and Shape).

Instance Functions

function orderAbove(graphic: Graphic)

Reorder this graphic so that it is just above the given one.

function orderBelow(graphic: Graphic)

Reorder this graphic so that it is just below the given one.

function remove()

Remove this graphic from its canvas, deleting it.

function setUserData(key: String, value: String or null)

Set the user data string attached to this graphic for a given key.

function duplicateTo(location: Point, canvas: Canvas or null)Graphic or null

A convenience method, this does the same thing as canvas.duplicate() and then setting the geometry origin of the newly duplicated graphic. The destination canvas parameter can be omitted entirely in order to make a duplicate of the graphic to a different location of the same canvas it is already on.

function duplicateReferenceTo(location: Point, canvas: Canvas or null)Graphic or null

Similar to duplicateTo(), but the newly created graphic will be a reference to this one, instead of a standalone copy.

Instance Properties

var actionURLURL or null

URL to be opened when this graphic is clicked/tapped with the action tool or in presentation mode.

var alignsEdgesToGridBoolean

Align edges or center to the grid.

var allowsConnectionsBoolean

Allow line connections to this graphic.

var automationActionArray of String

An array of two strings, the first being the plugin id and the second being the action id for an automation action. This automation action is performed when this graphic is clicked/tapped with the action tool or in presentation mode.

var connectedLinesArray of Line read-only

An array of all Line graphics connected to this graphic.

var cornerRadiusNumber

Corner radius of the stroke.

var flippedHorizontallyBoolean

Is this graphic flipped horizontally?

var flippedVerticallyBoolean

Is this graphic flipped vertically?

var geometryRect

The bounds rectangle of this graphic.

var idNumber read-only

A unique identifier (within this canvas) of this graphic. Note that this value is NOT persistent across closing/reopening of the document.

var incomingLinesArray of Line read-only

A subset of the connected lines: those lines whose head are connected to this graphic.

var layerLayer or null

The layer this graphic is on.

var lockedBoolean

Whether this graphic is locked.

var nameString or null

The name of this graphic, if any. Note that most graphics do not have names unless they are explicitly set; instead they will be displayed using a placeholder string (such as “Rectangle”) in the outline.

var notesString

Notes attached to this graphic.

var outgoingLinesArray of Line read-only

A subset of the connected lines: those lines whose tail are connected to this graphic.

var plasticCurveNumber or null

If the stroke style is plastic, this is the depth of curvature.

var plasticHighlightAngleNumber or null

If the stroke style is plastic, this is the highlight angle of the “light” shining on the plastic.

var referenceGraphicGraphic or null read-only

The graphic that this one is a reference of.

var referenceInstancesArray of Graphic read-only

An array of all graphics that are references to this graphic.

var rotationNumber

Rotation of this graphic.

var shadowColorColor or null

Color of the shadow.

var shadowFuzzinessNumber

Fuzziness of the shadow.

var shadowVectorPoint

Direction and length of the shadow.

var strokeCapLineCap

Type of end cap on the stroke.

var strokeColorColor or null

Color of the stroke.

var strokeJoinLineJoin

Type of join on segments of the stroke.

var strokePatternStrokeDash

Dash pattern of the stroke.

var strokeThicknessNumber

Thickness of the stroke in points.

var strokeTypeStrokeType or null

Type of stroke (the outline around the graphic).

var userData → Object

User data for this graphic

Group : Graphic

A set of grouped graphics represented by a single graphic. Groups can contain more groups, et cetera.

Constructors

new Group(graphics: Array of Graphic)Group

Construct a new group containing the given graphics and replace those graphics on their original canvas with the group graphic.

Instance Functions

function ungroup()Array of Graphic

Remove this group, putting all of the graphics inside back on the canvas the group was previously upon. The group itself is deleted.

Instance Properties

var connectToGroupOnlyBoolean

Whether lines may connect to individual constituents or must connect to the group as a whole.

var graphicsArray of Graphic read-only

An array of graphics contained inside the group.

var magnetsArray of Point

Connection magnets on the group.

Subgraph : Group

A ‘Subgraph’ is a type of ‘Group’ that can be expanded and collapsed to show or hide its contents.

Constructors

new Subgraph(graphics: Array of Graphic)Group

Instance Properties

var backgroundSolid read-only

The background graphic which is shown behind the contents when expanded, and by itself when collapsed.

var collapsedBoolean

Whether this subgraph is currently collapsed.

var subgraphicsArray of Graphic read-only

An array of graphics contained inside the subgraph.

Table : Group

A ‘Table’ is a type of ‘Group’ where the graphics inside aren’t arranged arbitrarily, but are instead in fixed rows and columns.

Class Functions

function withRowsColumns(rows: Number, columns: Number, graphics: Array of Graphic)Table

Constructors

new Table(graphic: Graphic)Table

Instance Functions

function graphicAt(row: Number, column: Number)Graphic or null

Retrieve the contained graphic at the given row and column index.

function setRowHeight(pts: Number, ofRow: Number)

Change the height of all graphics in the given row index so that the row itself is the new height.

function setColumnWidth(pts: Number, ofColumn: Number)

Change the width of all graphics in the given column index so that the column itself is the new width.

Instance Properties

var columnsNumber

Number of columns in the table.

var rowsNumber

Number of rows in the table.

Line : Graphic

A graphic which is a line, potentially connecting two other graphics at its head and tail ends.

Class Properties

var allLineEndingTypesArray of String read-only

Instance Properties

var bezierPointsArray of Point

Array of bezier control points, or empty for non-bezier lines. Each line point is first, followed by its control points. The first and last line point have a single control point, while any intermediate line points have two control points.

var headGraphic or null

Graphic attached to the head of this line.

var headMagnetNumber

Index of the magnet in the head graphic which this line is connected to. Zero if not any particular magnet.

var headScaleNumber

Scale of the line ending at the head end of this line.

var headTypeString

Type of line ending at the head end of this line.

var hopTypeHopType

Style and behavior of line hops when this line passes over any other line on this canvas.

var lineLengthNumber read-only

The overall length of this line. The value you’d get from using the Line Length text tag in a label for this line.

var lineTypeLineType

Line type of this line. (Straight, Curved, Orthogonal, Bezier.)

var pointsArray of Point

Array of control points for this line in canvas coordinates.

var tailGraphic or null

Graphic attached to the tail of this line.

var tailMagnetNumber

Index of the magnet in the tail graphic which this line is connected to. Zero if not any particular magnet.

var tailScaleNumber

Scale of the line ending at the tail end of this line.

var tailTypeString

Type of line ending at the tail end of this line.

Solid : Graphic

A solid graphic is one that potentially has a fill, image, and text - as opposed to a ‘Line’, which has only a stroke. Almost all solid graphics will actually be the subclass ‘Shape’, but a canvas background is a ‘Solid’ without being a ‘Shape’.

Instance Properties

var autosizingTextAutosizing

Autosizing behavior of the graphic when the text size changes.

var fillColorColor or null

Color of the fill for this graphic.

var fillTypeFillType or null

Style of fill for this graphic.

var fontNameString

Font of text in this graphic. This is the Font’s “Postscript name”, as displayed in the Font Book application’s Font Info pane on the Mac. Where there are multiple fonts, this returns the first character’s font. Setting this value sets it for all text in the graphic.

var gradientAngleNumber

For linear gradients, the angle at which the gradient is drawn.

var imageImageReference or null

Image fill for this graphic, if any.

var imageOffsetPoint

Positioning offset of the image fill. This is the difference between the image origin and the graphic origin in percentage terms.

var imageOpacityNumber

Opacity percentage for the image fill for this graphic.

var imagePageNumber

Page number to display for the given image, if relevant. Mainly useful for PDF images, which are potentially multiple pages.

var imageScaleSize

Scaling of the image fill. This is a multiplier between the displayed size and original image size.

var imageSizingImageSizing

Type of sizing behavior for the image, if any.

var magnetsArray of Point

Array of connection magnets for this graphic.

var textString

Text contents of this graphic.

var textAlongPathGlyphAnchorNumber

text-on-path glyph placement anchor; 0 = glyph anchored at bottom center (this is how text-on-path works in OmniGraffle 7.10 and later), 1 = glyph anchored at bottom left (this is how text-on-path works in OmniGraffle 7.9.3 and previous)

var textColorColor

Color of the text in this graphic. Where there are multiple colors, this returns the first character’s color. Setting this value sets it for all text in the graphic.

var textFlowTextFlow

Text flow behavior of the graphic.

var textGeometryRect read-only

Drawing bounds of the text in canvas coordinates.

var textHorizontalAlignmentHorizontalTextAlignment

Alignment of the text in this graphic horizontally.

var textHorizontalPaddingNumber

Horizontal padding between the edge of the graphic’s bounds and the edge of the text area where text is drawn.

var textRotationNumber

Rotation of the text.

var textRotationIsRelativeBoolean

Whether the text rotation is relative to the existing rotation of the graphic itself, or whether it is constant compared to the canvas.

var textSizeNumber

Font size of text in this graphic. Where there are multiple fonts, this returns the first character’s font size. Setting this value sets it for all text in the graphic.

var textUnitRectRect

Size and position of the graphics’ text area as a unit square. I.e. The x and y are in terms of proportion of graphic size from the graphic bounds (so 0,0 is the graphic origin, (1,1) originates at the graphic’s lower-righthand corner, and the width and height are the scale of the text area in proportion to the graphic, so (1,1) is the same size as the graphic bounds, (2,2) would be twice as large, etc.

var textVerticalPaddingNumber

Vertical padding between the edge of the graphic’s bounds and the edge of the text area where text is drawn.

var textVerticalPlacementVerticalTextPlacement

Alignment of the text in this graphic vertically.

var textWrapsBoolean

Whether the text wraps to the graphic’s bounds, or can go as wide as it wishes outside the graphic bounds.

Shape : Solid

A ‘Solid’ graphic which has a particular shape, either one of the built-in shapes, or a custom bezier shape.

Instance Properties

var shapeString or null

Name of the shape for this graphic.

var shapeControlPointsArray of Point

The vertices and controlPoint1 & controlPoint2 of each bezier segment. For straight line segments, both control points will be identical to the vertex point.

var shapeVerticesArray of Point

Array of vertices for this shape.

GraphicView

The view of the canvas in an OmniGraffle window.

Instance Functions

function select(graphics: Array of Graphic, extending: Boolean or null)

Change the selection to a new array of graphics. If extending is true, then the previous selection is retained as well.

function deselect(graphics: Array of Graphic)

Removes any of the passed graphics from the current selection, leaving any other currently selected graphics still selected.

function edit(solid: Solid)

Begin editing the text of a solid graphic.

Instance Properties

var canvasCanvas

The canvas currently being displayed in this view.

var visibleRectRect

The rectangle of the canvas which is visible in the window.

Grid

Holds the grid settings for a particular canvas.

Instance Properties

var drawsInFrontBoolean

Whether the grid draws in front of all graphics or behind them.

var majorColorColor

Color of the major grid lines.

var majorSpacingNumber

Number of minor grid squares between each major grid line.

var minorColorColor

Color of the minor grid lines.

var snapsBoolean

Whether graphics on the canvas snap to the grid.

var spacingNumber

Number of points of spacing between each minor grid line. (Also the width and height of each minor grid square.)

var visibleBoolean

Whether the grid is currently visible or invisible.

HierarchicalDirection

Class Properties

var BottomHierarchicalDirection read-only

Root of the hierarchy is at the bottom and tree extends upwards.

var LeftHierarchicalDirection read-only

Root of the hierarchy is at the left and tree extends rightwards.

var RightHierarchicalDirection read-only

Root of the hierarchy is at the right and tree extends leftwards.

var TopHierarchicalDirection read-only

Root of the hierarchy is at the top and tree extends downwards.

var allArray of HierarchicalDirection read-only

HopType

Class Properties

var BridgeHopType read-only

Bridge over the other line(s).

var GapHopType read-only

Leave a gap while crossing the other line(s).

var IgnoreHopType read-only

No hops, and ignore this line when computing hops for other lines.

var NoneHopType read-only

Don’t hop at all.

var RoundHopType read-only

Rounded over the other line(s).

var RoundUnderHopType read-only

Rounded under the other line(s).

var SquareHopType read-only

Square shape over the other line(s).

var SquareUnderHopType read-only

Square shape under the other line(s).

var ThreeSideHopType read-only

Three segments angled over the other line(s).

var ThreeSideUnderHopType read-only

Three segments angled under the other line(s).

var TwoSideHopType read-only

Vee over the other line(s).

var TwoSideUnderHopType read-only

Vee under the other line(s).

var allArray of HopType read-only

HorizontalAlignment

Class Properties

var CenterHorizontalAlignment read-only

Align to horizontal centers.

var LeftHorizontalAlignment read-only

Align to left edges.

var RightHorizontalAlignment read-only

Align to right edges.

var allArray of HorizontalAlignment read-only

HorizontalTextAlignment

Class Properties

var CenterHorizontalTextAlignment read-only

Centered horizontally.

var JustifyHorizontalTextAlignment read-only

Spacing adjusted to fill available horizontal space.

var LeftHorizontalTextAlignment read-only

Aligned left.

var RightHorizontalTextAlignment read-only

Aligned right.

var allArray of HorizontalTextAlignment read-only

Image

Class Functions

function symbolNamed(name: String)Image or null

Returns an image given a symbol name.

ImageReference

An image inside an OmniGraffle document. The image can be part of the fill for more than one ‘Solid’ graphic, and all of them will refer to the same ‘ImageReference’.

Instance Properties

var dataData or null read-only

The image data bytes.

var originalSizeSize read-only

Original size of the image in pixels.

var uniqueIDNumber read-only

A unique (within this document) identifier for this image reference.

ImageSizing

Class Properties

var ManualImageSizing read-only

Manual.

var StretchedImageSizing read-only

Stretched.

var TiledImageSizing read-only

Tiled.

var allArray of ImageSizing read-only

Layer

A layer containing graphics on a given canvas.

Instance Functions

function orderAbove(layer: Layer)

Reorder this layer so that it is just above the given layer.

function orderBelow(layer: Layer)

Reorder this layer so that it is just below the given layer.

function remove()

Remove this layer from its canvas, deleting it.

function addShape(shapeName: String, bounds: Rect)Shape

Create a new graphic of a given shape and place it on this layer.

function newShape()Shape

Create a zero-sized rectangle (presumably to be modified further) and place it on this layer.

Instance Properties

var graphicsArray of Graphic read-only

All graphics in this layer.

var lockedBoolean

Whether this layer is locked, effectively locking all graphics contained in the layer.

var nameString

Name of this layer.

var printsBoolean

Whether graphics on this layer should be visible when this canvas is printed.

var visibleBoolean

Whether graphics on this layer are visible.

Layout

Graphic layout information for a canvas.

Instance Properties

var automaticLayoutBoolean

Whether to re-layout automatically on every change to the canvas.

var circularLineLengthNumber

Optimum line length to try to achieve during circular layout.

var directionHierarchicalDirection

The hierarchical layout orientation.

var forceDirectedLineLengthNumber

Optimum line length to try to achieve during force-directed layout.

var forceDirectedSeparationNumber

Separation distance between graphics to try to achieve during force-directed layout.

var objectSeparationNumber

Distance between graphics at the same level during hierarchical layout.

var radialSeparationNumber

Distance between graphics during radial layout.

var rankSeparationNumber

Distance between graphics from one level to an adjacent level higher or lower during hierarchical layout.

var typeLayoutType

Type of layout to perform: hierarchical, circular, radial, or force-directed.

LayoutType

Class Properties

var CircularLayoutType read-only

Tries to arrange sibling shapes in a circle around their parent.

var ForceDirectedLayoutType read-only

Grows in semi-random directions from the center.

var HierarchicalLayoutType read-only

Creates layers of equally-ranked objects, extending in one direction..

var RadialLayoutType read-only

Tries to arrange sibling shapes in arcs around their parent.

var allArray of LayoutType read-only

LineCap

Class Properties

var ButtLineCap read-only

The line has a flat end cap, exactly at the end point of the line.

var RoundLineCap read-only

The line has a round end cap, with the center at the end point of the line, and radius of half its width.

var SquareLineCap read-only

The line has a flat end cap, extending half the line width past the end point.

var allArray of LineCap read-only

LineJoin

Class Properties

var BevelLineJoin read-only

Line segments are joined with a squared-off end.

var MiterLineJoin read-only

Line segments are joined with a sharp (angled) corner.

var RoundLineJoin read-only

Line segments are joined with a rounded end.

var allArray of LineJoin read-only

LineType

Class Properties

var BezierLineType read-only

Bezier line.

var CurvedLineType read-only

Curved line.

var OrthogonalLineType read-only

Orthogonal line.

var StraightLineType read-only

Straight line.

var allArray of LineType read-only

Locale

Class Properties

var identifiersArray of String read-only

The list of known ISO locale identifiers.

Constructors

new Locale(identifier: String)Locale

Instance Properties

var calendarCalendar read-only

The calendar for the locale.

var currencyCodeString or null read-only

The currency code for the locale.

var identifierString read-only

The ISO locale identifier for this object.

MenuItem

Instance Properties

var checkedBoolean

If true, a checkmark is displayed next to the MenuItem’s label.

var imageImage or null

An optional image to be displayed with the MenuItem.

var labelString

The string displayed to describe the MenuItem’s action.

NSWindow

Instance Functions

function close()

function setViewForCanvas(canvas: Canvas, zoom: Number, center: Point)

Change the saved position for a canvas, so that this will be the view position and scale shown when that canvas is next selected.

Instance Properties

var centerVisiblePointPoint

var selectionSelection read-only

var zoomNumber

Notification

Constructors

new Notification(title: String)Notification

Instance Functions

function show()Promise of Notification

Attempts to present the notification and returns a Promise which will yield the notification object itself if it is clicked or tapped, or an error if it cannot be presented or is dismissed.

Instance Properties

var subtitleString or null

var titleString

OGOutlineNode

An outline node is one element of a hierarchical organization of the canvas’s graphics. Each node represents a single shape, with the lines between shapes determining parent-child relationships. The outline structure is visualized in the Mac applications ‘Outline’ sidebar tab.

Instance Properties

var childrenArray of OGOutlineNode read-only

Child nodes of this node.

var graphicGraphic or null read-only

Graphic that this outline node represents.

Pasteboard

A pasteboard temporarily holds representations of items of different types for transfer between different applications or different locations in the application.

Class Functions

function makeUnique()Pasteboard

Creates a new unique pasteboard.

Class Properties

var generalPasteboard read-only

The Pasteboard used for user-initiated copy/paste support.

Instance Functions

function availableType(types: Array of TypeIdentifier)TypeIdentifier or null

The first type from the provided list which is available on the pasteboard, or null if none are available.

function addItems(items: Array of Pasteboard.Item)

Appends the new items to the pasteboard.

function clear()

Remove all items from the pasteboard.

function dataForType(type: TypeIdentifier)Data or null

The Data representation for the given type in this pasteboard, or null if none is available.

function setDataForType(data: Data, type: TypeIdentifier)

Set the Data representation for the given type in this pasteboard, replacing any previously set data.

function stringForType(type: TypeIdentifier)String or null

The String representation for the given type in this pasteboard, or null if none is available.

function setStringForType(string: String, type: TypeIdentifier)

Set the String representation for the given type in this pasteboard, replacing any previously set data.

Instance Properties

var URLURL or null

Gets or sets the pasteboard content as a single URL.

var URLsArray of URL or null

Gets or sets the pasteboard content as a list of URLs.

var colorColor or null

Gets or sets the pasteboard content as a single color.

var colorsArray of Color or null

Gets or sets the pasteboard content as a list of colors.

var hasColorsBoolean read-only

Returns true if the pasteboard contains one or more colors.

var hasImagesBoolean read-only

Returns true if the pasteboard contains one or more images.

var hasStringsBoolean read-only

Returns true if the pasteboard contains one or more strings.

var hasURLsBoolean read-only

Returns true if the pasteboard contains one or more URLs.

var imageImage or null

Gets or sets the pasteboard content as a single image.

var imagesArray of Image or null

Gets or sets the pasteboard content as a list of images.

var itemsArray of Pasteboard.Item

The array of individual items on the pasteboard, each potentially with their own set of types.

var stringString or null

Gets or sets the pasteboard content as a single plain-text string.

var stringsArray of String or null

Gets or sets the pasteboard content as a list of plain-text strings.

var typesArray of TypeIdentifier read-only

The list of pasteboard types currently available on the pasteboard.

Pasteboard.Item

Constructors

new Pasteboard.Item()Pasteboard.Item

Make a new empty pasteboard item with no contents.

Instance Functions

function dataForType(type: TypeIdentifier)Data or null

The Data representation for the given type in this pasteboard item, or null if none is available.

function setDataForType(data: Data, type: TypeIdentifier)

Set the Data representation for the given type in this pasteboard item, replacing any previously set data.

function stringForType(type: TypeIdentifier)String or null

The String representation for the given type in this pasteboard item, or null if none is available.

function setStringForType(string: String, type: TypeIdentifier)

Set the String representation for the given type in this pasteboard item, replacing any previously set data.

Instance Properties

var typesArray of TypeIdentifier read-only

The list of types available for this pasteboard item.

PlugIn

Class Functions

function find(identifier: String, minimumVersion: Version or null)PlugIn or null

Class Properties

var allArray of PlugIn read-only

Instance Functions

function library(identifier: String)PlugIn.Library or null

Looks for a PlugIn.Library in the receiver and returns it if found.

function action(identifier: String)PlugIn.Action or null

function handler(identifier: String)PlugIn.Handler or null

function resourceNamed(name: String)URL or null

function imageNamed(name: String)Image or null

function localizedResourceNamed(filename: String)FileWrapper or null

Instance Properties

var URLURL or null read-only

Returns the original URL from whence this PlugIn came, if known.

var actionsArray of PlugIn.Action read-only

var authorString read-only

Returns the author for the PlugIn.

var descriptionString read-only

Returns the description provided for the PlugIn.

var displayNameString read-only

Returns the localized, human-readable name for the PlugIn.

var handlersArray of PlugIn.Handler read-only

var identifierString read-only

The unique identifier of the PlugIn.

var librariesArray of PlugIn.Library read-only

var versionVersion read-only

Returns the current Version for the PlugIn.

PlugIn.Action

Constructors

new PlugIn.Action(perform: Function)PlugIn.Action

Returns a new PlugIn.Action. Only used within an action JavaScript file embedded within a PlugIn.

Instance Properties

var descriptionString read-only

var labelString read-only

Returns the default label to use for interface controls that invoke the action.

var longLabelString read-only

Returns the label to use for interface controls that invoke the action, when a long amount of space is available.

var mediumLabelString read-only

Returns the label to use for interface controls that invoke the action, when a medium amount of space is available.

var nameString read-only

Returns the name of the PlugIn.Action.

var paletteLabelString read-only

Returns the label to use for interface controls that show a prototype of the action control, such as on a macOS toolbar configuration sheet.

var performFunction read-only

var plugInPlugIn read-only

Returns the PlugIn that contains this object.

var shortLabelString read-only

Returns the label to use for interface controls that invoke the action, when a short amount of space is available.

var validateFunction or null

A function to check whether the action is supported, given the current application state, as determined by the arguments passed (typically including the selection). This optional Function may be configured while the Action is being loaded, but after that the Action will be frozen.

PlugIn.Handler

Constructors

new PlugIn.Handler(invoke: Function)PlugIn.Handler

Returns a new PlugIn.Handler. Only used within an handler JavaScript file embedded within a PlugIn.

Instance Properties

var invokeFunction read-only

The Function that will be executed for each handler registered for an event posted by an application object.

var nameString read-only

Returns the name of the PlugIn.Handler.

var plugInPlugIn read-only

Returns the PlugIn that contains this object.

var willAttachFunction or null

An optional Function that can be set on PlugIn.Handler as it is being loaded (but not after). This function is passed the application object that post events to trigger the handler. The return value should be a state object that is JSON archivable (or undefined if the handler has no state to maintain across invocations).

var willDetachFunction or null

An optional Function that can be set on PlugIn.Handler as it is being loaded (but not after). Called when a previously attached PlugIn.Handler is being detached from an application object. Any return value or thrown error are ignored.

PlugIn.Handler.Registration

Instance Functions

function remove()

Removes a previously added event observation.

PlugIn.Library

An object that represents a library from a plug-in.

Constructors

new PlugIn.Library(version: Version)PlugIn.Library

Returns a new Library. Typically only used within a library JavaScript file embedded within a PlugIn.

Instance Properties

var nameString read-only

Returns the name of the PlugIn.Library.

var plugInPlugIn read-only

Returns the PlugIn that contains this object.

var versionVersion read-only

Returns the Version of this library, as passed to the constructor.

Point

Class Properties

var unitXPoint read-only

Returns a Point with coordinates (1, 0).

var unitYPoint read-only

Returns a Point with coordinates (0, 1).

var zeroPoint read-only

Returns the Point (0, 0), the origin.

Constructors

new Point(x: Number, y: Number)Point

Returns a new Point with the specified coordinates.

Instance Functions

function add(point: Point)Point

Returns a new Point that is the component-wise sum of the receiver and the argument Point.

function subtract(point: Point)Point

Returns a new Point that is the component-wise difference of the receiver and the argument Point.

function scale(factor: Number)Point

Returns a new Point where each component is scaled by the given factor.

function distanceTo(point: Point)Number

Returns the distance between the receiver and the given Point.

function dot(point: Point)Number

Returns the dot product between the receiver and the given Point.

Instance Properties

var lengthNumber read-only

Returns the distance between the receiver and the origin.

var negativePoint read-only

Returns the component-wise negative of the receiver.

var normalizedPoint read-only

For a non-zero point, returns a point with a distance of one from the origin, but in the same direction as the original. For the zero point, this returns the receiver.

var xNumber

The horizontal axis coordinate of the Point.

var yNumber

The vertical axis coordinate of the Point.

Portfolio

Instance Functions

function addCanvas()Canvas or null

Add a new canvas to the end of the current canvases.

function addImage(data: Data)ImageReference or null

Add an image to the document given some image data. The resulting ImageReference can then be set as the image fill of any number of Solid graphics on canvases within this document. Returns nil if the data could not be interpreted as a valid image.

function copyImage(image: ImageReference)ImageReference or null

Copy an image from another document or stencil to this one.

Instance Properties

var appApplication read-only

Returns the shared Application.

var canvasesArray of Canvas read-only

List of canvases in the portfolio.

var consoleConsole read-only

Returns the shared Console.

var documentGraffleDocument or null read-only

var imagesArray of ImageReference read-only

A list of all images referenced by any graphic in this document. Each ImageReference is a unique image and appears only once in the list, even if it is used as the image fill for multiple graphics.

Preferences

Constructors

new Preferences(identifier: String or null)Preferences

Creates a new Preferences instance. The identifier specified may be null to create an instance for the currently loading plug-in. If it is null and a plug-in is not being loaded, an error will be thrown. Key/value pairs stored in the instance will be prefixed with the identifier and a “.”.

Instance Functions

function read(key: String)Object or null

Returns the previously stored value for the given key, or null if no value is stored.

function readBoolean(key: String)Boolean

Returns the previously stored value as a Boolean, or false if there is no stored value or it can’t be converted to a Boolean.

function readString(key: String)String or null

Returns the previously stored value as a String, or null if there is no stored value or it is not a String.

function readNumber(key: String)Number

Returns the previously stored value as a Number, or null if there is no stored value or it is not a Number.

function readDate(key: String)Date or null

Returns the previously stored value as a Date, or null if there is no stored value or it is not a Date.

function readData(key: String)Data or null

Returns the previously stored value as a Data, or null if there is no stored value or it is not a Data.

function write(key: String, value: Boolean, String, Number, Date, or Data or null)

Stores the specified key/value pair, or removes the pair if value is null.

function remove(key: String)

Removes and previously stored value for the given key.

Instance Properties

var identifierString read-only

The scoping identifier the instance given when created, or the plug-in identifier if none was given.

Promise

The built-in JavaScript Promise constructor.

Rect

Constructors

new Rect(x: Number, y: Number, width: Number, height: Number)Rect

Returns a new Rect with the specified coordinates and size.

Instance Functions

function insetBy(dx: Number, dy: Number)Rect

function offsetBy(dx: Number, dy: Number)Rect

function union(rect: Rect)Rect

function intersect(rect: Rect)Rect

function containsRect(rect: Rect)Boolean

function containsPoint(point: Point)Boolean

function intersects(rect: Rect)Boolean

Instance Properties

var centerPoint read-only

var heightNumber

var integralRect read-only

var isEmptyBoolean read-only

var isInfiniteBoolean read-only

var isNullBoolean read-only

var maxXNumber read-only

var maxYNumber read-only

var midXNumber read-only

var midYNumber read-only

var minXNumber read-only

var minYNumber read-only

var originPoint

var sizeSize

var standardizedRect read-only

var widthNumber

var xNumber

var yNumber

Selection

The ‘selection’ argument to plugin actions, letting them inspect the selection.

Instance Properties

var canvasCanvas or null read-only

The currently selected canvas.

var documentGraffleDocument or null read-only

The current document whose graphics are selected.

var graphicsArray of Graphic read-only

The currently selected graphics.

var linesArray of Line read-only

The subset of the currently selected graphics which are lines.

var solidsArray of Solid read-only

The subset of the currently selected graphics which are solids.

var viewGraphicView or null read-only

The current view containing the selection.

ShapeCombination

Class Properties

var IntersectShapeCombination read-only

Form the intersection of the shapes.

var NoneShapeCombination read-only

Perform no combination operation.

var SubtractShapeCombination read-only

Subtract the shapes from the first shape

var UnionShapeCombination read-only

Form the union of the shapes.

var UniteShapeCombination read-only

An alias for Union.

var allArray of ShapeCombination read-only

SharePanel

An interface that can display the system share interaction for the given items.

Constructors

new SharePanel(items: Array of URL, String, Image, or FileWrapper)SharePanel

Create a new share panel with the given items.

Instance Functions

function addItem(shareItem: URL, String, Image, or FileWrapper)

Appends the item to the end of items.

function addItems(shareItems: Array of URL, String, Image, or FileWrapper)

Appends the contents of the given array to the end of items.

function removeItem(shareItem: URL, String, Image, or FileWrapper)

Removes the first occurrence of the item from items if it is present in items.

function removeItems(shareItems: Array of URL, String, Image, or FileWrapper)

Removes the first occurrence of each member of the given array from items if that member is present in items.

function clearItems()

Sets items to an empty array. Note: Calling show when items is empty results in an error, so be sure to add new items after calling this and before calling show.

function show()

Presents the share panel for its items. Calling this when items is empty will result in an error.

Instance Properties

var itemsArray of URL, String, Image, or FileWrapper

The items that will be supplied to the system share interaction upon calling show.

Size

Constructors

new Size(width: Number, height: Number)Size

Returns a new Size with the specified width and height.

Instance Properties

var heightNumber

var widthNumber

Speech

Speech.Boundary

Class Properties

var ImmediateSpeech.Boundary read-only

var WordSpeech.Boundary read-only

var allArray of Speech.Boundary read-only

Speech.Synthesizer

Constructors

new Speech.Synthesizer()Speech.Synthesizer

Instance Functions

function speakUtterance(utterance: Speech.Utterance)

Enqueues the utterance. If the utterance is already or enqueued or speaking, throws and error.

function stopSpeaking(boundary: Speech.Boundary)Boolean

function pauseSpeaking(boundary: Speech.Boundary)Boolean

function continueSpeaking()Boolean

Instance Properties

var pausedBoolean read-only

var speakingBoolean read-only

Speech.Utterance

Class Properties

var defaultSpeechRateNumber read-only

var maximumSpeechRateNumber read-only

var minimumSpeechRateNumber read-only

Constructors

new Speech.Utterance(string: String)Speech.Utterance

Instance Properties

var pitchMultiplierNumber

A value between 0.5 and 2.0, controlling the picth of the utterance.

var postUtteranceDelayNumber

var preUtteranceDelayNumber

var prefersAssistiveTechnologySettingsBoolean

If an assistive technology is on, like VoiceOver, the user’s selected voice, rate and other settings will be used for this speech utterance instead of the default values. If no assistive technologies are on, then the values of the properties on AVSpeechUtterance will be used. Note that querying the properties will not refect the user’s settings.

var rateNumber

A value between Speech.Utterance.minimumSpeechRate and Speech.Utterance.maximumSpeechRate controlling the rate of speech for the utterance.

var stringString or null read-only

var voiceSpeech.Voice or null

The voice to use for this utterance, or null in which case the default voice will be used.

var volumeNumber

A value between 0.0 and 1.0 controller the volume of the utterance.

Speech.Voice

Class Functions

function withLanguage(code: String or null)Speech.Voice or null

Returns a voice for the given BCP–47 language code (such as en-US or fr-CA), or the default voice if passed null. Returns null for an invalid langauge code.

function withIdentifier(identifier: String)Speech.Voice or null

Returns the voice with the given identifier, or null if not found.

Class Properties

var allVoicesArray of Speech.Voice read-only

var currentLanguageCodeString read-only

Instance Properties

var genderSpeech.Voice.Gender read-only

var identifierString read-only

var languageString read-only

var nameString read-only

Speech.Voice.Gender

Class Properties

var FemaleSpeech.Voice.Gender read-only

var MaleSpeech.Voice.Gender read-only

var UnspecifiedSpeech.Voice.Gender read-only

var allArray of Speech.Voice.Gender read-only

Stencil

A stencil containing graphics that can be copied to documents.

Instance Functions

function load(completed: Function(‍stencil: Stencil))

Load this stencil document into memory so its graphics and images can be accessed.

Instance Properties

var graphicsArray of Graphic read-only

Array of graphics available on the stencil.

var imagesArray of ImageReference read-only

A list of all images referenced by any graphic in this stencil. Each ImageReference is a unique image and appears only once in the list, even if it is used as the image fill for multiple graphics.

var isLoadedBoolean read-only

Whether or not this stencil has already been loaded into memory.

var nameString read-only

Name of the stencil.

StringEncoding

Class Properties

var ASCIIStringEncoding read-only

var ISO2022JPStringEncoding read-only

var ISOLatin1StringEncoding read-only

var ISOLatin2StringEncoding read-only

var JapaneseEUCStringEncoding read-only

var MacOSRomanStringEncoding read-only

var NextStepStringEncoding read-only

var NonLossyASCIIStringEncoding read-only

var ShiftJISStringEncoding read-only

var SymbolStringEncoding read-only

var UTF16StringEncoding read-only

var UTF16BigEndianStringEncoding read-only

var UTF16LittleEndianStringEncoding read-only

var UTF32StringEncoding read-only

var UTF32BigEndianStringEncoding read-only

var UTF32LittleEndianStringEncoding read-only

var UTF8StringEncoding read-only

var UnicodeStringEncoding read-only

var WindowsCP1250StringEncoding read-only

var WindowsCP1251StringEncoding read-only

var WindowsCP1252StringEncoding read-only

var WindowsCP1253StringEncoding read-only

var WindowsCP1254StringEncoding read-only

var allArray of StringEncoding read-only

StrokeDash

Class Properties

var Dash10on3off2on3offStrokeDash read-only

var Dash10on3off2on3off2on3offStrokeDash read-only

var Dash16on9offStrokeDash read-only

Sixteen point dash segments with nine point gaps.

var Dash16on9off16on9off1on9offStrokeDash read-only

var Dash16on9off1on9offStrokeDash read-only

var Dash16on9off1on9off1on9offStrokeDash read-only

var Dash1on3offStrokeDash read-only

One point dot segments with three point gaps.

var Dash1on4offStrokeDash read-only

One point dot segments with four point gaps.

var Dash1on5offStrokeDash read-only

One point dot segments with five point gaps.

var Dash1on9offStrokeDash read-only

One point dot segments with nine point gaps.

var Dash20on5off4on5offStrokeDash read-only

var Dash20on5off4on5off4on5offStrokeDash read-only

var Dash2on2offStrokeDash read-only

var Dash40on9off8on9offStrokeDash read-only

var Dash40on9off8on9off8on9offStrokeDash read-only

var Dash4on3off1on3offStrokeDash read-only

var Dash4on3off1on3off1on3offStrokeDash read-only

var Dash4on3off4on3off1on3offStrokeDash read-only

var Dash4on4offStrokeDash read-only

Four point dash segments with four point gaps.

var Dash4on9off1on5offStrokeDash read-only

Four point dash alternating with one point dots, with nine and five point gaps

var Dash4on9off1on5off1on5offStrokeDash read-only

var Dash8on4off1on4offStrokeDash read-only

Eight point dash alternating with one point dots, both with four point gaps.

var Dash8on5offStrokeDash read-only

Eight point dash with five point gaps.

var Dash8on5off8on5off1on5offStrokeDash read-only

var SolidStrokeDash read-only

Solid stroke with no dash pattern.

var allArray of StrokeDash read-only

StrokeType

Class Properties

var DoubleStrokeType read-only

Double.

var FreehandStrokeType read-only

Freehand.

var InnerStrokeType read-only

Inner.

var OuterStrokeType read-only

Outer.

var PlasticStrokeType read-only

Plastic.

var SingleStrokeType read-only

Single.

var allArray of StrokeType read-only

TextAutosizing

Class Properties

var ClipTextAutosizing read-only

Clip.

var FullTextAutosizing read-only

Full.

var OverflowTextAutosizing read-only

Overflow.

var VerticalTextAutosizing read-only

Vertical.

var allArray of TextAutosizing read-only

TextFlow

Class Properties

var ClipTextFlow read-only

Clip.

var FillsShapeTextFlow read-only

Fills shape.

var FollowsPathTextFlow read-only

Follows path.

var OverflowTextFlow read-only

Overflow.

var ResizeTextFlow read-only

Resize.

var allArray of TextFlow read-only

TimeZone

Class Properties

var abbreviationsArray of String read-only

The list of known time zone abbreviations.

Constructors

new TimeZone(abbreviation: String)TimeZone or null

Make a new TimeZone with the given abbreviation. Note that the returned TimeZone may have a different abbreviation than the passed argument. For example, if one of “PST” or “PDT” is requested that doens’t match the current use of daylight savings time, the one that does match will be returned.

Instance Properties

var abbreviationString or null read-only

The abbreviation for the TimeZone.

var daylightSavingTimeBoolean read-only

Returns true if the TimeZone is currently using daylight savings time.

var secondsFromGMTNumber read-only

The current difference in seconds between this TimeZone and GMT.

Timer

Class Functions

function once(interval: Number, action: Function(‍timer: Timer))Timer

Makes a new Timer that will fire once, after the specified interval (in seconds from the current time). When the Timer fires, the passed in Function is called, passing the Timer as its argument.

function repeating(interval: Number, action: Function(‍timer: Timer))Timer

Makes a new Timer that will fire repeatedly with the specified interval (in seconds, with the first invocation happening that interval after the current time). When the Timer fires, the passed in Function is called, passing the Timer as its argument.

Instance Functions

function cancel()

Instance Properties

var intervalNumber read-only

ToolbarItem

Instance Properties

var imageImage or null

var labelString

var toolTipString or null

TypeIdentifier

Class Functions

function fromPathExtension(pathExtension: String, isDirectory: Boolean)TypeIdentifier

Return a TypeIdentifier that matches items that have the given path extension and are (or are not) directories.

Class Properties

var URLTypeIdentifier read-only

The URL type.

var binaryPropertyListTypeIdentifier read-only

The binary property list type.

var csvTypeIdentifier read-only

The comma-separated text type.

var editableTypesArray of TypeIdentifier read-only

The list of TypeIdentifiers that can be read and written natively by documents in this application.

var gifTypeIdentifier read-only

The GIF image type.

var imageTypeIdentifier read-only

A generic type that all image types conform to.

var jpegTypeIdentifier read-only

The JPEG image type.

var jsonTypeIdentifier read-only

The JSON type.

var pdfTypeIdentifier read-only

The PDF type.

var plainTextTypeIdentifier read-only

The plain text type.

var pngTypeIdentifier read-only

The PNG image type.

var propertyListTypeIdentifier read-only

The generic property list type.

var readableTypesArray of TypeIdentifier read-only

The list of TypeIdentifiers that can be read by documents in this this application.

var rtfTypeIdentifier read-only

The RTF type.

var rtfdTypeIdentifier read-only

The RTFD type.

var tiffTypeIdentifier read-only

The TIFF image type.

var writableTypesArray of TypeIdentifier read-only

The list of TypeIdentifiers that can be written by documents in this application (though some documents may be exportable only in a subset of these types).

var xmlPropertyListTypeIdentifier read-only

The XML property list type.

Constructors

new TypeIdentifier(identifier: String)TypeIdentifier

Returns a new TypeIdentifier with the given identifier.

Instance Functions

function conformsTo(other: TypeIdentifier)Boolean

Returns true if the instance is the same as the given argument or a more specific type. For example, TypeIdentifier.png.conformsTo(TypeIdentifier.image) will be true, but TypeIdentifier.png.conformsTo(TypeIdentifier.plainText) will be false.

Instance Properties

var displayNameString read-only

Returns a human-readable description of the type.

var identifierString read-only

Returns a unique string for a type identifier, suitable for archiving or encoding in scripts.

var pathExtensionsArray of String read-only

The list of filesystem path extensions used by this type.

URL

Class Functions

function choose(types: Array of String)URL or null

Deprecated: Please use FilePicker instead.

Allows the user to choose a file URL if possible and returns a new instance, or null otherwise.

function chooseFolder()URL or null

Deprecated: Please use FilePicker instead.

Allows the user to choose a folder URL if possible and returns a new instance, or null otherwise.

function fromString(string: String, relativeToURL: URL or null)URL or null

Parses the string as a URL if possible and returns a new instance, or null if the string is not a valid URL. If baseURL is not null, the result is a relative URL.

function fromPath(path: String, isDirectory: Boolean, relativeToURL: URL or null)URL

Returns a new file URL with the given path and assumption of whether it is a directory.

function tellScript(app: String, js: String, arg: Object or null)URL or null

Creates a URL to invoke the given JS on the given app (url scheme) appropriate for use with the call function.

function tellFunction(app: String, jsFunction: Function, arg: Object or null)URL or null

Creates a URL to invoke the given JS function on the given app (url scheme) appropriate for use with the call function.

Class Properties

var currentAppSchemeString read-only

Returns the URL scheme for the current app.

var documentsDirectoryURL read-only

Returns the application’s Documents directory. This is in the application’s sandbox, and on the Mac is not the user’s Documents directory. This is accessible by the application without using access().

Instance Functions

function fetch(success: Function(‍contents: Data), failure: Function(‍error: Error) or null)

Get the contents at the destination of this URL.

function call(success: Function, failure: Function or null)

Invoke an x-callback-url API end-point, with the callback functions being invoked when a reply is received. When a reply is received, the parameters of that URL are decoded as JSON, or left as String values if not valid JSON, and stored as properties of a result object. For a successful reply, if the result object has one property, its value is passed as the first argument to the success function. If there are zero or more than one parameters, the full object is passed as the first argument. In both cases, the success function is passed a second argument that is the full object of parameters. The failure callback is always passed the object will all the result parameters, typically errorCode and errorMessage.

function open()

Ask the system to open this URL.

function find(types: Array of TypeIdentifier, recurse: Boolean or null)Promise of Array of URL

Scan a directory URL for files of the given types. If recurse is specified and is false, only the immediate contents of the directory will be considered. If recurse is not specified or is true, the full directory tree will be scanned.

function toString()String

function appendingPathComponent(component: String)URL

Return a new URL with the given string added at the end of the path.

function appendingPathExtension(pathExtension: String)URL

Returns a new URL with the last path component having the given path extension added, including a separating “.”

function deletingPathExtension()URL

Returns a new URL with the path extension (if any) of the last path component removed.

function deletingLastPathComponent()URL

Returns a new URL with the last path component removed.

Instance Properties

var absoluteStringString read-only

Returns the absolute string for the URL.

var absoluteURLURL read-only

Returns the absolute URL.

var baseURLURL or null read-only

Returns the base URL if this URL is relative, or null if it is absolute.

var fragmentString or null read-only

Returns the fragment component of the URL, or null.

var hasDirectoryPathBoolean read-only

Returns true if the URL’s path represents a directory.

var hostString or null read-only

Returns the host component of the URL or null.

var isFileURLBoolean read-only

Returns true if the scheme is file:.

var lastPathComponentString read-only

Returns the last component of the URL’s path or an empty string.

var passwordString or null read-only

Returns the password component of the URL or null.

var pathString or null read-only

Returns the path component of the URL or null.

var pathComponentsArray of String read-only

Returns the path of the URL as an array of components.

var pathExtensionString read-only

Returns the path extension of the last path component of the URL or the empty string.

var portNumber or null read-only

Returns the port component of the URL or null.

var queryString or null read-only

Returns the query component of the URL or null.

var relativePathString or null read-only

Returns the relative path of the URL, or the absolute path if this URL is not relative

var relativeStringString read-only

Returns the relative portion of the URL if it is relative, otherwise this returns the absolute string.

var schemeString or null read-only

Returns the scheme of the URL.

var stringString read-only

String absoluteString representation of this URL.

var userString or null read-only

Returns the user component of the URL or null.

URL.Access

A URL.Access holds the temporary access given by the URL.Bookmark.access() function. These should not be stored longer than needed.

Instance Properties

var urlURL read-only

The URL being accessed.

URL.Bookmark

A URL.Bookmark records the permission to access a given URL and will restore that permission, as well as a possibly renamed file, at a later point.

Class Functions

function fromURL(url: URL)URL.Bookmark

Creates a URL.Bookmark from an existing URL, which should have been returned by FilePicker. This can then be stored in a Credentials object to persistently record the permission to access this URL.

Instance Functions

function access()Promise of URL.Access

Attempts to resolve the instance into a URL and grant access to it through the returned Promise. Access to the URL will only last as long as the URL.Access object exists (which should not be stored longer than necessary).

URL.Components

URL.Components allows for correct generation and interpreation of URL instances, dealing with the specific different quoting rules for each specific part of the URL.

Class Functions

function fromString(string: String)URL.Components or null

Parses the string into URL.Components. If the string is not a valid URL, null is returned.

function fromURL(url: URL, resolvingAgainstBaseURL: Boolean)URL.Components or null

Parses the string represenation of the URL. If the URL’s string is malformed, null is returned. If resolve is true and the given url is relative, its base URL’s components are considered.

Constructors

new URL.Components()URL.Components

Returns a new URL.Components.

Instance Functions

function urlRelativeTo(base: URL or null)URL or null

Returns a URL relative to the base URL and the components or null.

Instance Properties

var fragmentString or null

var hostString or null

var passwordString or null

var pathString

var portNumber or null

var queryString or null

var queryItemsArray of URL.QueryItem or null

The query of the URL.Components as individual components.

var schemeString or null

var urlURL or null read-only

Returns a URL for the components or null.

var userString or null

URL.FetchRequest

URL.FetchRequest represents a request for a URL resource, providing additional controls for the request (such as the HTTP method, headers, and cache controls) and uses a Promise-based API for actually performing the request and receiving a detailed response (which includes the HTTP status code and headers along with the body of the result—see URL.FetchResponse for more detail).

Class Functions

function fromString(string: String)URL.FetchRequest or null

Parses the string as a URL if possible and returns a new instance, or null otherwise.

Constructors

new URL.FetchRequest()URL.FetchRequest

Creates a new instance.

Instance Functions

function fetch()Promise of URL.FetchResponse

Perform the request, returning a Promise. On success, the promise will resolve to a URL.FetchResponse.

Instance Properties

var allowsConstrainedNetworkAccessBoolean

Whether connections may use the network when the user has specified Low Data Mode.

var allowsExpensiveNetworkAccessBoolean

Whether connections may use a network interface that the system considers expensive.

var bodyDataData or null

The body of the request, typically used in an HTTP POST or PUT request. This API is suitable for uploading binary data, or for text which needs to be encoded in a form other than UTF–8. If UTF–8 text is suitable, bodyString is likely to be a better choice.

var bodyStringString or null

The body of the request, typically used in an HTTP POST or PUT request. The provided string will be transmitted using the UTF–8 encoding.

var cacheString or null

The cache policy for the request: default, no-store, reload, no-cache, force-cache, or only-if-cached.

var headers → Object

Custom HTTP headers to be sent with this request.

var httpShouldHandleCookiesBoolean

Whether to automatically handle cookies.

var httpShouldUsePipeliningBoolean

Whether to transmit data before receiving a response from an earlier request.

var methodString or null

The HTTP request method of the request: GET, POST, PUT, DELETE, etc.

var urlURL or null

The URL for this fetch request. Much of the additional functionality provided by the fetch request API will only work with http and https URLs. (For example, the method and cache and headers don’t have any effect in the context of a file or omnifocus URL.)

URL.FetchResponse

URL.FetchResponse represents the response from fetching a URL resource, providing additional information about the response such as the HTTP status code and headers along with the actual data for that response. This is a read-only object returned by performing a URL.FetchRequest; see that class for more details on actually performing the request.

Instance Properties

var bodyDataData or null read-only

Returns the raw HTTP body data from this response.

var bodyStringString or null read-only

This is a convenience wrapper which interprets the bodyData of this response as UTF–8 text. (Note: the current implementation assumes the text is encoded using UTF–8, but ideally it would honor the text encoding as reported by textEncodingName.)

var headers → Object read-only

Returns the HTTP header fields for this response.

var mimeTypeString or null read-only

Returns the HTTP MIME type for this response (e.g. text/plain, application/json, etc.).

var statusCodeNumber read-only

Returns the HTTP status code for this response (e.g. 200, 404, etc.).

var textEncodingNameString or null read-only

Returns the reported text encoding for this response. This name will be the actual string reported by the origin source, or null if no encoding was specified.

var urlURL or null read-only

Returns the URL for this response.

URL.QueryItem

Constructors

new URL.QueryItem(name: String, value: String or null)URL.QueryItem

Returns a new URL.QueryItem with the given name and value.

Instance Properties

var nameString read-only

var valueString or null read-only

Version

Constructors

new Version(versionString: String)Version

Parses a string representation of a Version and returns an instance, or throws an error if the string isn’t a valid version.

Instance Functions

function equals(version: Version)Boolean

Returns true if the receiving Version is equal to the argument Version.

function atLeast(version: Version)Boolean

Returns true if the receiving Version is at the same as or newer than the argument Version.

function isAfter(version: Version)Boolean

Returns true if the receiving Version is strictly after the argument Version.

function isBefore(version: Version)Boolean

Returns true if the receiving Version is strictly before the argument Version.

Instance Properties

var versionStringString read-only

Returns as an opaque string representation of the Version, suitable for display or logging. This should never be used in comparisons of any sort.

VerticalAlignment

Class Properties

var BottomVerticalAlignment read-only

Align to bottom edges.

var CenterVerticalAlignment read-only

Align to vertical centers.

var TopVerticalAlignment read-only

Align to top edges.

var allArray of VerticalAlignment read-only

VerticalTextPlacement

Class Properties

var BottomVerticalTextPlacement read-only

Aligned to the bottom of the shape.

var MiddleVerticalTextPlacement read-only

Centered in the vertical middle of the shape.

var TopVerticalTextPlacement read-only

Aligned to the top of the shape.

var allArray of VerticalTextPlacement read-only

XML

XML.Document

Class Functions

function fromData(data: Data, whitespaceBehavior: XML.WhitespaceBehavior or null)XML.Document

Parse the given data as an XML document.

Constructors

new XML.Document(rootElement: String or XML.Element, configuration: XML.Document.Configuration or null)XML.Document

Returns a new XML.Document with the given root element and configuration.

Instance Functions

function xmlData()Data

Encodes the document as XML.

function addElement(name: String, function: Function(‍‍) or null)

Appends a new element with the given name. If a function is passed, it is pushed it on the current element stack, the supplied function is called, and then the element is popped off the stack.

function appendString(string: String)

Appends the given string as a child of topElement.

function setAttribute(attribute: String, value: String or null)

Sets the specified attribute on topElement.

Instance Properties

var dtdPublicIDString or null read-only

var dtdSystemIDURL or null read-only

var rootElementXML.Element read-only

var schemaIDURL or null read-only

var schemaNamespaceString or null read-only

var stringEncodingStringEncoding read-only

var topElementXML.Element read-only

Returns the element at the top of the current element stack. Intially this is the root element, but when addElement() is called, it is temporarily updated to the new element (possibly recursively).

var whitespaceBehaviorXML.WhitespaceBehavior read-only

XML.Document.Configuration

Constructors

new XML.Document.Configuration()XML.Document.Configuration

Returns a new XML.Document.Configuration with default settings.

Instance Properties

var dtdPublicIDString or null

var dtdSystemIDURL or null

var schemaIDURL or null

var schemaNamespaceString or null

var stringEncodingStringEncoding

var whitespaceBehaviorXML.WhitespaceBehavior or null

XML.Element

Constructors

new XML.Element(name: String)XML.Element

Returns a new XML.Element with the given name.

Instance Functions

function childAtIndex(childIndex: Number)String or XML.Element or null

Returns the child at the given index, or nil if the index is past the last child.

function insertChild(child: String or XML.Element, childIndex: Number)

Inserts the new child at the specified index. If the index is past the end of the current children, it is appended instead.

function appendChild(child: String or XML.Element)

Adds the new item to the end of the children.

function removeChildAtIndex(childIndex: Number)

Removes the child at the given index. If the index is past the end of the current children, no removal occurs.

function removeAllChildren()

Removes any existing children.

function firstChildNamed(name: String)XML.Element or null

Returns the first child element with the given name, or null if there is no such child.

function firstChildAtPath(path: String)XML.Element or null

Given a path which is a string separated by "/", returns the first element at that path.

function firstChildWithAttribute(attribute: String, value: String)XML.Element or null

Returns the first child with an attribute set to the given value.

function attributeNamed(name: String)String or null

Returns the value of the the given attribute or null if no value has been assigned.

function setAttribute(name: String, value: String or null)

Sets the value for the specified attribute. If the element already had a value for this attribute, it is replaced in place. If there previously was no value for this attribute, the attribute is appended to attributeNames. If the new value is null, the attribute is removed.

function apply(function: Function(‍node: String or XML.Element)_omnijs_AnonymousProxy or null)_omnijs_AnonymousProxy or null

Calls the supplied function for each child element or string in the receiver (including the receiver), passing that child as the single argument. The supplied function can optionally return a ApplyResult to skip enumeration of some elements.

Instance Properties

var attributeCountNumber read-only

Returns the number of attributes assigned to this element.

var attributeNamesArray of String read-only

Returns the names of the attributes in the order they were added to the element.

var childrenArray of String or XML.Element

The current child strings and elements.

var childrenCountNumber read-only

Returns the current count of child strings and elements.

var lastChildString or XML.Element or null read-only

Returns the last child of the element, or null if there are no children.

var nameString read-only

Returns the name of the element.

var stringContentsString read-only

Gathers all the immediate and descendent string children and returns them concatenated them as single string.

XML.WhitespaceBehavior

Constructors

new XML.WhitespaceBehavior(defaultBehavior: XML.WhitespaceBehavior.Type)XML.WhitespaceBehavior

Returns a new XML.WhitespaceBehavior with the given default type.

Instance Functions

function setBehaviorForElementName(behavior: XML.WhitespaceBehavior.Type, elementName: String)

function behaviorForElementName(elementName: String)XML.WhitespaceBehavior.Type

Instance Properties

var defaultBehaviorXML.WhitespaceBehavior.Type read-only

XML.WhitespaceBehavior.Type

Class Properties

var AutoXML.WhitespaceBehavior.Type read-only

Inherit the behavior from the enclosing element

var IgnoreXML.WhitespaceBehavior.Type read-only

Ignore whitespace

var PreserveXML.WhitespaceBehavior.Type read-only

Preserve whitespace

var allArray of XML.WhitespaceBehavior.Type read-only