Automate Dottie with AppleScript on Mac

Experimental: AppleScript support is a work in progress—command names and behaviour may change between versions, and scripts written today may need updating later.

Dottie is scriptable. Open its dictionary in Script Editor (File > Open Dictionary) to browse the Dottie Suite alongside the standard document commands. macOS lets you write scripts in either AppleScript or JavaScript—choose the language from the pop-up menu at the top left of a Script Editor document window.

What you can script

These are all Dottie Suite commands, not properties—use get/set command pairs (for example get zoom and set zoom) rather than property syntax.

Example

tell application "Dottie"
	tell front document
		set tool "Pencil"
		set brush size 1
		draw rectangle x 4 y 4 width 24 height 16
	end tell
end tell

Setup and history

CommandDescription
get zoom / set zoom

Get or set the zoom factor.

get tool / set tool

Get or set the current tool by name.

get brush size / set brush size

Get or set the brush size in pixels (1–16).

set canvas size

Set the canvas width and height.

get canvas size

Get the canvas dimensions as a list.

clear layer

Clear the currently selected layer.

undo / redo

Undo or redo the last operation.

begin undo group / end undo group

Wrap the commands in between as a single named undo step.

Drawing

CommandDescription
move highlight

Move the highlight cursor by direction or to an x/y position.

highlight on / highlight off

Show or hide the highlight overlay.

set pixel at highlight

Set the pixel at the highlight to primary, secondary, or eraser.

draw at highlight

Draw at the highlight with the current brush size, shape, and tool.

draw line

Draw a line between two points with the current brush.

draw rectangle / draw oval

Draw a shape in a bounding box.

fill at

Flood fill at a point with the primary colour.

Colour

CommandDescription
select next color / select previous color

Step through the palette.

add color

Add a new colour to the palette.

set color

Set one or more RGBA components of the current colour.

get pixel color

Get the colour of a pixel on the active layer.

Layers

CommandDescription
layer count

Get the number of layers in the document.

add layer / delete layer

Add a layer, or delete one by 1-based index.

select layer

Select a layer by 1-based index.

get layer name

Get a layer's name by 1-based index.

set layer visible

Set a layer's visibility by 1-based index.

set layer opacity

Set a layer's opacity (0–100) by 1-based index.

Frames and animation

CommandDescription
use frames

Enter frames mode, one frame per layer (requires at least 2 layers).

frame count

Get the number of frames (0 = not in frames mode).

get current frame / select frame

Get or set the current 1-based frame index.

add frame

Add a new frame after the current one.

duplicate frame / delete frame

Duplicate or delete a frame (current frame if no index given).

get frame duration / set frame duration

Get or set a frame's duration in milliseconds (0 = document default).

start animation / stop animation

Start or stop the animation preview.

Export

CommandDescription
export image

Write a composited PNG of the document to disk, at an optional integer pixel scale.

See also