- Modules
- Harmony Scripting Resources
- Creating Qt Scripts
Creating Qt Scripts
T-HSCP-001-002
You can create scripts for Harmony by using the Script Editor view.
To help familiarize yourself with Harmony scripts, you can open the Script Editor view and look into the TB_sceneCreated
script. This script is automatically executed when you create a scene. By default, it sets the scene's length to 60 frames and creates a basic layout containing a single drawing layer. You can customize this script to automatically set up scenes you create to fit your project's needs.
How to create a script
- From the top menu, select Windows > Script Editor.
The Script Editor view opens listing all the available JavaScript files.
- Do one o the following:
- 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 saved, 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\1400-scripts
- Toon Boom Harmony Advanced: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Advanced\1400-scripts
- Toon Boom Harmony Essentials: C:\Users[\user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Essentials\1400-scripts
- macOS:
- Toon Boom Harmony Premium: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Harmony/1400-scripts
- Toon Boom Harmony Advanced: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Advanced/1400-scripts
- Toon Boom Harmony Essentials: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Essentials/1400-scripts
On macOS, 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/1400-scripts/
- /home/[user_name]/Toon Boom Animation/Toon Boom StageAdvanced/1400-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 > 1400-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”); }
- 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.
- To stop the execution of your script, click the Stop Execution button.
- You may receive this message:
- You may also see this message on the right side of the Script Editor:
A window opens to ask you for the target function to run. In the window, select the function you want to execute.
“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.
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.
Time Estimated 20 mins
Difficulty Level Advanced