Classes


Alert

An alert panel for displaying information to the user.

Constructors

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

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

Instance Functions

function show(callback:Function)

Bring the alert panel forward to display it.

function addOption(string:String)

No documentation available.

Application

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

Instance Functions

function openDocument(from:Document or nil, url:URL, completed:Function)

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 commandKeyDown → Boolean read-only

No documentation available.

var controlKeyDown → Boolean read-only

No documentation available.

var name → String read-only

Application name.

var optionKeyDown → Boolean read-only

No documentation available.

var platformName → String read-only

No documentation available.

var shiftKeyDown → Boolean read-only

No documentation available.

var stencils → Array of Stencil read-only

List of stencils that OmniGraffle currently has available.

var version → String read-only

Application version number.

Array

A JavaScript Array.

Canvas

No documentation available.

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 nil

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

function graphicWithName(name:String)Graphic or nil

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 nil

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

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

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

Instance Properties

var autosizesDown → Boolean

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

var autosizesLeft → Boolean

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

var autosizesRight → Boolean

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

var autosizesUp → Boolean

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 canvasSizeIsMeasuredInPages → Boolean

No documentation available.

var canvasSizingModeCanvasSizingMode

No documentation available.

var columnAlignmentVerticalAlignment

Setting for how graphics ought to be aligned vertically.

var graphics → Array of Graphic read-only

All graphics upon this canvas.

var gridGrid read-only

Settings for the major and minor grids, if any.

var horizontalPages → Number

Number of printer pages wide.

var id → Number read-only

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

var layers → Array of Layer read-only

All layers of this canvas.

var layoutInfoLayout read-only

The automatic layout information describing how graphics should be arranged.

var name → String

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 sizeSize

Overall size in points.

var spaceBetweenObjectsInColumn → Number

Setting for how graphics ought to be spaced out vertically.

var spaceBetweenObjectsInRow → Number

Setting for how graphics ought to be spaced out horizontally.

var verticalPages → Number

Number of printer pages tall.

CanvasSizingMode

No documentation available.

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.

Color

No documentation available.

Class Functions

function RGB(r:Number, g:Number, b:Number, a:Number or nil)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 nil)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 nil)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 nil

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 alpha → Number read-only

Returns the alpha component of the color.

var blue → Number read-only

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

var brightness → Number 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 green → Number read-only

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

var hue → Number read-only

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

var red → Number read-only

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

var saturation → Number read-only

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

var white → Number read-only

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

ColorSpace

No documentation available.

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.

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)

No documentation available.

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

No documentation available.

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.

Data

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

Class Functions

function fromString(string:String)Data

Convert from a String to the UTF8 encoding of that string as Data

function fromBase64(string:String)Data

No documentation available.

Instance Functions

function toString() → String

Convert to a String, assuming that this Data is encoded as UTF8.

function toBase64() → String

Convert to a Base–64 encoded string.

Instance Properties

var length → Number or nil read-only

Number of bytes in this data.

Document

No documentation available.

Class Functions

function makeNew(resultFunction:Function)

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. The resultFunction will be passed either the new document or an Error if there was a problem creating the document.

function makeNewAndShow(resultFunction:Function)

Create a new document and presents it. The resultFunction will be passed either the new document or an Error if there was a problem creating the document.

Instance Functions

function close(didCancel:Function or nil)

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 nil)FileWrapper

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 undo()

Undo the last done action.

function redo()

Redo the last undone action.

function show(resultFunction:Function or nil)

Presents the document, ordering the window forward on macOS, and possibly closing the existing document and opening the new on on iOS.

Instance Properties

var canRedo → Boolean read-only

Whether there are currently any actions that can be redone.

var canUndo → Boolean read-only

Whether there are currently any actions that can be undone.

var fileType → String or nil read-only

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

var name → String or nil read-only

Document name.

var writableTypes → Array of String read-only

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

FileWrapper

No documentation available.

Class Functions

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

No documentation available.

Instance Functions

function filenameForChild(child:FileWrapper) → String or nil

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.

Instance Properties

var children → Array of FileWrapper read-only

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

var contentsData or nil read-only

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

var destinationURL or nil read-only

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

var filename → String or nil

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 preferredFilename → String or nil

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.Type

No documentation available.

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.

FillType

No documentation available.

Class Properties

var LinearFillType read-only

Linear Gradient.

var MarkerFillType read-only

Marker.

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.

Function

An object that represents a JavaScript function. This exists to allow exported API to declare that it wants a Function, not just any Object.

GraffleDocument: Document

An OmniGraffle document.

Instance Properties

var portfolioPortfolio read-only

No documentation available.

var windows → Array of NSWindow read-only

No documentation available.

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 nil)

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

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

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.

Instance Properties

var actionURLURL or nil

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

var alignsEdgesToGrid → Boolean

Align edges or center to the grid.

var allowsConnections → Boolean

Allow line connections to this graphic.

var automationAction → Array 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 connectedLines → Array of Line read-only

An array of all Line graphics connected to this graphic.

var cornerRadius → Number

Corner radius of the stroke.

var flippedHorizontally → Boolean

Is this graphic flipped horizontally?

var flippedVertically → Boolean

Is this graphic flipped vertically?

var geometryRect

The bounds rectangle of this graphic.

var id → Number 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 incomingLines → Array of Line read-only

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

var layerLayer or nil

The layer this graphic is on.

var locked → Boolean

Whether this graphic is locked.

var name → String or nil

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 notes → String

Notes attached to this graphic.

var outgoingLines → Array of Line read-only

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

var plasticCurve → Number or nil

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

var plasticHighlightAngle → Number or nil

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

var rotation → Number

Rotation of this graphic.

var shadowColorColor or nil

Color of the shadow.

var shadowFuzziness → Number

Fuzziness of the shadow.

var shadowVectorPoint

Direction and length of the shadow.

var strokeCapLineCap

Type of end cap on the stroke.

var strokeColorColor or nil

Color of the stroke.

var strokeJoinLineJoin

Type of join on segments of the stroke.

var strokePatternStrokeDash

Dash pattern of the stroke.

var strokeThickness → Number

Thickness of the stroke in points.

var strokeTypeStrokeType or nil

Type of stroke (the outline around the graphic).

var userData → Object

User data for this graphic

GraphicView

The view of the canvas in an OmniGraffle window.

Instance Functions

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

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 drawsInFront → Boolean

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

var majorColorColor

Color of the major grid lines.

var majorSpacing → Number

Number of minor grid squares between each major grid line.

var minorColorColor

Color of the minor grid lines.

var snaps → Boolean

Whether graphics on the canvas snap to the grid.

var spacing → Number

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

var visible → Boolean

Whether the grid is currently visible or invisible.

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 connectToGroupOnly → Boolean

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

var graphics → Array of Graphic read-only

An array of graphics contained inside the group.

var magnets → Array of Point

Connection magnets on the group.

HierarchicalDirection

No documentation available.

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.

HopType

No documentation available.

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).

HorizontalAlignment

No documentation available.

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.

HorizontalTextAlignment

No documentation available.

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.

Image

No documentation available.

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 nil read-only

The image data bytes.

var originalSizeSize read-only

Original size of the image in pixels.

var uniqueID → Number read-only

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

ImageSizing

No documentation available.

Class Properties

var ManualImageSizing read-only

Manual.

var StretchedImageSizing read-only

Stretched.

var TiledImageSizing read-only

Tiled.

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 graphics → Array of Graphic read-only

All graphics in this layer.

var locked → Boolean

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

var name → String

Name of this layer.

var prints → Boolean

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

var visible → Boolean

Whether graphics on this layer are visible.

Layout

Graphic layout information for a canvas.

Instance Properties

var automaticLayout → Boolean

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

var circularLineLength → Number

Optimum line length to try to achieve during circular layout.

var directionHierarchicalDirection

The hierarchical layout orientation.

var forceDirectedLineLength → Number

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

var forceDirectedSeparation → Number

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

var objectSeparation → Number

Distance between graphics at the same level during hierarchical layout.

var radialSeparation → Number

Distance between graphics during radial layout.

var rankSeparation → Number

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

No documentation available.

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.

Line: Graphic

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

Class Properties

var allLineEndingTypes → Array of String read-only

No documentation available.

Instance Properties

var bezierPoints → Array 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 nil

Graphic attached to the head of this line.

var headMagnet → Number

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

var headScale → Number

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

var headType → String

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 lineTypeLineType

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

var points → Array of Point

Array of control points for this line in canvas coordinates.

var tailGraphic or nil

Graphic attached to the tail of this line.

var tailMagnet → Number

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

var tailScale → Number

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

var tailType → String

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

LineCap

No documentation available.

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.

LineJoin

No documentation available.

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.

LineType

No documentation available.

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.

NSWindow

No documentation available.

Instance Functions

function close()

No documentation available.

Instance Properties

var centerVisiblePointPoint

No documentation available.

var selectionSelection read-only

No documentation available.

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 children → Array of OGOutlineNode read-only

Child nodes of this node.

var graphicGraphic or nil read-only

Graphic that this outline node represents.

Object

An object to be exported to JavaScript. This keeps the value alive in JavaScript and so should not be held onto for long (since it will create retain cycles).

PlugIn

No documentation available.

Class Functions

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

No documentation available.

Class Properties

var all → Array of PlugIn read-only

No documentation available.

Instance Functions

function library(identifier:String)Object or nil

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

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

No documentation available.

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

No documentation available.

function resourceNamed(name:String)URL or nil

No documentation available.

function imageNamed(name:String)Image or nil

No documentation available.

Instance Properties

var URLURL or nil read-only

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

var actions → Array of PlugIn.Action read-only

No documentation available.

var displayName → String read-only

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

var handlers → Array of PlugIn.Handler read-only

No documentation available.

var identifier → String read-only

The unique identifier of the PlugIn.

var libraries → Array of PlugIn.Library read-only

No documentation available.

var versionVersion read-only

Returns the current Version for the PlugIn.

PlugIn.Action

No documentation available.

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 name → String read-only

Returns the name of the PlugIn.Action.

var performFunction read-only

No documentation available.

var plugInPlugIn read-only

Returns the PlugIn that contains this object.

var validateFunction or nil

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

No documentation available.

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 name → String read-only

Returns the name of the PlugIn.Handler.

var plugInPlugIn read-only

Returns the PlugIn that contains this object.

var willAttachFunction or nil

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 nil

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

No documentation available.

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 name → String 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

No documentation available.

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 length → Number 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 x → Number

The horizontal axis coordinate of the Point.

var y → Number

The vertical axis coordinate of the Point.

Portfolio

A Portfolio represents the main contents of an OmniGraffle Document and is used as the global object in any scripting session that is related to a particular document.

Instance Functions

function addCanvas()Canvas or nil

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

function addImage(data:Data)ImageReference or nil

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 nil

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

Instance Properties

var canvases → Array of Canvas read-only

List of canvases in the portfolio.

var documentGraffleDocument or nil read-only

No documentation available.

var images → Array 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.

Rect

No documentation available.

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

No documentation available.

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

No documentation available.

function union(rect:Rect)Rect

No documentation available.

function intersect(rect:Rect)Rect

No documentation available.

function containsRect(rect:Rect) → Boolean

No documentation available.

function containsPoint(point:Point) → Boolean

No documentation available.

function intersects(rect:Rect) → Boolean

No documentation available.

Instance Properties

var centerPoint read-only

No documentation available.

var height → Number

No documentation available.

var integralRect read-only

No documentation available.

var isEmpty → Boolean read-only

No documentation available.

var isInfinite → Boolean read-only

No documentation available.

var isNull → Boolean read-only

No documentation available.

var maxX → Number read-only

No documentation available.

var maxY → Number read-only

No documentation available.

var midX → Number read-only

No documentation available.

var midY → Number read-only

No documentation available.

var minX → Number read-only

No documentation available.

var minY → Number read-only

No documentation available.

var originPoint

No documentation available.

var sizeSize

No documentation available.

var standardizedRect read-only

No documentation available.

var width → Number

No documentation available.

var x → Number

No documentation available.

var y → Number

No documentation available.

Selection

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

Instance Properties

var canvasCanvas or nil read-only

The currently selected canvas.

var documentGraffleDocument or nil read-only

The current document whose graphics are selected.

var graphics → Array of Graphic read-only

The currently selected graphics.

var lines → Array of Line read-only

The subset of the currently selected graphics which are lines.

var solids → Array of Solid read-only

The subset of the currently selected graphics which are solids.

var viewGraphicView or nil read-only

The current view containing the selection.

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 shape → String or nil

Name of the shape for this graphic.

var shapeControlPoints → Array 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 shapeVertices → Array of Point

Array of vertices for this shape.

Size

No documentation available.

Constructors

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

Returns a new Size with the specified width and height.

Instance Properties

var height → Number

No documentation available.

var width → Number

No documentation available.

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 blendColorColor or nil

The middle color of a three color gradient fill, if the fill style includes such.

var blendFraction → Number

The middle fraction of a three color gradient fill, if the fill style includes such.

var fillColorColor or nil

Color of the fill for this graphic.

var fillTypeFillType or nil

Style of fill for this graphic.

var fontName → String

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 gradientAngle → Number

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

var gradientCenterPoint

For radial gradients, the position of the center of the gradient.

var gradientColorColor or nil

For gradient fills, the second color (along with the fill color) that the fill goes between.

var imageImageReference or nil

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 imageOpacity → Number

Opacity percentage for the image fill for this graphic.

var imagePage → Number

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 magnets → Array of Point

Array of connection magnets for this graphic.

var text → String

Text contents of this graphic.

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 textGeometryRect read-only

Drawing bounds of the text in canvas coordinates.

var textHorizontalAlignmentHorizontalTextAlignment

Alignment of the text in this graphic horizontally.

var textHorizontalPadding → Number

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

var textRotation → Number

Rotation of the text.

var textRotationIsRelative → Boolean

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

var textSize → Number

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 textVerticalPadding → Number

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 textWraps → Boolean

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

var tripleBlend → Boolean

Whether the fill includes three colors in a gradient.

Stencil

A stencil containing graphics that can be copied to documents.

Instance Functions

function load(completed:Function)

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

Instance Properties

var graphics → Array of Graphic read-only

Array of graphics available on the stencil.

var images → Array 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 isLoaded → Boolean read-only

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

var name → String read-only

Name of the stencil.

StrokeDash

No documentation available.

Class Properties

var Dash10on3off2on3offStrokeDash read-only

No documentation available.

var Dash10on3off2on3off2on3offStrokeDash read-only

No documentation available.

var Dash16on9offStrokeDash read-only

Sixteen point dash segments with nine point gaps.

var Dash16on9off16on9off1on9offStrokeDash read-only

No documentation available.

var Dash16on9off1on9offStrokeDash read-only

No documentation available.

var Dash16on9off1on9off1on9offStrokeDash read-only

No documentation available.

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

No documentation available.

var Dash20on5off4on5off4on5offStrokeDash read-only

No documentation available.

var Dash2on2offStrokeDash read-only

No documentation available.

var Dash40on9off8on9offStrokeDash read-only

No documentation available.

var Dash40on9off8on9off8on9offStrokeDash read-only

No documentation available.

var Dash4on3off1on3offStrokeDash read-only

No documentation available.

var Dash4on3off1on3off1on3offStrokeDash read-only

No documentation available.

var Dash4on3off4on3off1on3offStrokeDash read-only

No documentation available.

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

No documentation available.

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

No documentation available.

var SolidStrokeDash read-only

Solid stroke with no dash pattern.

StrokeType

No documentation available.

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.

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

No documentation available.

Instance Properties

var backgroundSolid read-only

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

var collapsed → Boolean

Whether this subgraph is currently collapsed.

var subgraphics → Array 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

No documentation available.

Constructors

new Table(graphic:Graphic)Table

No documentation available.

Instance Functions

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

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 columns → Number

Number of columns in the table.

var rows → Number

Number of rows in the table.

TextAutosizing

No documentation available.

Class Properties

var ClipTextAutosizing read-only

Clip.

var FullTextAutosizing read-only

Full.

var OverflowTextAutosizing read-only

Overflow.

var VerticalTextAutosizing read-only

Vertical.

Timer

No documentation available.

Class Functions

function once(interval:Number, action:Function)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

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()

No documentation available.

Instance Properties

var interval → Number read-only

No documentation available.

URL

No documentation available.

Class Functions

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

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

function chooseFolder()URL or nil

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

function fromString(string:String)URL or nil

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

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

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

Instance Functions

function fetch(callback:Function)

Get the contents at the destination of this URL.

function call(success:Function)

No documentation available.

function toString() → String

No documentation available.

Instance Properties

var string → String or nil read-only

String representation of this URL.

Version

No documentation available.

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 versionString → String 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

No documentation available.

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.

VerticalTextPlacement

No documentation available.

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.