Skip to content

Guides / Using Lumit / The application

Updated

Scripts

A script is a JavaScript file that edits the open project. After Effects scripts (.jsx) run as they are. A script also runs Lumit’s own commands, listed in the Scripting reference.

  1. Choose File ▸ Scripts ▸ Run script….
  2. Pick the .js or .jsx file.

A script dropped on the window runs after one question.

While it runs, a card covers the window with the script’s name and Stop. A file the script asks for opens the system file dialogue, and a message it shows appears in the status line.

The whole run is one undo step, named after the first name the script gives app.beginUndoGroup(), or after the file. A script that fails or is stopped leaves the project as it was.

When a script fails, the status line gives the reason and the line it failed on.

When a script prints with $.writeln() or shows an alert(), Show log on the status line lists the lines, with Copy. Alerts come after the printed lines.

File ▸ Scripts lists the .js and .jsx files in the Scripts folder, with a submenu for each folder inside it. Open scripts folder shows it in the file manager.

Windows%LOCALAPPDATA%\Lumit\Lumit\data\scripts\
macOS~/Library/Application Support/dev.Lumit.Lumit/scripts/
Linux~/.local/share/lumit/scripts/

Settings ▸ General ▸ Scripts folder lists another folder instead. Clear goes back.

The Scripts rows in Settings ▸ General run a script from the Scripts folder after an event. Each is None until set.

RowRuns after
Export finishedeach export from the export queue
Project openeda project opens
Project savedthe project is saved

It runs as from the menu, and the status line names it after.

lumit.args.event"export", "open" or "save"
lumit.args.filethe exported file’s or the project’s file name, without its folder

An event script is skipped while another script runs. A script’s own saves and exports, and the save made before a project closes, run none.

ObjectWhat works
appproject, newProject(), beginUndoGroup(), endUndoGroup()
app.projectitems, numItems, item(), rootFolder, activeItem, file, importFile(), save()
itemsaddFolder(), addComp(), length, [n]
Any itemname, parentFolder, comment
CompItemwidth, height, duration, frameRate, frameDuration, pixelAspect, numLayers, layer(), layers, markerProperty, openInViewer(), saveFrameToPng()
layersaddCamera(), addNull(), addSolid(), add() of footage or a comp, precompose(), byName(), length, [n]
Any layername, index, enabled, guideLayer, threeDLayer, shy, solo, locked, motionBlur, startTime, inPoint, outPoint, parent, setParentWithJump(), autoOrient, moveToBeginning(), moveToEnd(), moveBefore(), moveAfter(), remove(), property(), transform, Effects, marker
PropertiesAnchor Point, Position, Scale, Orientation, X, Y and Z Rotation, Opacity, and a camera’s Point of Interest, Zoom, Focus Distance and Aperture, by match name or by name
Keysvalue, valueAtTime(), setValue(), setValueAtTime(), setValuesAtTimes(), addKey(), removeKey(), numKeys, keyTime(), keyValue(), setInterpolationTypeAtKey(), setTemporalEaseAtKey(), keyInTemporalEase(), keyOutTemporalEase(), setTemporalAutoBezierAtKey(), setTemporalContinuousAtKey(), setSpatialTangentsAtKey()
Expressionsexpression, expressionEnabled
EffectsaddProperty() by match name or name, property() by number, match name or Lumit’s name, numProperties, name, enabled
MarkerssetValueAtTime() with a MarkerValue, setValuesAtTimes(), numKeys, keyTime(), keyValue(), removeKey()
FootageItemmainSource.conformFrameRate, file, duration, width, height, frameRate, frameDuration
ImportOptionsfile, sequence, footage as importAs
File, Folder$.fileName, name, fsName, parent, exists, getFiles(), open(), read(), readln(), write(), writeln(), close(), encoding, lineFeed, remove(), Folder.create(), File.openDialog()
Window"dialog" and "palette", add() of group, panel, statictext, edittext, checkbox, radiobutton, dropdownlist, slider and button, text, value, selection, items, enabled, onClick, onChange, orientation, alignChildren, alignment, margins, spacing, show(), close()
Globalsalert(), $.writeln(), writeLn(), AutoOrientType, KeyframeInterpolationType, KeyframeEase, MarkerValue, ImportAsType

Anything else stops the script with a message naming it.

  • A Bezier key with no ease of its own is automatic. Spatial tangents are not carried, so a point moves between keys in a straight line.
  • valueAtTime() reads between eased keys in a straight line.
  • Roving keys stay at their times.
  • Key times land on the nearest frame of the comp.
  • A camera a script adds, and a layer it makes 3D, turn in After Effects’ rotation order and keep their X, Y and Z Rotation as they are. On a 3D layer in Lumit’s order they are turned into that order, which matches After Effects on every key.
  • A layer given a parent stays where it is at the comp’s start.
  • app.newProject() answers the open project.
  • activeItem is the comp open in the Viewer. On the command line it is the project’s only comp, or null when there are more.
  • An expression is JavaScript. While it is on, the keys under it are not kept.
  • An effect Lumit does not have stops the script. Controls named by number or match name take After Effects’ values and convert them as importing does. By name, they take Lumit’s own.
  • A marker keeps its comment, duration, label colour and whether it is a chapter. Chapter text, URLs and cue points are not kept.
  • A numbered still always imports as the whole sequence.
  • A comp’s or solid’s pixel aspect is not kept.
  • #target lines are skipped. #include, //@include and #includepath read in files from the script’s own folder and the folders inside it, each once.
  • A script’s window is drawn with Lumit’s own controls. Fonts, colours and places are not kept, and sizes, margins and spacing are taken roughly. A palette waits as a dialog does.
  • Escape or the close mark presses a window’s Cancel button, or makes show() answer 2.
  • On the command line and over MCP, show() answers 2 at once.
  • A script reads and lists files in its own folder and the folders inside it, and files you chose or passed to it. A script at the top of a drive or in the home folder itself has no folder of its own. Anywhere else exists is false.
  • A script writes text files, as UTF-8, only in its own folder and the folders inside it, and never over the project. A run writes at most 64 MB. A script with no folder of its own, as over MCP, writes nothing.
  • A script imports footage only from the files it can read. It saves the project over its own file or as a new .lum file, and exports and saves frames, only into the project’s folder or its own, never over a file.
  • A network path or a device is refused.