TABLE OF CONTENTS
Introduction
Scripts are supported in three ways in Dise:
From a Dise Movie / Template
Python, JScript (not JavaScript) or VBScript using the Windows Scripting Host.
DISEScript objectEmbedded in web page
JavaScript
Dise objectDise Parser
Python, JScript (not JavaScript) or VBScript using the Windows Scripting Host.
DPModifier object
Python/JScript/VBScript scripting
https://support.dise.com/support/solutions/articles/9000173620-scripting
Embedded in web page
General
A JavaScript object called Dise is available when displaying a web page in the CEF Web Object.
All functions on the Dise object will return a Promise that resolves or rejects based on the success of the call.
https://www.w3schools.com/js/js_promise.asp
Supported Dise methods
Log
Dise.log = function(message, logLevel = "debug")
Logs a message to system log or Portal. The loglevel is one of:
debug (default)
info
notice
warning
error
critical
alert
emergency
Example usage
<html> <head> <script language="JavaScript"> Dise.log('Some log') .then(res => console.log('Log success: ', res)) .catch(err => console.log('Log error: ', err)); </script> </head> <body> This web page will log a row. </body> </html>
Sleep
Dise.sleep = function(ms)
Pauses execution for ms milliseconds.
getVariable
Dise.getVariable = function(name, scope = "default")
Retrieves a Dise variable by the given name from the main program as a string
Scope is one of
default
local (not yet supported)
global
Example usage
<html> <head> <script> async function GetMessage() { const box = document.getElementById('textBox'); const myMessage = await Dise.getVariable('Message'); box.innerHTML = myMessage; } </script> </head> <body onLoad="GetMessage();"> <div id="textBox"></div> </body> </html>
setVariable
Dise.setVariable = function(name, value, scope = "default")
Sets a Dise variable by the given name.
Scope is one of
default
local (not yet supported)
global
Example usage
<html> <head> <script> function SetMessage() { const box = document.getElementById('textBox); Dise.setVariable('Message', box.innerHTML) .then(res => alert('Variable was set!')) .catch(err => alert('Error: ', err)); } </script> </head> <body> <input id="textBox"></input> <button onClick="SetMessage();">Set variable!</button> </body> </html>
getTrigger
Dise.getTrigger = function(name)
Retrieves a boolean value of Dise trigger by the given name.
Example usage
<html> <body> <script> Dise.getTrigger('MyTrigger') .then(res => { if (res) document.write('Trigger set!'); else document.write('Trigger not set!'); }) .catch(err => document.write('Error: ', err)); </script> </body> </html>
setTrigger
Dise.setTrigger = function(name, state)
Sets the trigger by the given name to the boolean state (true / false)
Example usage
<html> <head> <script> async function setTrigger(cb) { await Dise.setTrigger('MyTrigger', cb.checked); } </script> </head> <body> <label><input type="checkbox" onclick="setTrigger(this);">Enable</label> </body> </html>
toggleTrigger
Dise.toggleTrigger = function(name)
Sets the trigger to true if its state is false and vice versa.
Example usage
<html> <head> <script> async function toggle() { await Dise.toggleTrigger('MyTrigger'); } </script> </head> <body> <button onclick="toggle();">Toggle</button> </body> </html>
back
Dise.back = function(name)
Sends a command to go back one scene in the layer with the given name.
Example usage
<html> <head> <script> function go() { const s = document.getElementById("direction"); const selectedDirection = s.options[s.selectedIndex].text; if (selectedDirection == 'back') { Dise.back('Main') .then(res => console.log('Going back one scene...')) .catch(err => console.err(err)); } else if (selectedDirection == 'forward') { Dise.forward('Main') .then(res => console.log('Going forward one scene...')) .catch(err => console.err(err)); } } </script> </head> <body> <select id="direction"> <option value="back" selected="selected">back</option> <option value="forward">forward</option> </select> <button onclick="go();">Go!</button> </body> </html>
forward
Dise.forward = function(name)
Sends a command to go forward one scene in the layer with the given name.
Example usage
(see above)
action
Dise.action = function(name, param1, param2)
Sends a special “action” command where name is one of:
UpdateFile
Triggers a file update.
Where param1 is the destination file and param2 is the source file.
If source is not specified the destination file is simply reloaded
Note: source file will be removed if specified!
From version 27.541TakeOver
Creates a new layer for a specified media file which is played, exclusively on top, once.
All other content is paused during this playback.
param1 is the media file path, param2 is the media type of the file
From version 28
reload
Dise.reload = function()
Triggers a reload of the web page.
Note: this is not the same as a location.reload() javascript call, as it will reset the webpage to what is specified in the Dise object.
<html> <head> <script> setInterval(function(){ Dise.reload() }, 3600000); </script> </head> <body> ... </body> </html>