Scripts
Feature Description
Canvas Script Editor is an interface for users to create, control, and modify specific portions of the project's workflow. The Script Editor also has debugging support, giving the user an error whenever the script is called to run in runtime. The Script Editor uses JavaScript ES5 for its syntax and language, though it has commands unique to Canvas.
Canvas Script Editor uses JavaScript ES5. Only Features from ES5 or before are available to be used. Please refer to ECMAScript Documentation for complete specifications on the language. Features related to Document Object Model (DOM) are not supported in Canvas Script Editor.
Canvas can only run 100 scripts concurrently. If any more scripts attempt execution while 100 scripts are running, the script will not execute, and a warning notification will be shown during runtime.
Designer Functionalities
Script Editor
To open the Script Editor, go to Tools > Script Editor, or on the Toolbar, click on Open Script Editor… to open it. The screen will then show all created scripts and what the content of each one is. Users can edit, delete, add, import, or export scripts within the Script Editor.
Creating a Script / Command
To create a script, hit the + in the Script Editor. This will open a dropdown menu with the Create New Script or Create New Command option. Both will open up their respective setup pages when selecting either one. Create New Script will open a new page asking for the script's name, the Running Type, and the Running Period. There are three running types: Periodic, Startup, and Manual. If the script is set to be a Startup script, it will execute when the program runtime begins. Periodic will call the script at a set interval of time that is user-defined within the Script Properties; the range for this interval time is 0 - 2147483647 ms. Manual will call the script on an action or command bound to an object. An example would be a momentary button; this object has an Action tab, and the script can be called in any specified cause of Press, Double Click, or Release. Once the configuration is set up, clicking OK will close the window and create a new script with the specified format.
For Commands, clicking Create New Command will open up the Command Editor. Users can select from a list of commands to run for an object. These Commands are also available to be used as functions. When creating a command, users can set it as Local Commands or Global Commands. Local Commands will be Commands that are configured for each object, while Global Commands can be preconfigured for objects before being selected. Only a Local or Global Command List can be used once for an object.
Back to Top of Scripts
Editing a Script
To edit a script, double-left-click on the script. This will open up a panel on the right side of the Script Editor screen. This displays all of the functionality of a script. Users can make changes to the script on this screen. Changes are automatically saved as the user makes the edits. Users can also compile any script by clicking the Validate icon. This will confirm that the syntax is correct and can compile properly.
Back to Top of Scripts
Find and Replace
Find and Replace allows the user to search for specific parts of code within the script editor and can allow for mass replacement of specific code if needed. Users can be more specific in searches by specifying the case, only by searching for the same words, or by using Regular Expressions in the search.
Back to Top of Scripts