JavaScript command reference

From MXWendler Wiki
Revision as of 17:27, 8 August 2026 by Admin (talk | contribs) (Admin moved page 3. JavaScript command reference to JavaScript command reference: Remove nonsensical '3.' numbering prefix from reference titles)
Jump to navigation Jump to search


This page lists the commands of the MXWendler JavaScript command interface. Scripts run on an embedded ECMAScript engine (Duktape) and reach the software through the global mxw object plus a few free functions.

The presented JavaScript commands supported in version 7.2. and up

Legend

FLOATS are written with one decimal: 0.0 .. 1.0 → every float between 0 and 1 inclusive.

INTEGERS are written as plain numbers or ranges: 1 .. 5 → the integers 1,2,3,4,5.

STRINGS are written between double quotes.

When OR appears, two alternative call formats produce a similar result; use one at a time.

Addressing: widgets are targeted by their OSC-style address string, e.g. /mxw/track/active/layer/active/clip.

Access model: mxw.playlist and mxw.io are ready-made objects – call their methods directly, e.g. mxw.playlist.play(), mxw.io.dmx(4). mxw.widget(address), mxw.media(name), mxw.preload(n) and mxw.grabber(name) are factories that take an address/name/index and return the object to call, e.g. mxw.widget("/mxw/path").getValue().

Reference

JS COMMAND DESCRIPTION EXAMPLE
Software Info
mxw.millis milliseconds passed since the software was opened print_console("passed time is " + mxw.millis)
mxw.width current frame width in px print_console("frame width is " + mxw.width)
mxw.height current frame height in px print_console("frame height is " + mxw.height)
mxw.outwidth current output width in px print_console("output width is " + mxw.outwidth)
mxw.outheight current output height in px print_console("output height is " + mxw.outheight)
mxw.framecounter number of frames rendered since the software was opened print_console("frames rendered: " + mxw.framecounter)
print_console("text") print a line to the script console (global function) print_console("hello")
print_statusline("text") print text on the application status line (global function) print_statusline("running")
mxw.makescreenshot("path") save a full-frame screenshot as PNG mxw.makescreenshot("c:/Users/me/Desktop/shot.png")
mxw.makesectionscreenshot("path", x, y, w, h) save a cropped screenshot of the region (x, y, w, h) mxw.makesectionscreenshot("c:/Users/me/Desktop/crop.png", 0, 0, 400, 200)
mxw.describe() return a text listing of every operation known to the unified interface registry print_console(mxw.describe())
I/O ( mxw.io )
mxw.io.dmx(channel) return the DMX value received on the given channel print_console("DMX ch4 = " + mxw.io.dmx(4))
mxw.io.midi(device, channel) return the MIDI value received from device/channel print_console("MIDI = " + mxw.io.midi(1, 6))
mxw.io.keyboard(state, key) return whether the given key (ASCII) is in the given state mxw.io.keyboard(0, 65)
mxw.io.send_dmx(channel, value) send a DMX value on a channel mxw.io.send_dmx(4, 255)
mxw.io.send_midi(device, channel, value) send a MIDI value to device/channel mxw.io.send_midi(1, 6, 100)
mxw.io.pjlink("command", "ip", "pw") PJLink projector control. Commands: on, off, avmute_on, avmute_off, vmute_on, vmute_off mxw.io.pjlink("on", "192.168.1.2", "panasonic")
mxw.io.send_osc("host", port, "address", "tags", ...args) send an OSC message. tags is one char per argument: d float, i int, c string, b blob (array of 0..255) mxw.io.send_osc("127.0.0.1", 7000, "/cue", "ci", "go", 5)
Playlist ( mxw.playlist )
mxw.playlist.preload_media() preload the media used by the playlist mxw.playlist.preload_media()
mxw.playlist.play() play the playlist mxw.playlist.play()
mxw.playlist.pause() pause, or restart if already paused mxw.playlist.pause()
mxw.playlist.go_pause(true/false) halt (true) or resume (false) playback mxw.playlist.go_pause(true)
mxw.playlist.skiptonext() skip to the next cue mxw.playlist.skiptonext()
mxw.playlist.go_next() go to the next cue without playing mxw.playlist.go_next()
mxw.playlist.go_prev() go to the previous cue mxw.playlist.go_prev()
mxw.playlist.go_first() go to the first cue mxw.playlist.go_first()
mxw.playlist.navigate_index(index) go to the cue with the given index mxw.playlist.navigate_index(2)
mxw.playlist.navigate_string("name") go to the cue matching the given name mxw.playlist.navigate_string("BG_video2")
mxw.playlist.get_active_cue() return the active cue index var i = mxw.playlist.get_active_cue()
Preload ( mxw.preload(n) )
mxw.preload(n).clear() clear the selected preload mxw.preload(2).clear()
mxw.preload(n).set_media("filename") set the preload media by filename mxw.preload(2).set_media("try.mp4")
mxw.preload(n).set_name("name") rename the preload mxw.preload(2).set_name("new_background")
mxw.preload(n).get_name() return the preload name var s = mxw.preload(2).get_name()
mxw.preload(n).add_preload() load the preload into the layers mxw.preload(2).add_preload()
mxw.preload(n).trigger_preload() trigger a layer from the preload mxw.preload(2).trigger_preload()
mxw.preload(n).get_activated() true if the preload is open for edit mxw.preload(2).get_activated()
mxw.preload(n).set_activated(true/false) open/close the preload for edit mxw.preload(2).set_activated(false)
mxw.preload(n).get_layer_position() return the preload's layer index mxw.preload(2).get_layer_position()
mxw.preload(n).get_track_position() return the preload's track index mxw.preload(2).get_track_position()
mxw.preload(n).set_layer_position(pos) set the preload's layer index mxw.preload(2).set_layer_position(2)
mxw.preload(n).set_track_position(pos) set the preload's track index mxw.preload(2).set_track_position(2)
Widgets ( mxw.widget(address) )
mxw.widget("/mxw/path").isvalid() true if the address resolves to a widget if (mxw.widget("/mxw/path").isvalid()) {}
mxw.widget("/mxw/path").getValue() return the widget's normalized value var o = mxw.widget("/mxw/track/active/layer/active/opacity").getValue()
mxw.widget("/mxw/path").setValue(v) set the widget's normalized value mxw.widget("/mxw/track/active/layer/active/opacity").setValue(0.5)
mxw.widget("/mxw/path").getStringValue() return the widget's string value (e.g. a cue/clip name) print_console(mxw.widget("/mxw/playlist/container/1/column/0/row/1").getStringValue())
mxw.widget("/mxw/path").setStringValue("text") set the widget's string value (e.g. name a cue) mxw.widget("/mxw/playlist/container/1/column/0/row/1").setStringValue("background videoclip")
mxw.widget("/mxw/path").animate(initvalue, incomingvalue, duration, delta, type) animate the widget value over duration ms mxw.widget("/mxw/path").animate(0.0, 1.0, 1000, 0.0, 0)
mxw.widget("/mxw/path").info() return an array describing the widget. For a clip: [length, width, height, millis_per_frame, cache_state, media_path]. Empty array if the address does not resolve var info = mxw.widget("/mxw/track/active/layer/active/clip").info(); print_console(info[5]);
Media ( mxw.media(name) )
mxw.media("name").isvalid() true if the named media exists if (mxw.media("USB Cam").isvalid()) {}
mxw.media("name").ptz("ptz_is_supported") return whether the (NDI) camera supports PTZ mxw.media("USB Cam").ptz("ptz_is_supported")
mxw.media("name").ptz("ptz_zoom", value) zoom, 0 (in) .. 1 (out) mxw.media("USB Cam").ptz("ptz_zoom", 0.5)
mxw.media("name").ptz("ptz_zoom_speed", value) zoom speed, -1 (out) .. 1 (in) mxw.media("USB Cam").ptz("ptz_zoom_speed", 0.5)
mxw.media("name").ptz("ptz_pan_tilt", pan, tilt) absolute pan/tilt, -1 .. 1 mxw.media("USB Cam").ptz("ptz_pan_tilt", -0.5, 0.2)
mxw.media("name").ptz("ptz_pan_tilt_speed", pan_speed, tilt_speed) pan/tilt speed, -1 (right/down) .. 1 (left/up) mxw.media("USB Cam").ptz("ptz_pan_tilt_speed", -0.3, 0.8)
mxw.media("name").ptz("ptz_store_preset", n) store position/focus/zoom into preset 0 .. 99 mxw.media("USB Cam").ptz("ptz_store_preset", 75)
mxw.media("name").ptz("ptz_recall_preset", n, speed) recall preset 0 .. 99 at speed 0 .. 1 mxw.media("USB Cam").ptz("ptz_recall_preset", 4, 0.5)
mxw.media("name").ptz("ptz_auto_focus") toggle auto-focus mxw.media("USB Cam").ptz("ptz_auto_focus")
mxw.media("name").ptz("ptz_focus", value) absolute focus, 0 (infinity) .. 1 (closest) mxw.media("USB Cam").ptz("ptz_focus", 0.5)
mxw.media("name").ptz("ptz_focus_speed", value) focus speed, -1 (out) .. 1 (in) mxw.media("USB Cam").ptz("ptz_focus_speed", -0.2)
mxw.media("name").ptz("ptz_white_balance_auto") auto white balance mxw.media("USB Cam").ptz("ptz_white_balance_auto")
mxw.media("name").ptz("ptz_white_balance_indoor") indoor white balance mxw.media("USB Cam").ptz("ptz_white_balance_indoor")
mxw.media("name").ptz("ptz_white_balance_outdoor") outdoor white balance mxw.media("USB Cam").ptz("ptz_white_balance_outdoor")
mxw.media("name").ptz("ptz_white_balance_oneshot") set white balance once from current brightness mxw.media("USB Cam").ptz("ptz_white_balance_oneshot")
mxw.media("name").ptz("ptz_white_balance_manual", red, blue) manual white balance, 0.0 .. 1.0 each mxw.media("USB Cam").ptz("ptz_white_balance_manual", 0.1, 0.7)
mxw.media("name").ptz("ptz_exposure_auto") auto exposure mxw.media("USB Cam").ptz("ptz_exposure_auto")
mxw.media("name").ptz("ptz_exposure_manual", level) manual exposure iris, 0.0 (dark) .. 1.0 (light) mxw.media("USB Cam").ptz("ptz_exposure_manual", 0.4)
mxw.media("name").ptz("ptz_exposure_manual_v2", iris, gain, shutter) manual exposure iris/gain/shutter, 0.0 .. 1.0 each mxw.media("USB Cam").ptz("ptz_exposure_manual_v2", 0.4, 0.2, 0.5)
Grabber ( mxw.grabber(name) )
mxw.grabber("name").isvalid() true if the named keystone grabber exists if (mxw.grabber("cam").isvalid()) {}
mxw.grabber("name").getGrabSizeX() grabber width in px mxw.grabber("cam").getGrabSizeX()
mxw.grabber("name").getGrabSizeY() grabber height in px mxw.grabber("cam").getGrabSizeY()
mxw.grabber("name").getData() return the grabber's pixels (RGBA, width×height×4) var px = mxw.grabber("cam").getData()

See also