About HSL scripting with Shogun
This guide explains the HSL scripting that is available with Shogun, introduces you to the script interface components, and teaches you the basic structure and tools you need to use scripts and to tailor them to your requirements.
Before you create scripts, ensure that you feel comfortable using Shogun Live and Post to capture, edit, and export data.
Note the following points:
- Almost all operations you perform manually in Shogun can be repeated using scripts.
- Shogun HSL scripts are based on the HOM Script Language (HSL).
- For information about Python scripting functionality, see Python scripting with Vicon Shogun.
Creating scripts
-
Most HSL scripts are created using the Shogun Post Script Editor.
The easiest way to create an HSL script is to open the Script Editor (see Open the Script Editor), click Record Actions , then perform one or more actions in Shogun. When you are done you can click Record Actions again to stop recording. When the steps are recorded, you can execute them by clicking Run Script , or customize them to create a more full-featured script.
- The Script Editor features tools for editing scripts, debugging scripts, saving scripts and loading previously saved scripts. For more information, see Use the Shogun Post Script Editor.
- You can use any ASCII text editor to create scripts as long as that editor uses only standard ASCII characters. Note that although you cancreate ASCII files with Microsoft® Word and WordPad, they frequently insert nonstandard characters like em-dashes and "curly" quotes, which Shogun cannot read.
Sometimes you want to create scripts that prompts the user for information. You can do this in the following ways:
- Create a user window that collects information which is subsequently passed to a script (see Create user windows to run HSL scripts).
- Create a pipeline operation. A pipeline operation is just a script with extra statements that ask the user to provide information prior to execution. You can string together multiple pipeline operations to create very sophisticated routines.
Remember that Shogun Post comes with example HSL scripts that you can use to modify and manipulate motion capture data. You can find these sample scripts in the C:\Program Files\Vicon\ShogunPost#.#\Scripts folder. Sometimes the easiest way to create a script is simply to duplicate and modify one of the existing scripts.
Running scripts
- You can execute HSL and Python commands in the command line on the status bar at the bottom of the Shogun Post window. This is handy when you just want to execute one or two commands and don't want to open a panel. For more information, see Run scripts from the command line.
- After you've created a script, you can create a hot key for it, add it to the Marking menu, or put it on the ribbon.
Reviewing executed scripts
- The Log displays a list of all the commands you have executed in the current session. To display the Log, either:
- On the status bar, click the Log button.
or
- On the General menu, click Log. The Log displays a list of previously executed commands. This is useful when you want to see the results of previous commands while writing a script.
- On the status bar, click the Log button.
- You can also use the print command to write the contents of specified strings to the Log (see Print HSL command data to Log).
Now that you understand these fundamentals, you can begin creating, using, and allowing others to use your scripts.