<< Click to Display Table of Contents >> Navigation: Actions > Script tools > JavaScript/Node.js script |
This action supports the full JavaScript language, unlike JS Script and JS Evaluate actions. JS Script and JS Evaluate actions use the system script engine and support a fairly simplified language.
By default, the JavaScript/Node.js script action uses the preinstalled node.js engine that comes with RoboTask. You can also use any other node.js kit installed and customized to your needs. The script can interact with RoboTask using the RoboTask object for node.js
You can find the language description here and the node.js objects description here.
Toolbar buttons
Save and Exit - saves task settings and closes the editor
Cancel - closes the editor without saving
Open - opens the script text from the external text file and places it into the script text editor.
Save as - saves the script text to an external file.
Add var - calls the variable selection window and places the variable call at the current cursor position.
Script Mode
There are two options
•Execute inline script - execute the script you have written in the script editor. In this case, you will see the text editor.
•Execute external script - run the script from an external file.
Expand variables
Check this box if you want to expand RoboTask variables in the script body before running the script. With variables, you can create dynamic text depending on different conditions.
Script
In "Execute inline script" mode, it is a script text editor.
In "Execute External script" mode, it is a field to enter the file name and a file selection button.
Options
Assign exit code to a variable
Enter the variable name to save the script exit code. By default, the exit code is 0, but it can be changed in the script.
Assign script output to a variable
Enter a variable name in this field to write the script's output text stream to a variable. You will then be able to process this text in your task.
Node.js interpreter
•Use Embedded Node.js - use the default Node.js engine that comes with RoboTask.
•Use Specified Node.js - use your Node.js package. You can have several Node.js packages configured for different tasks.
Command line template
A command line template is needed to be able to pass custom parameters to the script. The template must contain two mandatory predefined parameters:
•[InterpreterPath] - path to the interpreter module to be executed
•[ScriptPath] - path to the script file
Both parameters are formed automatically.
Module search paths
Here you can set the search paths to additional Node.js modules (which are included in the script with the require command).
Related Topics