Scripting
HANtune offers the ability to run your own scripts by integrating a Jython interpreter. Jython is a Java implementation of a Python interpreter, which means that it runs inside the Java Virtual Machine (JVM). This makes it very easy to interface with HANtune and enables us to automate its functionality.
Contents
Scripts
Adding a script to a project
To add a script to your project right click the 'Scripts folder' in the 'Project Data' side panel and click 'Add Script'. Browse to the right directory, select your script and click 'Add Script'.
Starting a script
To start a script right click on it in the 'Project Data' side panel and click 'Start'
Alternatively, you can start a script by first dragging it from the 'Project Data' side panel to the layout and clicking the newly created button.
To indicate that a script is running, its icon in the 'Project Data' side panel will change its appears.
Stopping a script
Startup scripts
Console and Interactive Interpreter
Signals and Parameters
Scripted Signals
Creating a new signal:
mySignal = createSignal('MySignal')
Setting its attributes:
mySignal.minimum = 0 mySignal.maximm = 255
Tip: to see a full list of attributes enter dir(mySignal)
into the console.
Triggers
mySignal = createSignal('MySignal') def myTriggerFunction(): if (mySignal.value > 50): print 'mySignal out of bounds' createTrigger(mySignal, myTriggerFunction)
mySignal = createSignal('MySignal') canSignal = getSignal('CanSignal') def myTriggerFunction(): mySignal.value = canSignal.value * 2 createTrigger(canSignal, myTriggerFunction)