ENDEOnline help
CncCraft
Help›Automation›Scripts and automation

Scripts and automation New in CncCraft

A small script drives CncCraft step by step – the visible mouse shows every click. Great for short videos for TikTok, Instagram and the like.

This is a pilot feature (beta). Scripting and the built-in automation server are new, still being refined and may change. They are meant mainly for recording demos; everyday work needs none of it.

CncCraft can run a script: a plain list of commands, one per line, that it carries out by moving the visible mouse and clicking the real buttons – so it looks exactly like someone using the program.

This is a nice way to build short demo videos for TikTok, Instagram or YouTube Shorts: the big visible cursor, the on-screen captions and the steady, repeatable moves make clean, hands-free clips. Record the window, set a title and a subtitle, pick the speed, and let the script draw and mill while the mouse shows every step.

The script window

Open it with Help ▸ Script…. It is its own window you can move anywhere. It has an editor with autocomplete and syntax highlighting, a Run and a Stop button, a Command help window listing every command, and an agent.md button that copies a full guide for an AI assistant.

How a script reads

  • One command per line, for example draw_rectangle cx=50 cy=50 width=40 height=30.
  • Write name = tool … to keep the result under a name, then use it later as $name.id – so you can draw a shape and give it a toolpath.
  • Lines like move_to, click, drag and type_text play through the visible cursor; screenshot, recording_start / recording_stop and window width=… height=… help with recording.
  • text_title and text_subtitle put a caption on screen, replay_speed sets how fast the mouse moves.

Snapping from a script

Every button has a command, so a script can switch the three snap methods (Snapping) on and off like any other: snap_to_geometry (bounding box), snap_to_center and snap_to_gap. That way a demo can show, step by step, how a shape lines up on an edge, a centre or an equal gap.

Automation server

Behind the scenes the same commands are an automation server running inside CncCraft on your own computer only (localhost). An AI assistant can connect to it and build a drawing for you while the visible mouse shows every move. Nothing leaves your machine.

All commands

These are every command a script (and the automation server) understands – the same set the AI assistant sees in agent.md.

Every line of a script is one of these commands. Parameters are written name=value; required ones are marked. Returns is what a later line can use through a variable (for example $name.id). This list is generated from the program itself, so it always matches your version.

agent_md

Get the agent guide (Markdown): what CncCraft and its script language are for, the syntax, coordinates and pacing rules, every command with its parameters and return value, and example scripts. Read it first to write scripts.

No parameters.

Returns: Text: the agent guide as Markdown.

state

Report the current job (size, material), the shapes (id, kind, centre, size in mm) and the toolpaths (index, name, tool, depth). Use it to find shape ids before adding toolpaths.

No parameters.

Returns: JSON {"job": {"width", "height", "thickness", "material"}, "selection": [ids], "shapes": [{"id", "kind", "cx", "cy", "width", "height"}], "toolpaths": [{"index", "name", "tool", "cut_depth"}]}.

list_materials

List the material keys available for a job (e.g. for new_job).

No parameters.

Returns: JSON {"materials": [keys]}.

list_tools

List the cutters available for the current job's material (name, kind, diameter in mm).

No parameters.

Returns: JSON {"material", "tools": [{"name", "kind", "diameter"}]}.

window

Report the window size, whether the cursor is still playing (busy), the MCP port, which side panels are open, the view (2d or 3d), the replay speed and the recording. With width and/or height (logical points), it resizes the window first — set a steady size before recording_start.

ParameterTypeRequiredValuesMeaning
heightnumbernoNew window height in points (optional; keeps the current height if left out).
widthnumbernoNew window width in points (optional; keeps the current width if left out).

Returns: JSON {"width", "height", "busy", "port", "panels": {"tools", "milling"}, "view", "replay_speed", "recording": path or null}.

new_job

Start a new job with a size (mm), thickness (mm) and material key (e.g. Softwood, Hardwood, Plywood, MDF, Acrylic, Aluminium).

ParameterTypeRequiredValuesMeaning
widthnumberyesWidth of the material in mm (x).
heightnumberyesHeight of the material in mm (y).
materialstringnoMaterial key from list_materials, e.g. Plywood or MDF.
thicknessnumbernoMaterial thickness in mm (default 18).

Returns: Text "new job".

draw_rectangle

Add a rectangle by its centre (cx, cy in mm) and width/height (mm); optional corner_radius (mm). Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
cxnumberyesCentre x in mm (from the left edge of the material).
cynumberyesCentre y in mm (from the bottom edge of the material).
widthnumberyesWidth in mm.
heightnumberyesHeight in mm.
corner_radiusnumbernoRounded corners: their radius in mm (default 0, sharp).

Returns: JSON {"id": N} — the new rectangle's shape id.

draw_circle

Add a circle by centre (cx, cy in mm) and radius (mm). Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
cxnumberyesCentre x in mm (from the left edge of the material).
cynumberyesCentre y in mm (from the bottom edge of the material).
radiusnumberyesRadius in mm.

Returns: JSON {"id": N} — the new circle's shape id.

draw_ellipse

Add an ellipse by centre (cx, cy in mm) and full width/height (mm). Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
cxnumberyesCentre x in mm (from the left edge of the material).
cynumberyesCentre y in mm (from the bottom edge of the material).
widthnumberyesFull width in mm.
heightnumberyesFull height in mm.

Returns: JSON {"id": N} — the new ellipse's shape id.

draw_polygon

Add a regular polygon by centre (cx, cy in mm), radius (mm) and number of sides (>=3). Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
cxnumberyesCentre x in mm (from the left edge of the material).
cynumberyesCentre y in mm (from the bottom edge of the material).
radiusnumberyesDistance from the centre to a corner, in mm.
sidesnumberyesNumber of sides (3 or more).

Returns: JSON {"id": N} — the new polygon's shape id.

add_text

Add text by centre (cx, cy in mm), the text and the letter height (mm, default 20). Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
cxnumberyesCentre x in mm (from the left edge of the material).
cynumberyesCentre y in mm (from the bottom edge of the material).
textstringyesThe text to write.
heightnumbernoLetter height in mm (default 20).

Returns: JSON {"id": N} — the new text's shape id.

drag_shape

Drag a shape with the visible mouse: the cursor goes to the shape, presses, glides and releases so the top-left corner of the shape's outline box lands at (left, top). It is the app's own drag, so the shape snaps to the grid and to construction lines (and attaches to a line it lands on), as by hand. Returns {"id", "from", "to"}.

ParameterTypeRequiredValuesMeaning
idnumberyesThe shape's id (from a drawing tool's result or the state tool).
leftnumberyesWhere the left edge of the shape should end up, in mm from the left edge of the material.
topnumberyesWhere the top edge of the shape should end up, in mm from the bottom edge of the material.

Returns: JSON {"id", "from": {"left", "top"}, "to": {"left", "top"}} — the place asked for; the shape may snap a little to the grid or a construction line (read it back with state).

delete_shapes

Delete shapes by their ids. Returns {"deleted": [...]}.

ParameterTypeRequiredValuesMeaning
idsarrayyesThe ids of the shapes to delete.

Returns: JSON {"deleted": [ids]}.

select

Select shapes by their ids (clears the previous selection). Returns {"selected": [...]}.

ParameterTypeRequiredValuesMeaning
idsarrayyesThe ids of the shapes to select.

Returns: JSON {"selected": [ids]}.

set_variable

Create or change a document variable: a name and an expression (a number or formula). Shapes and toolpaths bound to it follow.

ParameterTypeRequiredValuesMeaning
namestringyesThe variable's name, e.g. plate_w.
expressionstringyesA number or formula, e.g. 120 or plate_w/2.

Returns: Text "NAME = EXPRESSION".

add_toolpath

Create a milling toolpath, all through the UI: the visible mouse clicks the shapes to select them (Shift for the extra ones), opens the milling panel if needed, clicks the operation's button, types the depths into the editor's fields when given, and clicks Anwenden. Fields left out keep the material's standard value. All shapes must be on screen (run view_fit first if needed).

ParameterTypeRequiredValuesMeaning
kindstringyesprofile, cutout, pocket, slot, drill, vcarveThe milling operation: profile (along the outline), cutout (cut the part free), pocket (clear the inside), slot, drill (holes) or vcarve.
shape_idsarrayyesThe ids of the shapes to cut (from a drawing tool's result or the state tool).
cut_depthstringnoHow deep the cut goes in total (the 'Zieltiefe' field): a number in mm or a variable/formula like platte_d or platte_d/2 (optional).
max_depth_per_passstringnoThe most the cutter takes per pass (the 'Zustellung' field, 'Bohrtiefe je Hub' for drilling): a number in mm or a formula (optional).

Returns: JSON {"kind", "shape_ids": [ids], "cut_depth", "max_depth_per_pass"} — the toolpath is computed once the mouse has clicked Anwenden; read it back with state.

delete_toolpath

Delete a toolpath by its index in the list (0-based).

ParameterTypeRequiredValuesMeaning
indexnumberyesPosition of the toolpath in the list, starting at 0 (see the state tool).

Returns: Text "deleted NAME".

guides_list

List the construction lines (ruler guides): id, axis (vertical = an X value, horizontal = a Y value), offset in mm, formula and attached shape ids, plus whether the lines are locked and the rulers shown.

No parameters.

Returns: JSON {"rulers_shown", "locked", "guides": [{"id", "axis", "offset", "expr", "attached": [shape ids]}]}.

guide_add

Add a construction line (ruler guide): axis "vertical" (an X value, measured from the left edge) or "horizontal" (a Y value, from the bottom), at offset mm. Turns the rulers on if needed. Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
axisstringyesvertical, horizontalvertical: a line at an x value; horizontal: a line at a y value.
offsetnumberyesDistance in mm from the left edge (vertical) or the bottom edge (horizontal).

Returns: JSON {"id": N} — the new construction line's id.

guide_move

Move a construction line (from guides_list) to a new distance (mm). The visible mouse drags it on the ruler; any attached shapes follow. Returns {"id": ...}.

ParameterTypeRequiredValuesMeaning
idnumberyesThe construction line's id (from guide_add or guides_list).
offsetnumberyesThe new distance in mm from the left edge (vertical) or the bottom edge (horizontal).

Returns: JSON {"id": N}.

guide_delete

Delete a construction line by its id (from guides_list); its shapes stay put. Returns {"deleted": id}.

ParameterTypeRequiredValuesMeaning
idnumberyesThe construction line's id (from guide_add or guides_list).

Returns: JSON {"deleted": id}.

guides_delete_all

Delete every construction line: the mouse glides from one guide's handle to the next and removes each. Shapes stay put. Returns {"deleted": [ids...]}.

No parameters.

Returns: JSON {"deleted": [ids]}.

guides_lock_all

Lock every construction line (the mouse clicks the lock in the rulers' corner). Locked lines can't be added, moved, edited or deleted; shapes still snap to them.

No parameters.

Returns: Text "locking all construction lines".

guides_unlock_all

Unlock every construction line (the mouse clicks the lock in the rulers' corner), so they can be moved, edited and deleted again.

No parameters.

Returns: Text "unlocking all construction lines".

save_project

Save the project to an absolute .cnccraft path.

ParameterTypeRequiredValuesMeaning
pathstringyesAbsolute path of the .cnccraft project file.

Returns: Text "saved PATH".

export_gcode

Write the visible toolpaths as a G-code file to an absolute path.

ParameterTypeRequiredValuesMeaning
pathstringyesAbsolute path of the G-code file to write.

Returns: Text saying which file was written.

view

Switch to the 2D or 3D view: the visible mouse clicks the 2D/3D toggle in the canvas bar (nothing is clicked if the view already is the one asked for). Returns {"mode", "changed"}.

ParameterTypeRequiredValuesMeaning
modestringyes2d, 3d2d: the drawing; 3d: the board in 3D (the cuts show once the preview runs: toolpath_preview).

Returns: JSON {"mode": "2d"|"3d", "changed": true|false}.

panel_tools_open

Open the tool column on the left: the visible mouse moves to the panel's fold button (the chevron) and clicks it. Nothing is clicked if it already is open. Returns {"panel", "open", "changed"}.

No parameters.

Returns: JSON {"panel": "tools"|"milling", "open": true|false, "changed": true|false}.

panel_tools_close

Close the tool column on the left: the visible mouse moves to the panel's fold button (the chevron) and clicks it. Nothing is clicked if it already is closed. Returns {"panel", "open", "changed"}.

No parameters.

Returns: JSON {"panel": "tools"|"milling", "open": true|false, "changed": true|false}.

panel_milling_open

Open the milling (toolpath) panel on the right: the visible mouse moves to the panel's fold button (the chevron) and clicks it. Nothing is clicked if it already is open. Returns {"panel", "open", "changed"}.

No parameters.

Returns: JSON {"panel": "tools"|"milling", "open": true|false, "changed": true|false}.

panel_milling_close

Close the milling (toolpath) panel on the right: the visible mouse moves to the panel's fold button (the chevron) and clicks it. Nothing is clicked if it already is closed. Returns {"panel", "open", "changed"}.

No parameters.

Returns: JSON {"panel": "tools"|"milling", "open": true|false, "changed": true|false}.

demo_window

Open or close the in-app Demo & remote-control window.

ParameterTypeRequiredValuesMeaning
openbooleannotrue opens the window, false closes it (default true).

Returns: Text "demo window open" or "demo window closed".

script_window

Open or close the script window (its own OS window for writing and playing a script of commands).

ParameterTypeRequiredValuesMeaning
openbooleannotrue opens the window, false closes it (default true).

Returns: Text "script window open" or "script window closed".

screenshot

Save a PNG of the window to an absolute path (does not close the app).

ParameterTypeRequiredValuesMeaning
pathstringyesAbsolute path of the PNG file to write.

Returns: Text "saving to PATH" (the PNG is written on the next frame).

file_new

New job — The mouse opens the File menu and clicks "New job". Keys: ⌘N.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

file_open

Open… — The mouse opens the File menu and clicks "Open…". Keys: ⌘O.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

file_save

Save — The mouse opens the File menu and clicks "Save". Keys: ⌘S.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

file_save_as

Save as… — The mouse opens the File menu and clicks "Save as…". Keys: ⇧⌘S.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

file_export_toolpaths

Save toolpaths… — The mouse opens the File menu and clicks "Save toolpaths…".

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

file_start_page

Start page — The mouse opens the File menu and clicks "Start page".

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_undo

Undo — The mouse opens the Edit menu and clicks "Undo". Keys: ⌘Z.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_redo

Redo — The mouse opens the Edit menu and clicks "Redo". Keys: ⇧⌘Z.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_cut

Cut — The mouse opens the Edit menu and clicks "Cut". Keys: ⌘X.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_copy

Copy — The mouse opens the Edit menu and clicks "Copy". Keys: ⌘C.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_paste

Paste — The mouse opens the Edit menu and clicks "Paste". Keys: ⌘V.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_duplicate

Duplicate — The mouse opens the Edit menu and clicks "Duplicate". Keys: ⌘D.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_delete

Delete — The mouse opens the Edit menu and clicks "Delete". Keys: ⌫.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_group

Group — The mouse opens the Edit menu and clicks "Group". Keys: ⌘G.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_ungroup

Ungroup — The mouse opens the Edit menu and clicks "Ungroup". Keys: ⇧⌘G.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_select_all

Select all — The mouse opens the Edit menu and clicks "Select all". Keys: ⌘A.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_node_edit

Edit nodes — The mouse opens the Edit menu and clicks "Edit nodes". Keys: N.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_job_setup

Set up workpiece… — The mouse opens the Edit menu and clicks "Set up workpiece…".

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

edit_cancel

Cancel — The mouse opens the Edit menu and clicks "Cancel". Keys: Esc.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_select

Select — Tools › Select. Keys: S.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_line

Draw line — Tools › Draw line. Keys: L.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_spline

Draw spline — Tools › Draw spline. Keys: P.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_rectangle

Draw rectangle — Tools › Draw rectangle. Keys: R.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_circle

Draw circle — Tools › Draw circle. Keys: C.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_offset

Offset vectors — Tools › Offset vectors. Keys: O.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_dimension

Bemaßen — Tools › Bemaßen. Keys: D.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

tool_align

Waagrecht/Senkrecht — Tools › Waagrecht/Senkrecht. Keys: H.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

view_2d

2D view — The mouse opens the View menu and clicks "2D view". Keys: F2.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

view_3d

3D view — The mouse opens the View menu and clicks "3D view". Keys: F3.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

view_fit

Fit view — The mouse opens the View menu and clicks "Fit view". Keys: F4.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

view_toggle_dimensions

Show dimensions — The mouse opens the View menu and clicks "Show dimensions".

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_profile

Profile — The mouse opens the Toolpaths menu and clicks "Profile". Opens the Profil toolpath editor for the selected shapes.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_pocket

Pocket — The mouse opens the Toolpaths menu and clicks "Pocket". Opens the Tasche (pocket) toolpath editor.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_drill

Drilling — The mouse opens the Toolpaths menu and clicks "Drilling". Opens the Bohren (drill) toolpath editor.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_vcarve

V-carving — The mouse opens the Toolpaths menu and clicks "V-carving". Opens the V-Carving toolpath editor.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_cutout

Cutout — The mouse opens the Toolpaths menu and clicks "Cutout". Opens the Ausschnitt (cutout) toolpath editor.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_recompute_all

Recalculate all — The mouse opens the Toolpaths menu and clicks "Recalculate all".

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_preview

Preview — Toolpaths panel › Preview. The mouse opens the toolpaths panel on the right if needed and clicks Preview: the finished cut in 3D.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_simulate

Simulate — Toolpaths panel › Simulate. The mouse opens the toolpaths panel on the right if needed and clicks Simulate: the cut animated in 3D.

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_gcode_motion_on

Show G-code motion — Toolpaths panel › Show G-code motion. The mouse clicks the "G-code motion in 3D" checkbox so the machine's moves are drawn over the 3D view (does nothing if already on).

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

toolpath_gcode_motion_off

Hide G-code motion — Toolpaths panel › Hide G-code motion. The mouse clicks the "G-code motion in 3D" checkbox so the moves are hidden (does nothing if already off).

No parameters.

Returns: Text saying what is being done, e.g. "opening Edit › Undo in the menu" (the mouse opens the menu and clicks the item) or "clicking Preview in the toolpaths panel".

cursor

Show or hide the virtual mouse cursor.

ParameterTypeRequiredValuesMeaning
onbooleanyestrue shows the cursor, false hides it.

Returns: Text "cursor on" or "cursor off".

move_to

Glide the cursor to a screen point (pixels from the top-left of the window).

ParameterTypeRequiredValuesMeaning
xnumberyesScreen x in pixels from the left of the window.
ynumberyesScreen y in pixels from the top of the window.

Returns: Text "moving"; the cursor glides there.

click

Click at a screen point with the left (default) or right button.

ParameterTypeRequiredValuesMeaning
xnumberyesScreen x in pixels from the left of the window.
ynumberyesScreen y in pixels from the top of the window.
buttonstringnoleft, rightWhich mouse button (default left).

Returns: Text "clicked"; the click plays on the visible cursor.

double_click

Double-click at a screen point.

ParameterTypeRequiredValuesMeaning
xnumberyesScreen x in pixels from the left of the window.
ynumberyesScreen y in pixels from the top of the window.

Returns: Text "double-clicked"; it plays on the visible cursor.

long_press

Long-press at a screen point (to open a value for editing, like a person holding the mouse).

ParameterTypeRequiredValuesMeaning
xnumberyesScreen x in pixels from the left of the window.
ynumberyesScreen y in pixels from the top of the window.

Returns: Text "long-pressed"; it plays on the visible cursor.

drag

Press at (x1,y1), drag to (x2,y2) and release.

ParameterTypeRequiredValuesMeaning
x1numberyesStart x in screen pixels (where the button goes down).
y1numberyesStart y in screen pixels.
x2numberyesEnd x in screen pixels (where the button is released).
y2numberyesEnd y in screen pixels.

Returns: Text "dragged"; it plays on the visible cursor.

type_text

Type text into the focused field.

ParameterTypeRequiredValuesMeaning
textstringyesThe text to type into the focused field.

Returns: Text "typed".

press_key

Press a key (Enter, Escape, Tab, Delete, Backspace, Space, arrows, or a single letter/digit) with optional modifiers cmd/shift/alt/ctrl.

ParameterTypeRequiredValuesMeaning
keystringyesThe key: Enter, Escape, Tab, Delete, Backspace, Space, Up, Down, Left, Right, or a single letter/digit.
altbooleannoHold Alt/Option.
cmdbooleannoHold ⌘ (Ctrl on Windows/Linux).
ctrlbooleannoHold Ctrl (treated like cmd).
shiftbooleannoHold Shift.

Returns: Text "key"; the keys show as keycaps next to the big mouse.

wait

Pause for a number of seconds (a beat for the viewer).

ParameterTypeRequiredValuesMeaning
secondsnumberyesHow long to pause, in seconds (decimals allowed).

Returns: Text "waiting".

replay_speed

Set how fast the visible cursor plays its moves, clicks and pauses: 1 is normal, 2 twice as fast, 0.5 half as fast (0.25 to 4). A long press is never made shorter than it must be. Without speed, it reports the current one. Returns {"speed": ...}.

ParameterTypeRequiredValuesMeaning
speednumbernoThe replay speed: 1 normal, 2 twice as fast, 0.5 half as fast (kept between 0.25 and 4).

Returns: JSON {"speed": N} — the speed now in use.

text_title

Show a standing title over the window (e.g. the app's name), kept until it is replaced or cleared, like the text in TikTok or tutorial videos: wrapped on a rounded box, fading in and out. An empty text removes it. It does not wait; add wait to hold the scene. Defaults: top centre, 40 pt, no time limit. Headline and subtitle are independent — both can show at once.

ParameterTypeRequiredValuesMeaning
textstringyesThe caption. An empty text takes the current one away.
bg_colorstringnoBox colour as #RRGGBB, #RRGGBBAA or r,g,b,a (default black at 70%). Also accepted as bg-color.
colorstringnoText colour as #RRGGBB, #RRGGBBAA or r,g,b,a with 0-255 (default white).
durationnumbernoHow long it shows, in seconds (0 keeps it until replaced).
fontnumbernoFont size in points.
horizontalstringnoleft, center, rightWhere it sits horizontally, and how its lines align (default center).
opacitynumbernoOverall opacity from 0 to 1 (default 1).
verticalstringnotop, center, bottomWhere it sits vertically.

Returns: JSON {"shown": true, "duration": seconds}, or {"shown": false} when the text was empty (the caption is taken away).

text_subtitle

Show the subtitle that says what is happening, replaced each time it is called, like the text in TikTok or tutorial videos: wrapped on a rounded box, fading in and out. An empty text removes it. It does not wait; add wait to hold the scene. Defaults: bottom centre, 28 pt, 3 seconds. Headline and subtitle are independent — both can show at once.

ParameterTypeRequiredValuesMeaning
textstringyesThe caption. An empty text takes the current one away.
bg_colorstringnoBox colour as #RRGGBB, #RRGGBBAA or r,g,b,a (default black at 70%). Also accepted as bg-color.
colorstringnoText colour as #RRGGBB, #RRGGBBAA or r,g,b,a with 0-255 (default white).
durationnumbernoHow long it shows, in seconds (0 keeps it until replaced).
fontnumbernoFont size in points.
horizontalstringnoleft, center, rightWhere it sits horizontally, and how its lines align (default center).
opacitynumbernoOverall opacity from 0 to 1 (default 1).
verticalstringnotop, center, bottomWhere it sits vertically.

Returns: JSON {"shown": true, "duration": seconds}, or {"shown": false} when the text was empty (the caption is taken away).

clear_overlays

Remove both captions (the title and the subtitle) from the window at once.

No parameters.

Returns: JSON {"cleared": true}.

recording_start

Start recording the window to an .mp4 video (H.264, encoded inside the app). Everything shown is captured, including the virtual mouse and captions. Stop it with recording_stop. Set the window size with window first, since the video keeps the size it starts with.

ParameterTypeRequiredValuesMeaning
filestringyesAbsolute path of the .mp4 file to write.
fpsnumbernoFrames per second (default 30, 1 to 60).
max_sidenumbernoLargest side of the video in pixels (default 1920); a bigger window is scaled down by a whole factor.

Returns: JSON {"recording": path, "fps": N}.

recording_stop

Stop the video recording and close the .mp4 file. Returns where it was written and how long it is.

No parameters.

Returns: JSON {"file", "frames", "seconds", "width", "height"}.