GO2cam is able to execute scripts written in JavaScript langage and stored in **.js** files. JavaScript files can be written out of GO2cam or by using the embedded JavaScript editor.
It it also possible to drag 'n drop a .js file in GO2cam window. The file will be open in the JavaScript editor
[1] Run button to launch the script
[2] Editing area where the script is written
[3] Output area. This area displays error messages when errors occur while executing a script. It can also be used to display information using console.log command
Launching a script using GO2cam in command line is possible with the token -js 'path_to_my_script.js' It is mandatory to use it combined with token -y 'product_name' to indicate the appropriate product (milling, turning...etc.). The list of GO2cam products is available by running GO2cam in command line with the token -h. Optionaly, it is possible to use the token -blackbox to hide GO2cam graphic interface while the script is running.
Example to run a script for milling
Example to run a script for turning keeping GO2cam invisible
Since version 6.11.203 of GO2cam, it is possible to give arguments to the script using - - token. Arguments can be retrieved in script file with variable args. Let's assume that test_args.js contains the following code
The execution of the following command line will display a message box displaying input arguments
Complex scripts can be divided to several .js files. File contents can be imported into a main .js file using GO2SUtil.ImportJS function (the script files must be in the same folder). Get toolbox.js file here: toolbox.js to run the following script.
It is not possible to import external libraries