Creating Scripts
Using the Script Editor, you can create Qt scripts for Storyboard Pro.
Your custom scripts and default scripts are stored here:
• | Windows: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Storyboard Pro\14200-scripts |
• | macOS: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Storyboard Pro/14200-scripts |
On macOS, the Library folder is a hidden folder. To display the display the folder, hold down the Alt key.
- Select Windows > Script Editor.
The Script Editor view opens. A list of all the available JavaScript files is displayed.
- From the Script Editor menu, select File > New Script
The New Script dialog box appears.
- Enter a name and click OK.
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 projectQuery()
{
var storyboard = new StoryboardManager();
print("This project has " + storyboard.numberOfScenesInProject() + " scenes in the project");
}
For a tutorial on coding in JavaScript, refer to https://www.w3schools.com/js.
For a detailed Storyboard Pro script interface documentation, refer to Storyboard Pro Script Interface Documentation
There are also help files in the Script Editor view. In the Script Editor menu, select
- To check your syntax, click Verify.
A window opens with syntax information.
- To test your script, select the script to run from the File column.
- 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 menu, select Play/Debug > Set Target. In the Function column, select a function and click OK.
‣ | To stop the execution of your script, select Play/Debug > Stop from the Script Editor menu. |
‣ | You may receive the following 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 the following message (in red) on the right side of the Script Editor: |
This is because the Storyboard Pro 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.