The Script action allows you to add code scripts to your commands that will be run when the action is triggered. This allows you to build more complex logic that can be done within regular actions, but without needing to write an entirely separate program. Scripts can be written in either C#, Python, or Javascript.
There is no unique functionality provided in the Script action to directly interact with Mix It Up, the Script action simply is a means to perform more complex logic in a simpler form for experienced users. However, you are able to leverage the Mix It Up Developer API from inside your Script action to perform some operations within Mix It Up.
Special Identifier replacement is supported within the text of the script.
Any value returned from the script when it is run will be stored in the Special Identifier $scriptresult
which can be leveraged in subsequent action.
C# code is compiled and run natively within Mix It Up using the System.CodeDom.Compiler.CompilerResults class and the System.Reflection classes. In the event of a compilation or run-time error, the resulting error message will be saved to the $scriptresult
Special Identifier. Using statements are allowed for .NET native namespace, but leveraging libraries outside of those are not possible. A dedicated application would need to be written and run with the External Program Action
The C# code template provided must be adhered to, but you can add additional functions or change the code within the Run() function. The code must return a result at the end of the Run() function, but you do not need to use the result if you do not wish to. Just ensure that some value is returned at the end. Whatever is returned from the Run() function is what will be stored within the $scriptresult
Special Identifier.
Python scripts are run directly via the Python interpreter and require a local installation of Python on your PC by running directly via the Python interpreter. You must set the Executable location for Python before any Python scripts can be used under Settings -> Commands. In the event of a compilation or run-time error, the resulting error message will be saved to the $scriptresult
Special Identifier.
Because Python scripts are run using the Python interpretter, you can reference any external libraries you wish. However unlike running a Python script via the External Program Action where there is a physical file location, Python scripts via the Script Action will have it's working directoy default to the Mix It Up installation folder. So it is important that any files or libraries you reference must use absolute file paths to avoid issues.
Python console output and errors are parsed and used to populate the $scriptresult
Special Identifier. Any result you wish to return much be written to standard output using the print() function in Python.
Javascript scripts are run using the Mix It Up Overlay. You to leverage external libraries by including them in the Overlay Endpoint via customization under Settings -> Overlay. In the event of a compilation or run-time error, there are no error messages logged. As such, you will need to leverage the F12 Developer Console in a regular web browser (Edge, Chrome, Firefox) to diagnose any issues that might exist in your code.
The Javascript code template provided must be adhered to, but you can add additional functions or change the code within the run() function. The code must return a result at the end of the run() function, but you do not need to use the result if you do not wish to. Just ensure that some value is returned at the end. Whatever is returned from the run() function is what will be stored within the $scriptresult
Special Identifier.