Scripts
Millumin is able to execute JavaScript program to automate task on the computer, control software/hardware, get data from Internet, react to Millumin’s events …
Run your first Script
A script can be created from the +
button of the library
:
The created script can be found in the Scripts
group of the library:
Then, add this script to a layer and run it : the small light-icon remains green until the script finished. If your script is listening for some event, it could run endlessly, but you can stop it.
Lastly, you start editing the script to make it what you want :
Be sure to check the provided templates, as they shows various abilities of the scripts (using different functions for different purposes).
Another very handy feature is auto-completion : type a few characters (Mil
for example) to show the possibilities in terms of functions.
Functions
Control Millumin
These functions are prefixed by Millumin.
Exemple : Millumin.getLaunchedColumnName()
Here is the list :
- Columns
- getLaunchedColumnIndex()
- getLaunchedColumnName()
- launchColumn(indexOrName)
- launchOrStopColumn(indexOrName)
- stopColumn()
- launchPreviousColumn()
- launchNextColumn()
- Play
- play()
- pause()
- playOrPause()
- goToTime(time)
- goToTimelineSegment(name)
- Selection
- getCurrentBoardIndex()
- getCurrentBoardName()
- selectBoard(indexOrName)
- selectLayer(indexOrName)
- selectLight(indexOrName)
- Masters
- setMasterVideo(value)
- setMasterAudio(value)
- setMasterDMX(value)
- Brush
- setBrush(x, y, pressure)
- Project
- getCanvasSize(name)
- enterFullscreen()
- exitFullscreen()
- displayTestCard()
- hideTestCard()
- enableWorkspace()
- disableWorkspace()
- openProject(path)
- saveProject(nullOrPath)
- quit()
- Light
- getLightIntensity(indexOrName)
- setIntensity(indexOrName, value)
- Layer
- getLayerPosition(indexOrName)
- setLayerPosition(indexOrName, x, y)
- getLayerSize(indexOrName)
- getLayerOpacity(indexOrName)
- setLayerOpacity(indexOrName, value)
- getLayerScale(indexOrName)
- setLayerScale(indexOrName, value)
- getLayerRotation(indexOrName)
- setLayerRotation(indexOrName, value)
- getLayerMapping(indexOrName)
- setLayerMapping(indexOrName, arrayOfPoints)
- Media
- getLayerMediaTime(indexOrNameOfLayer)
- setLayerMediaTime(indexOrNameOfLayer, time)
- getLayerMediaNormalizedTime(indexOrNameOfLayer)
- setLayerMediaNormalizedTime(indexOrNameOfLayer, value)
- getLayerMediaSpeed(indexOrNameOfLayer)
- setLayerMediaSpeed(indexOrNameOfLayer, value)
- getLayerMediaText(indexOrNameOfLayer)
- setLayerMediaText(indexOrNameOfLayer, text)
- restartLayerMedia(indexOrNameOfLayer)
- pauseLayerMedia(indexOrNameOfLayer)
- restartOrPauseLayerMedia(indexOrNameOfLayer)
- stopLayerMedia(indexOrNameOfLayer)
- startMedia(indexOrNameOfLayer, indexOrNameOfMedia)
- getMediaProperty(indexOrNameOfLayer, indexOrNameOfMedia, propertyName)
- setMediaProperty(indexOrNameOfLayer, indexOrNameOfMedia, propertyName, value)
- importMedia(pathOrMediaName, indexOrNameOfLayer, nullOrIndexOrNameOfColumn, startImmediately)
- removeMedia(indexOrNameOfLayer, indexOrNameOfColumn)
- Effects
- getEffectProperty(indexOrNameOfLayer, indexOrNameOfEffect, propertyName)
- setEffectProperty(indexOrNameOfLayer, indexOrNameOfEffect, propertyName, value)
- Data (commands are the same as for the data-track)
- sendMIDI(nullOrDestination, command)
- sendOSC(senderNameOrAddressPort, command)
- sendDMX(senderName, command)
- sendString(senderNameOrAddressPort, command)
Events
These functions are prefixed by on
, suffixed by Event
and always takes the event
parameter (a dictionary containing various infos).
Here is the list :
- onBlobTrackerEvent(event)
- onArtnetEvent(event)
- onDMXEvent(event)
- onElectronicDeviceEvent(event)
- onGamePadEvent(event)
- onInternalSignalEvent(event)
- onKeyboardEvent(event)
- onKinectEvent(event)
- onKinect2Event(event)
- onLeapMotionEvent(event)
- onMIDIEvent(event)
- onOSCEvent(event)
- onSACNEvent(event)
- onSkeletonTrackerEvent(event)
- onTimecodeEvent(event)
- onMilluminEvent(event)
This is a special event reflecting changes in Millumin.
The parameter is a dictionary containing :
- thename
of the event : a string likeelementUpdated
,launchedColumn
,stoppedColumn
,masterChanged
,layerSelected
orlightSelected
- thepath
: an array of strings explaining how to access the related object (for example the name of the board or the path to the layer’s property)
- somevalues
: for example the index/name of the column or the value of the layer’s property
System
These do not have any prefix :
- log(message)
- setTimeout(callback, ms)
- setInterval(callback, ms)
- clearTimeout(timeout)
- runCommand(command)
- runAppleScript(script)
- loadJSLibrary(url)
- getFileContents(path)
- getURLContents(url)
- getFileBinaryData(path)
- getURLBinaryData(url)
- writeFileContents(path, contents)
Interaction
If you prefer to run your script via an interaction, it is also possible.
Simply open the Interaction panel (CMD+M
), create an interaction and choose the action Run Script
:
This is very handy to create a shortcut for a specific set of actions in your project.
Examples
To get inspiration, have a look to the examples embed in Millumin : these will show you how to animate, send data, load external content, use a Javascript library, execute AppleScript, …