This page documents the frameref API available to Luau scripts and plugins in FrameRef 1.3.0. Every function is listed with its parameters, return type, and behavior, and each section includes commented example scripts.
The generated stubs list the exact signatures available in your installed build. Use Scripts → Export Scripting Stubs… to write frameref.d.luau for editor completion, or Scripts → MCP Integration… and frameref_help(topic="api") to read the live definitions.
The tables use Luau type notation. Optional values end in ?, arrays use {T}, and nil means “no value”.
Alias
Definition
Description
Item
live item handle
A handle to an item on a board. It is not a copy.
ItemArg
Item or string
An item handle or an item UID.
ItemList
{ItemArg}
A Lua array of item handles and/or UID strings.
Vec2
{ x: number, y: number }
A point in scene coordinates.
ItemType
one of the values under Item types
An item type string.
Color
string or { r: number, g: number, b: number, a: number }
Color value with 0–255 channels. Reads use #aarrggbb; writes accept hex strings or RGBA tables.
Rect
{ x: number, y: number, width: number, height: number }
Axis-aligned rectangle.
Transform
{ m11: number, m12: number, m21: number, m22: number, dx: number, dy: number }
2D affine transform.
Enum
number or string
Enum or flags value. Pass a numeric value or an enum key; reads may return the key string.
PointArg
Vec2 or Item
A point or another item whose visual center is used.
FindFilter
table with type, labelContains, tag, tags, uid, limit
Options for items.find. See Find filter .
ImportOptions
{ x: number?, y: number?, spread: number? }
Placement and spacing for items.import.
PositionOptions
{ x: number?, y: number? }
Placement for created items or imported URLs.
CaptureOptions
{ maxSize: number?, format: string? }
Image capture options.
ArrangeMode
"bfdw", "bfdh", "mer", "added_date", "file_creation_date", "file_modification_date", "file_name"
Layout mode for items.arrange.
AlignMode
"left", "right", "top", "bottom", "vertical_center", "horizontal_center"
Alignment mode for items.align.
Orientation
"horizontal" or "vertical"
Distribution axis.
EventName
one of the event names listed under Events
Event subscription name.
Other conventions:
Arrays use Lua’s 1-based indexing.
Coordinates are in scene units. Rotation is in degrees. Opacity is 0 to 1.
Unless stated otherwise, functions that change the board are undoable.
Events, asynchronous callbacks, and plugin storage are only available to plugin actions, not to one-off console runs.
Name
Type
Description
frameref.version
string
The FrameRef application version.
frameref.apiVersion
number
The scripting API version. This reference documents version 1.
Function
Parameters
Returns
Description
frameref.log(message)
message: string
nil
Write a message to the Script Console output.
frameref.notify(message)
message: string
nil
Show a short FrameRef notification.
frameref.search(query)
query: string
{SearchResult}
Search the active board for items and actions. The query is a plain string, for example "cover".
-- Print the application version and the scripting API version.
print (frameref. version , frameref. apiVersion )
-- Write a diagnostic line to the Script Console output.
frameref. log ( "Starting batch update" )
-- Show a short toast notification in the main window.
frameref. notify ( "Batch update started" )
Function
Parameters
Returns
Description
frameref.boards.active()
—
Board?
The board in the active tab, or nil when no board is open.
frameref.boards.list()
—
{Board}
Every board open in a tab, in tab order.
frameref.boards.activate(boardId)
boardId: string
boolean
Switch to the tab that owns the given board ID. Returns false when the board is not open.
Board properties are read-only.
Property
Type
Writable
Description
id
string
No
Stable board ID.
title
string
No
Board title shown in the tab.
path
string
No
Path of the board’s .frameref file.
readOnly
boolean
No
Whether the board is open in read-only mode.
dirty
boolean
No
Whether the board has unsaved changes.
Function
Parameters
Returns
Description
board:items()
—
{Item}
Every item on the board.
board:selection()
—
{Item}
The board’s current selection.
board:snapshot()
—
table
Plain data: id, title, readOnly, dirty, and items (an array of item snapshots).
board:save()
—
boolean
Save the board.
board:saveAs(path)
path: string
Future<boolean>
Save the board to a new file.
board:undo()
—
nil
Undo the last step on this board.
board:redo()
—
nil
Redo the last undone step on this board.
board:frame(items?)
items: ItemList?
nil
Frame the given items, or the current selection when omitted.
board:activate()
—
boolean
Switch to this board’s tab.
-- Get every board that is currently open in a tab.
local boards = frameref. boards . list ()
-- Loop over the open boards in tab order.
for _, board in boards do
-- Read a plain-data summary of the board.
local snapshot = board : snapshot ()
-- Print the board title and its item count.
print (snapshot. title , # snapshot. items )
-- Get the board in the active tab.
local active = frameref. boards . active ()
-- Stop when no board is open.
-- Find another open board by title.
for _, board in frameref. boards . list () do
if board. title == "Shot References" then
-- Make that board's tab active.
Function
Parameters
Returns
Description
frameref.selection.items()
—
{Item}
The selected items on the active board.
frameref.selection.uids()
—
{string}
The UIDs of the selected items.
frameref.selection.set(items)
items: ItemList
nil
Replace the selection with the given items.
frameref.selection.clear()
—
nil
Clear the selection.
frameref.selection.add(items)
items: ItemList
nil
Add the given items to the selection.
frameref.selection.remove(items)
items: ItemList
nil
Remove the given items from the selection.
-- Find up to ten image items on the active board.
local images = frameref. items . find ({ type = "image" , limit = 10 })
-- Replace the current selection with those images.
frameref. selection . set (images)
-- Read the selected items back from the board.
for _, item in frameref. selection . items () do
-- Print the label of each selected image.
Function
Parameters
Returns
Description
frameref.items.all()
—
{Item}
Every item on the active board.
frameref.items.find(filter?)
filter: FindFilter?
{Item}
Filter items by type, tags, label, UID, or result limit.
frameref.items.get(uid)
uid: string
Item?
Look up one item by UID. Returns nil when it does not exist.
Key
Type
Optional
Description
type
string
Yes
Match one item type. See Item types .
labelContains
string
Yes
Case-insensitive substring match on the item label.
tag
string or {string}
Yes
Require one or more tags.
tags
{string}
Yes
Same as tag; all listed tags must match.
uid
string
Yes
Match one UID.
limit
number
Yes
Stop after this many matches. 0 or omitted means no limit.
-- Find images that have the "cover" tag and "hero" in the label.
local covers = frameref. items . find ({
-- Print how many matches the filter returned.
print ( "Matches:" , # covers)
Function
Parameters
Returns
Description
frameref.items.import(paths, options?)
paths: string or {string}, options: ImportOptions?
{Item}
Import local files. spread offsets each file from the origin and defaults to 20.
frameref.items.importUrl(url, options?)
url: string, options: PositionOptions?
Item?
Import a URL as media.
frameref.items.createText(html, options?)
html: string, options: PositionOptions?
Item?
Create a text item from HTML.
frameref.items.createNote(options?)
options: PositionOptions?
Item?
Create a note item.
frameref.items.createColorSwatch(color, options?)
color: string, options: PositionOptions?
Item?
Create a color swatch from a color string such as "#ff8800".
-- Import two files and offset each one by 240 scene units.
local imported = frameref. items . import (
{ "C:/refs/one.png" , "C:/refs/two.png" },
{ x = 0 , y = 0 , spread = 240 }
-- Print how many files were imported.
print ( "Imported:" , # imported)
-- Create a text block at the right of the imported images.
frameref. items . createText ( "<b>Notes</b>" , { x = 1200 , y = 0 })
-- Create an empty note below the text block.
frameref. items . createNote ({ x = 1200 , y = 240 })
-- Create an orange color swatch below the note.
frameref. items . createColorSwatch ( "#ff8800" , { x = 1200 , y = 480 })
Function
Parameters
Returns
Description
frameref.items.delete(items)
items: ItemList
nil
Delete the given items.
frameref.items.duplicate(items)
items: ItemList
{Item}
Duplicate the given items and return the new handles.
frameref.items.group(items)
items: ItemList
Item?
Group the given items into a new group and return its handle.
frameref.items.ungroup(items)
items: ItemList
nil
Remove the given groups while keeping their children on the board.
-- Find every group item on the active board.
local groups = frameref. items . find ({ type = "group" })
-- Remove the groups without deleting their children.
frameref. items . ungroup (groups)
Function
Parameters
Returns
Description
frameref.items.arrange(items, mode, spacing?)
items: ItemList, mode: ArrangeMode, spacing: number?
nil
Arrange the given items using the selected layout mode.
frameref.items.align(items, mode)
items: ItemList, mode: AlignMode
nil
Align the given items to an edge or center.
frameref.items.distribute(items, orientation, spacing?)
items: ItemList, orientation: Orientation, spacing: number?
nil
Distribute the given items horizontally or vertically.
frameref.items.bringToFront(items)
items: ItemList
nil
Bring the given items to the front.
frameref.items.sendToBack(items)
items: ItemList
nil
Send the given items to the back.
Arrangement modes:
Mode
Description
"bfdw"
Best Fit Decreasing Width.
"bfdh"
Best Fit Decreasing Height.
"mer"
Maximal Empty Rectangles.
"added_date"
Sort by the date the item was added.
"file_creation_date"
Sort by source file creation date.
"file_modification_date"
Sort by source file modification date.
"file_name"
Sort by source file name.
Alignment modes: "left", "right", "top", "bottom", "vertical_center", "horizontal_center".
Distribution orientations: "horizontal" and "vertical".
-- Find every image on the active board.
local images = frameref. items . find ({ type = "image" })
-- Arrange the images into maximal empty rectangles with 24 units of spacing.
frameref. items . arrange (images, "mer" , 24 )
-- Align the arranged images along their top edges.
frameref. items . align (images, "top" )
Properties are resolved on the item’s class hierarchy at runtime. Every item type shares the base properties, and some types build on another type. For example, muted exists on video and audio items, but not on image items.
Read directly with item.muted or dynamically with item:get("muted"). A name that the item’s type does not support returns nil.
Write directly with item.muted = true or dynamically with item:set("muted", true). An unknown, read-only, or unconvertible name raises a Lua error.
Property names are case-sensitive. item:setProperties writes several values at once; if a key is invalid, the call raises and earlier keys may already be applied.
Property writes are undoable and join the current script run’s undo step.
item:snapshot() returns a plain-data copy of the common fields, plus filePath for file-backed items and annotationPath for image items. It does not include other type-specific properties; read those from the item handle.
Item type
Inherits
image
base
video, gif, pdf
base + image
audio, text, note, todo, group, shape, color_swatch, portal, weblink, edge, line, svg
base
Internal helper items that are not one of the types above report type = "item" and use only the base properties.
Color values read as #aarrggbb. Set them with a CSS-style hex string such as "#ff8800" or "#80ff8800", or with a table { r = 255, g = 136, b = 0, a = 255 }.
Vec2 values use { x = ..., y = ... }; Rect values use { x = ..., y = ..., width = ..., height = ... }.
Transform values use { m11 = ..., m12 = ..., m21 = ..., m22 = ..., dx = ..., dy = ... }.
UUID properties accept strings. Empty strings clear optional links.
Enum properties accept the numeric values listed in the type sections. Reads may return the enum key name, such as "SolidLine" or "ArrowHeadType_Arrow".
QJsonArray properties such as todoRows and compositionOverlays accept Lua arrays and tables.
Core properties
Property
Type
Writable
Description
uid
string
No
Stable item ID. Treat it as read-only.
type
ItemType
No
Item type. See Item types .
label, caption
string
Yes
Visible label or caption. caption is an alias for label. For groups, both map to labelText.
tags
{string}
Yes
Search tags.
rating
number
Yes
Rating from 0 to 5.
x, y
number
Yes
Scene position.
rotation
number
Yes
Scene rotation in degrees.
scale
number
Yes
Scene scale factor.
width, height
number
Yes
Size in scene units.
z, zDepth
number
Yes
Stacking order. z is the script alias.
opacity, itemOpacity
number
Yes
Opacity, clamped to 0.01–1.
locked
boolean
Yes
Whether the transform is locked.
visible
boolean
Yes
Whether the item is rendered.
sourceURL
string
Yes
Original web URL. Setting it does not download anything.
Appearance properties
Property
Type
Writable
Description
antialiased
boolean
Yes
Antialiased rendering.
cornerRadius
number
Yes
Corner radius. Used by rectangle shapes and rounded item rendering.
borderWidth
number
Yes
Border width in scene units.
borderColor
Color
Yes
Border color.
borderStyle
Enum
Yes
Qt::PenStyle: 0 NoPen, 1 SolidLine, 2 DashLine, 3 DotLine, 4 DashDotLine, 5 DashDotDotLine, 6 CustomDashLine.
backgroundColor
Color
Yes
Background fill color.
centerHtml
string
Yes
HTML drawn in the item center.
drawGrayscale
boolean
Yes
Render image media in grayscale.
Advanced properties
Property
Type
Writable
Description
createdAt
number
Yes
Creation time in milliseconds since the Unix epoch.
itemTransform
Transform
Yes
Full scene transform. Prefer x, y, rotation, and scale unless you need to set the matrix directly.
cropOffset
Vec2
Yes
Crop offset for media items.
normalizedCropRegion
Rect
Yes
Crop region in normalized 0–1 source coordinates. Media items only.
isCropped
boolean
Yes
Whether the crop region is active. Media items only.
compositionOverlays
{table}
Yes
Persisted composition-overlay stack. See Composition Overlays .
forceHighResRender
boolean
Yes
Temporary full-resolution render override. It is not saved with the board.
These properties come from the shared image item class. The image type uses only the base and image-family properties; the video, gif, and pdf sections below list their additional properties.
Property
Type
Writable
Description
filePath
string
Yes
Source file path. Setting it relinks the item; external files can be copied into the board’s content folder.
downloadUrl, downloadURL
string
Yes
Original download URL. downloadURL is an alias. Setting it does not start a download.
annotationPath
string
Yes
Annotation side-car path. The annotation overlay and animation tags read from this file.
localZoomPan
Transform
Yes
Item-internal pan/zoom applied to the media.
Inherits base and image-family properties. Adds:
Property
Type
Writable
Description
playing
boolean
Yes
Whether playback is active.
seekTime
number
Yes
Normalized playhead position, 0–1.
playbackRate
number
Yes
Playback speed. Values at or below 0 clamp to 0.1.
volume
number
Yes
Audio volume, clamped to 0–1.
muted
boolean
Yes
Whether audio is muted.
positionMs
number
Yes
Absolute playhead position in milliseconds.
codecName
string
Yes
Stored codec metadata.
playbackTagId
string
Yes
UUID of the annotation animation tag to constrain playback to. Use an empty string to clear it.
Inherits base and image-family properties. Adds:
Property
Type
Writable
Description
playing
boolean
Yes
Whether playback is active.
seekTime
number
Yes
Normalized playhead position, 0–1.
playbackRate
number
Yes
Playback speed. Values at or below 0 clamp to 0.1.
playbackTagId
string
Yes
UUID of the annotation animation tag to constrain playback to. Use an empty string to clear it.
GIFs follow the same annotation tag and playback-range behavior as videos, but do not expose volume or muted.
Inherits base and image-family properties. Adds:
Property
Type
Writable
Description
seekTime
number
Yes
Normalized page position, where 0 is the first page and 1 is the last page.
PDF items do not expose playing, playbackRate, volume, or muted; use seekTime to select a page.
Inherits base properties. Adds:
Property
Type
Writable
Description
filePath
string
Yes
Source audio file. Setting it relinks the item.
autoLoop
boolean
Yes
Whether the item loops automatically.
playing
boolean
Yes
Whether playback is active.
seekTime
number
Yes
Normalized playhead position, 0–1.
playbackRate
number
Yes
Playback speed. Values at or below 0 clamp to 0.1.
volume
number
Yes
Audio volume, clamped to 0–1.
muted
boolean
Yes
Whether audio is muted.
Inherits base properties. Adds:
Property
Type
Writable
Description
html
string
Yes
Rich-text HTML content.
textAlignment
Enum
Yes
Qt horizontal alignment flags. Common values: 1 left, 2 right, 4 center, 8 justify. Reads may return keys such as "AlignLeft".
clipText
boolean
Yes
Whether text is clipped to the item bounds.
Inherits base properties. Adds:
Property
Type
Writable
Description
displayTitle
string
Yes
Title shown in the note preview.
noteColor
Color
Yes
Note accent color.
The side-car note ID is listed under Advanced and limited-support properties .
Inherits base properties. Adds:
Property
Type
Writable
Description
title
string
Yes
Card title.
todoRows
{table}
Yes
Array of rows. Each row is { id: string?, text: string, done: boolean, depth: number }. Missing id values are generated; depth is 0–4.
Inherits base properties. Adds:
Property
Type
Writable
Description
labelText
string
Yes
Visible group name. For groups, label and caption map to this property.
groupColor
Color
Yes
Group header and accent color.
audioCycling
boolean
Yes
Whether the group cycles through its audio items.
children
{string}
No
Child UIDs. Read-only alias for childrenIds.
To change group membership, prefer frameref.items.group and frameref.items.ungroup. The writable childrenIds set is listed under Advanced and limited-support properties .
Inherits base properties. Adds:
Property
Type
Writable
Description
currentShape
string
Yes
Shape ID: "rectangle" or "circle". Unknown IDs render no shape.
Inherits base properties. Adds:
Property
Type
Writable
Description
color
Color
Yes
Swatch color.
displayFormat
number
Yes
0 Hex, 1 RGBA, 2 HSL, 3 Off.
showCaption
boolean
Yes
Whether the color text is shown.
Inherits base properties. Adds:
Property
Type
Writable
Description
linkedItemUid
string
Yes
UID of the linked portal item. Use an empty string to clear it.
variant
Enum
Yes
0 PortalVariantA, 1 PortalVariantB.
portalZoom
number
Yes
Pinned zoom used when teleporting to the peer. 0 uses the current canvas zoom.
Inherits base properties. Adds:
Property
Type
Writable
Description
linkTitle
string
Yes
Card title.
linkDescription
string
Yes
Card description.
siteName
string
Yes
Site name shown in the footer.
canonicalUrl
string
Yes
Canonical URL of the linked page.
previewImagePath
string
Yes
Cached preview image path.
faviconPath
string
Yes
Cached favicon path.
customImage
boolean
Yes
Marks the preview as user-supplied so refreshes do not overwrite it.
showFooter
boolean
Yes
Whether the favicon and site footer are drawn.
localZoomPan
Transform
Yes
Pan/zoom applied to the preview image only.
Inherits base properties. Adds:
Property
Type
Writable
Description
fromItemUid
string
Yes
UID of the source item. An empty string detaches the endpoint.
fromItem
string?
No
Read-only alias for fromItemUid; nil when detached.
fromSide
number
Yes
Source side: 0 top, 1 right, 2 bottom, 3 left.
toItemUid
string
Yes
UID of the target item. An empty string detaches the endpoint.
toItem
string?
No
Read-only alias for toItemUid; nil when detached.
toSide
number
Yes
Target side: 0 top, 1 right, 2 bottom, 3 left.
color
Color
Yes
Line color.
direction
number
Yes
0 non-directional, 1 unidirectional, 2 bidirectional.
Inherits base properties. Adds:
Property
Type
Writable
Description
lhsPoint
Vec2
Yes
Left endpoint in item-local coordinates.
rhsPoint
Vec2
Yes
Right endpoint in item-local coordinates.
color
Color
Yes
Line color.
leftArrowHeadType
Enum
Yes
Left arrowhead.
rightArrowHeadType
Enum
Yes
Right arrowhead.
Arrowhead values are 0 none, 1 circle, 2 filled circle, 3 diamond, 4 filled diamond, 5 arrow, 6 opened arrow, 7 filled arrow, 8 bar, 9 crows-foot one, 10 crows-foot many, and 11 crows-foot one-or-many. Reads may return keys such as "ArrowHeadType_Arrow". The serialized constraints map is listed under Advanced and limited-support properties .
Inherits base properties. Adds:
Property
Type
Writable
Description
svgPath
string
Yes
Source SVG path. Setting it relinks the drawing.
drawing
boolean
Yes
Marks the item as a drawing.
drawingContentBounds
Rect
Yes
Drawing content bounds in item-local coordinates.
strokeColor
Color
Yes
Stroke color used while drawing.
filePath reads the same source path, but svgPath is the writable property. The serialized collision polygon is listed under Advanced and limited-support properties .
These type-specific properties are serialized or internal and are rarely needed in scripts.
Property
Applies to
Type
Notes
childrenIds
group
{string}
Writable child UID set. Reading it through get is not reliable; use children. Prefer frameref.items.group and frameref.items.ungroup.
noteId
note
string
Side-car note ID. Changing it relinks the note to another side-car file.
videoSink
video
any
Internal read-only QVideoSink pointer. Not useful in Luau.
constraints
line
table
Serialized control-point constraint map. Not reliably convertible from Lua tables; leave it unchanged.
collision
svg
table
Serialized collision polygon. Not reliably convertible from Lua tables; leave it unchanged.
-- Mute every video and audio item on the active board.
for _, item in frameref. items . all () do
if item. type == "video" or item. type == "audio" then
-- Read and write type-specific properties by name.
local item = frameref. items . get ( "<uid>" )
if item ~= nil and item. type == "video" then
local was_muted = item : get ( "muted" )
print ( "was muted:" , was_muted, "seek:" , item. seekTime )
-- Mix base and type-specific properties in one call.
local audio_items = frameref. items . find ({ type = "audio" , limit = 1 })
audio_items[ 1 ]: setProperties ({ opacity = 0.8 , autoLoop = true , muted = true })
Function
Parameters
Returns
Description
item:get(name)
name: string
any
Read a property by name. Returns nil for an unknown name.
item:set(name, value)
name: string, value: any
nil
Write a property by name. Raises an error when the property is unknown or read-only.
item:setProperties(values)
values: table
nil
Write several properties from a table.
item:addTags(tags)
tags: {string}
nil
Add tags, ignoring duplicates.
item:removeTags(tags)
tags: {string}
nil
Remove tags.
item:delete()
—
nil
Delete the item.
item:duplicate()
—
Item?
Duplicate the item and return the new handle.
item:select()
—
nil
Replace the selection with this item.
item:frame()
—
nil
Frame the item in the canvas view.
item:moveBy(dx, dy)
dx: number, dy: number
nil
Move the item by a scene-space offset.
item:moveTo(x, y)
x: number, y: number
nil
Move the item to a scene position.
item:rotateBy(degrees)
degrees: number
nil
Rotate the item around its center.
item:rotateAround(point, degrees)
point: PointArg, degrees: number
nil
Rotate around a point or another item.
item:scaleBy(factor)
factor: number
nil
Scale around the item center.
item:scaleAround(point, factor)
point: PointArg, factor: number
nil
Scale around a point or another item.
item:capture(options?)
options: CaptureOptions?
Capture
Render the item to a JPEG or PNG.
item:awaitReady()
—
Future<boolean>
Wait until the item’s media is ready.
item:isValid()
—
boolean
Whether the item still exists on its board.
item:snapshot()
—
table
Plain-data copy of the item’s common properties.
Key
Type
Default
Description
maxSize
number
1024
Longest image side in pixels. Clamped to 32–4096.
format
string
"jpeg"
"jpeg", "jpg", or "png".
Capture contains mime, base64, width, and height.
-- Look up an item by UID.
local item = frameref. items . get ( "<uid>" )
-- Stop when the item no longer exists.
-- Change the visible label and rating.
-- Add two search tags without removing existing tags.
item : addTags ({ "approved" , "cover" })
-- Rotate the item 15 degrees around the scene origin.
item : rotateAround ({ x = 0 , y = 0 }, 15 )
-- Render the item to a PNG no larger than 512 pixels.
local capture = item : capture ({ maxSize = 512 , format = "png" })
-- Print the encoded image metadata.
print (capture. mime , capture. width , capture. height )
Valid type values are:
image, video, gif, pdf, audio, text, note, todo, group, shape, color_swatch, portal, weblink, edge, line, svg.
Function
Parameters
Returns
Description
frameref.actions.list()
—
{ActionInfo}
Every registered input action.
frameref.actions.run(id)
id: string
boolean
Run a registered action. Returns false when the action is disabled. Unknown IDs raise an error.
frameref.actions.setShortcut(id, shortcut)
id: string, shortcut: string
boolean
Set and persist an action shortcut, for example "Ctrl+Alt+T".
ActionInfo contains:
Field
Type
Description
id
string
Stable action ID.
text
string
Translated action name.
tooltip
string
Translated tooltip.
shortcut
string
Current shortcut.
enabled
boolean
Whether the action can run.
script
boolean
Whether the action comes from a script plugin.
-- Loop over every registered action.
for _, action in frameref. actions . list () do
-- Find the built-in Select All action by its stable ID.
if action. id == "action_select_all" then
-- Run the action only when it is currently enabled.
frameref. actions . run (action. id )
-- Assign a new shortcut to a plugin action.
local changed = frameref. actions . setShortcut ( "script.com.example.myplugin.tag-selection" , "Ctrl+Alt+T" )
-- Print whether the shortcut was stored.
print ( "Shortcut updated:" , changed)
Function
Parameters
Returns
Description
frameref.undo.begin(name?)
name: string?
nil
Begin an undo macro. The default name is "Script". Nested calls are counted.
frameref.undo.commit()
—
nil
Close the current macro.
frameref.undo.cancel()
—
nil
Close the macro and undo it once.
frameref.undo.undo()
—
nil
Undo the active board’s last step.
frameref.undo.redo()
—
nil
Redo the active board’s last undone step.
frameref.undo.canUndo()
—
boolean
Whether the active board can undo.
frameref.undo.canRedo()
—
boolean
Whether the active board can redo.
-- Start a named undo group for the whole batch.
frameref. undo . begin ( "Batch review" )
-- Update every selected item inside the same undo step.
for _, item in frameref. selection . items () do
item : addTags ({ "reviewed" })
-- Close the undo group and keep the changes.
Events are available to plugins only.
Function
Parameters
Returns
Description
frameref.events.on(name, callback)
name: EventName, callback: function
number
Subscribe to an event. Returns a subscription ID.
frameref.events.once(name, callback)
name: EventName, callback: function
number
Subscribe until the first event fires.
frameref.events.off(id)
id: number
boolean
Remove a subscription.
Event
Callback argument
Fires when
board.activated
boardId: string
The active tab changes.
board.opened
boardId: string
A board is opened.
board.closed
boardId: string
A board tab is closed.
board.saved
boardId: string
A board is saved.
selection.changed
boardId: string
The selection changes.
scene.changed
boardId: string
Board content changes.
undo.changed
boardId: string
The undo stack changes.
project.changed
—
The current project changes.
-- Log every selection change on any open board.
local subscription = frameref. events . on ( "selection.changed" , function (boardId)
-- The callback receives the ID of the board whose selection changed.
frameref. log ( string.format ( "Selection changed on %s" , boardId))
-- Stop listening after two seconds.
frameref. async . delay ( 2.0 , function ()
-- Remove the subscription by its returned ID.
frameref. events . off (subscription)
Some operations finish later: loading media, saving a board, or waiting for a form. The API returns a Future<T> for these operations. There are two ways to consume a future.
:await() pauses the current script until the future finishes and returns its value. This is the simplest option for console scripts and for plugin code that must have the result before continuing.
Awaiting runs a nested event loop and has a 30-second safety cap.
If the future rejects or the cap is reached, :await() raises a Lua error.
The script resumes on the UI thread after the future resolves.
-- Look up an item that may still be loading.
local item = frameref. items . get ( "<uid>" )
-- Stop when the item no longer exists.
-- Pause this script until the item's media is ready.
local ready = item : awaitReady ()
-- Continue only when the media loaded successfully.
frameref. log ( "Media is ready" )
:andThen() and :catch() register callbacks and return immediately. They are only available to plugins because the callbacks outlive the script run. The callbacks run on the UI thread when the future resolves or rejects.
-- Run this code inside a plugin action.
local item = frameref. items . get ( "<uid>" )
-- Stop when the item no longer exists.
-- Start waiting for the item's media without blocking the script.
local future = item : awaitReady ()
-- Register a success callback.
future : andThen ( function (ready)
-- This runs later, after the media finishes loading.
frameref. notify ( "Media ready" )
-- Register an error callback on the same future.
future : catch ( function (message)
-- This runs later if loading fails or the future is cancelled.
frameref. log ( "Loading failed: " .. message)
-- This line runs immediately, before either callback above.
frameref. log ( "Waiting in the background" )
Function
Parameters
Returns
Description
frameref.async.defer(callback)
callback: function
nil
Run the callback on the next event loop turn.
frameref.async.delay(seconds, callback)
seconds: number, callback: function
nil
Run the callback after a delay. The delay is clamped to 24 hours.
Both functions are available to plugins only.
-- Run after the current event loop turn, without a visible delay.
frameref. async . defer ( function ()
frameref. log ( "Deferred callback ran" )
-- Run once after two seconds.
frameref. async . delay ( 2.0 , function ()
frameref. notify ( "Two seconds passed" )
Function
Parameters
Returns
Description
future:await()
—
T
Pause the script until the future resolves and return its value. Raises an error when the future rejects or times out.
future:andThen(callback)
callback: function
nil
Register a success callback. Plugin actions only.
future:catch(callback)
callback: function
nil
Register an error callback. Plugin actions only.
future:isDone()
—
boolean
Whether the future has already finished.
future:cancel()
—
nil
Cancel a pending future. Cancellation rejects the future with "cancelled".
-- Start a save operation that returns a future.
local save = frameref. boards . active (): saveAs ( "C:/refs/backup.frameref" )
-- Check whether the save already finished.
frameref. log ( "Save already finished" )
frameref. log ( "Save is still running" )
-- Wait for the save and get its boolean result.
local saved = save : await ()
Storage is available to plugins only. Data is JSON and is stored per plugin.
Function
Parameters
Returns
Description
frameref.storage.get(key)
key: string
any
Read a stored value. Returns nil when the key is missing.
frameref.storage.set(key, value)
key: string, value: any
nil
Store a JSON-serializable value and write it to disk.
frameref.storage.remove(key)
key: string
nil
Remove a key.
frameref.storage.save()
—
boolean
Flush the current storage object to disk.
-- Read a value that may have been stored on a previous run.
local last_run = frameref. storage . get ( "lastRun" )
-- Store a new value and write it to disk immediately.
frameref. storage . set ( "lastRun" , "2026-11-18" )
-- Remove a temporary key.
frameref. storage . remove ( "temporary" )
-- Flush the current storage object explicitly.
-- Print the value that was read at the start.
print ( "Previous run:" , last_run)
Function
Parameters
Returns
Description
frameref.settings.get(category, key)
category: string, key: string
any
Read a preference value. Sensitive keys return nil.
frameref.settings.set(category, key, value)
category: string, key: string, value: any
boolean
Write a preference value. Returns false when the category or key is not writable.
Writable categories are appearance, items, performance, window, saving_loading, tools, notifications, input, draw, and scripting.
Caution
Scripts cannot enable the automation server, enable MCP, change its token or port, allow remote edits, or write keys that look like secrets, tokens, passwords, or API keys. Use this API for preferences that are safe to automate.
-- Read the current canvas background preference.
local background = frameref. settings . get ( "appearance" , "canvas_background_type" )
-- Write the value back and check whether the key is writable.
local written = frameref. settings . set ( "appearance" , "canvas_background_type" , background)
-- Print the current value and the write result.
print (background, written)
Function
Parameters
Returns
Description
frameref.project.current()
—
table
The current project: valid, name, mainBoard, and contentFolder.
frameref.project.save()
—
boolean
Save the current project. Returns true when the save was started.
frameref.project.saveAs(path)
path: string
boolean
Save the project to the given folder. Returns true when the save was started.
-- Read the current project details.
local project = frameref. project . current ()
-- Print the project name and its main board path.
print (project. name , project. mainBoard )
-- Save the project when it is valid.
Function
Parameters
Returns
Description
frameref.clipboard.copy()
—
nil
Copy the current selection.
frameref.clipboard.cut()
—
nil
Cut the current selection.
frameref.clipboard.paste()
—
{Item}
Paste and return the new item handles.
-- Select up to five images on the active board.
frameref. selection . set (frameref. items . find ({ type = "image" , limit = 5 }))
-- Copy the selected images to the clipboard.
frameref. clipboard . copy ()
-- Paste the images and get handles to the new copies.
local pasted = frameref. clipboard . paste ()
-- Offset each pasted copy so it does not cover the original.
Function
Parameters
Returns
Description
frameref.image.capture(item, options?)
item: ItemArg, options: CaptureOptions?
Capture
Render an item to a JPEG or PNG. Same options as item:capture.
-- Look up an image item by UID.
local item = frameref. items . get ( "<uid>" )
-- Stop when the item no longer exists.
-- Render the item to a PNG no larger than 768 pixels.
local capture = frameref. image . capture (item, { maxSize = 768 , format = "png" })
-- Print the encoded image size and a base64 length preview.
print (capture. width , capture. height , # capture. base64 )
Function
Parameters
Returns
Description
frameref.input.form(form)
form: InputForm
Future<table?>
Show a modal form. Resolves with a table of values, or nil when cancelled.
Form keys:
Key
Type
Optional
Description
title
string
Yes
Dialog title.
text
string
Yes
Explanatory text above the fields.
fields
{InputField}
No
Fields to show. Up to 64 fields.
InputField keys:
Key
Type
Optional
Description
key
string
No
Result key. Required and must be unique.
label
string
Yes
Visible label.
type
string
Yes
"string", "int", "float", "bool", or "choice". Inferred from default or values when omitted.
values
{string}
Yes
Choices for a "choice" field. Required for choices, maximum 256.
default
any
Yes
Default value. For a choice field, this is the selected string or a 1-based index.
placeholder
string
Yes
Placeholder text.
min
number
Yes
Minimum for int and float fields.
max
number
Yes
Maximum for int and float fields.
-- Show a form and pause this script until the user submits or cancels it.
local values = frameref. input . form ({
text = "Enter a prefix for the selected items." ,
-- Cancelling the form resolves to nil, so stop here.
-- Apply the submitted prefix and rating to every selected item.
for _, item in frameref. selection . items () do
item. label = values. prefix .. item. label
item. rating = values. rating
Function
Parameters
Returns
Description
frameref.search(query)
query: string
{SearchResult}
Search the active board for item matches and menu actions.
SearchResult fields:
Field
Type
Description
kind
string
"navigation" for an item, "action" for a menu action.
title
string
Result title.
description
string
Result description.
rating
number
Item rating for navigation results.
action
string?
Action ID for action results.
item
Item?
Item handle for navigation results.
activate()
boolean
Run the action or frame the matched item.
-- Search the active board for the word "cover".
for _, result in frameref. search ( "cover" ) do
-- Only navigation results point at a board item.
if result. kind == "navigation" then
-- Frame the matched item in the canvas.
Functions that return Future<T> resolve asynchronously. See Async for the two consumption styles and examples.
Function
Parameters
Returns
Description
future:await()
—
T
Pause the script until the future resolves and return its value. Raises an error on rejection or timeout.
future:andThen(callback)
callback: function
nil
Register a success callback. Plugin actions only.
future:catch(callback)
callback: function
nil
Register an error callback. Plugin actions only.
future:isDone()
—
boolean
Whether the future has already finished.
future:cancel()
—
nil
Cancel a pending future. Cancellation rejects the future with "cancelled".
-- Get the board in the active tab.
local board = frameref. boards . active ()
-- Stop when no board is open.
-- Start an asynchronous save of the active board.
local save = board : saveAs ( "C:/refs/backup.frameref" )
-- Pause this script until the save finishes and print the result.
print ( "Saved:" , save : await ())
Use pcall when one bad item or property should not abort the whole script.
-- Try to update an item without stopping the script on failure.
local ok, err = pcall ( function ()
local item = frameref. items . get ( "<uid>" )
item. label = "Updated label"
-- Report the error and keep going.
frameref. log ( "Update failed: " .. tostring (err))
-- Loop over every board that is open in a tab.
for _, board in frameref. boards . list () do
-- Start a counter for images on this board.
-- Count image items on the board.
for _, item in board : items () do
if item. type == "image" then
-- Print the board title and its image count.
print (board. title , images)
-- Find every item tagged "todo".
local items = frameref. items . find ({ tag = "todo" })
-- Stop when there is nothing to update.
-- Group the whole update into one undo step.
frameref. undo . begin ( "Clear todo tag" )
-- Remove the tag and set a rating on every match.
item : removeTags ({ "todo" })
-- Close the undo group and keep the changes.
-- Look up an item by UID.
local item = frameref. items . get ( "<uid>" )
-- Continue only when the item exists.
-- Render a JPEG preview no larger than 768 pixels.
local capture = item : capture ({ maxSize = 768 , format = "jpeg" })
-- Print the image dimensions and base64 length.
print (capture. width , capture. height , # capture. base64 )
Scripts run on the UI thread and are interrupted after the configured timeout.
A script cannot use require, io, load, or arbitrary file and network access. Plugins can use require for files inside their own folder.
Events, async callbacks, and storage are restricted to plugins.
Remote scripts are read-only until Allow remote scripts to edit the board is enabled.
Item handles become invalid when the item is deleted or its board is closed. Use item:isValid() before reusing a handle across asynchronous work.
The API works with live board data. Use snapshot() when you need plain data that will not change underneath you.