Creating a Qt Script
Using the Script Editor, you can create Qt scripts for Harmony.
For details about the scripting nodes, methods, and DbScript documentation, click the links below.
• | Harmony Script Interface Documentation |
• | Script Module Documentation |
• | DbScript Documentation |
You can also find the help files in the Script Editor view. From the Script Editor menu, select Help > Scripting Interface Documentation.
- From the top menu, select Windows > Script Editor.
The Script Editor view opens listing all the available JavaScript files.
- Do one o the folowing:
‣ | From the Script Editor menu, select File > New Script |
‣ | In the Script Editor toolbar, click the New Script button. |
‣ | From the top menu, select Windows > Toolbars > Script Editor. |
The New Script dialog box appears.
- Enter a name and click on OK.
‣ | When working with Harmony Server, you must set the location where the script will be save, either User level, Global level, Environment level, or Job level. |
When working with Harmony Stand Alone, your custom scripts and default scripts are stored in:
- Windows:
- Toon Boom Harmony Premium: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Harmony\1200-scripts
- Toon Boom Harmony Advanced: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Advanced\1200-scripts
- Toon Boom Harmony Essentials: C:\Users[\user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Essentials\1200-scripts
- Mac OS X:
- Toon Boom Harmony Premium: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Harmony/1200-scripts
- Toon Boom Harmony Advanced: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Advanced/1200-scripts
- Toon Boom Harmony Essentials: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Essentials/1200-scripts
On Mac OS X, the Library folder is a hidden folder. To display the display the folder, told down the Alt key.
- Linux:
- /home/[user_name]/Toon Boom Animation/Toon Boom Harmony/1200-scripts/
- /home/[user_name]/Toon Boom Animation/Toon Boom StageAdvanced/1200-scripts/
When working with Harmony Server, your custom scripts are stored in:
- Global: [Server_Name] > USA_DB > scripts
- Environment: [Server_Name] > USA_DB > environments > [environment_name]
- Job: [Server_Name] > USA_DB > jobs > [job name]
- User: [Server_Name] > USA_DB > users > [user_name] > stage > 1200-scripts
The name of your script appears in the File column of the Script Editor view.
- Click in the right side of the Script Editor and start writing your script. Try typing in the following script:
function add3dPathCol()
{
column.add(“ColumnName”, “3DPATH”);
}
For a tutorial on coding in JavaScript, refer to docs.oracle.com/javase/tutorial/java
For a detailed Harmony script interface documentation, refer to Harmony Script Interface Documentation
You can also find the help files in the Script Editor view. In the Script Editor menu, select Help > Scripting Interface Documentation.
- To check your syntax, click Verify.
A window opens with syntax information.
- To test your script, select the script you want to run from the File column.
- Do one of the following:
‣ | From the Script Editor toolbar, click the Run button. |
‣ | From the Script Editor menu, select Play/Debug > Run. |
A window opens to ask you for the target function to run. In the window, select the function you want to execute.
To avoid selecting the function every time you want to run your script, you can set a target function. In the Script Editor toolbar, click the Set Target button or select Play/Debug > Set Target from the Script Editor menu. In the Function column, select the function to target and press OK.
‣ | To stop the execution of your script, click the Stop Execution button. |
‣ | You may receive this message: Only functions that have been saved or are explicitly called will be executed. |
This usually occurs if you did not select the function you wanted to run from the File column before running the script. When this happens, click Save and run your script again.
‣ | You may also see this message on the right side of the Script Editor: |
This is because the software jumped to the <<Sandbox>> item in the Function column. The <<Sandbox>> is provided to test scripts without saving them. Simply click on your newly created script and run it again.
- In the Script Editor, in the File column, select the script to delete.
- Do one of the following:
‣ | From the Script Editor toolbar, click the Delete Script button. |
‣ | From the Script Editor view menu, select File > Delete Script. |
- In the File list, select the script containing the function to debug.
- Do one of the following:
‣ | From the Script Editor toolbar, click the Debug button. |
‣ | From the Script Editor menu, select Play/Debug > Debug. |
A window opens listing the scripts and functions available.
- In the Functions column, select the function to debug and click OK.
The Qt Script Debugger opens.