Viz Pilot User Guide

Version 8.6 | Published October 23, 2020 ©

Script Editor

images/download/attachments/68857402/twgeneral_enablescript_53.png

There are two ways to add scripts to a template. Scripts that are specific to the template can be added in the Main script tab, or as separate scripts (from the Main script) created as Script Units.

Tip: Script Units can be stored as reusable scripts for more than one template and can be used as a means of organizing scripts into functional and logical pieces.

This section contains the following topics:

Context Menu

images/download/attachments/68857402/twgeneral_scripteditorcontextmenu.png

  • New edit window: Opens a tab with a new script editor.

  • Open: Opens a script file in a separate tab. See also Reopen used script units.

  • Insert from file...: Inserts script file, adding it as a script unit to the script that was open at the time of the operation.

  • Save (CTRL + S): Saves a script unit to the computer (not to repository).

  • Save As: Saves a script unit with a new name to the computer (not to repository).

  • Save to repository (CTRL + R): Saves edited script units to the database repository.

    Note: When a template with script units is saved, a dialog appears asking for script units to be saved to the existing database. Use the Save to Repository menu option to save script units to the database without saving the template.

  • Close (CTRL + F4): Closes a script unit.

    Note: The options Save, Save As, Save to Repository and Close are only available for Unit scripting windows and are therefore disabled for the Main scripting window.

  • Select All (CTRL + A): Selects all text in the script.

  • Undo (CTRL + Z): Undoes the latest change.

  • Redo (CTRL + Y): Redoes the latest undo action.

  • Copy (CTRL + C): Copies selected text in the script.

  • Cut (CTRL + X): Cuts selected text in the script.

  • Paste (CTRL + V): Pastes content from the clipboard.

  • Toggle Bookmarks: Adds and remove a bookmark in the script at the line where the cursor is by toggling bookmarks on and off.

  • Goto Bookmarks: Makes the cursor jump to a bookmark.

  • Find... (CTRL + F): Searches for a text string.

  • Replace: Searches for a text string and replace it by another string.

  • Use script unit..: Makes the main script use a script unit. A string of the form: ‘USEUNIT <myscript>, in the main script shows that a unit is used. The script units are saved back to the repository when a template is saved and the local copies are updated every time the program is started. Script units are often created to be generic and reusable.

  • Refresh Scripts: Loads updated script units from the database.

Script Editor Toolbar

images/download/attachments/68857402/twgeneral_scripteditor_toolbar.png

  • Open Script Unit: Opens a script file in a separate tab. See also Reopen used script units.

  • Predefined Functions: Shows the predefined functions and variables that are available, together with a brief description. Use the Add button to add the selected function to the script.

    images/download/attachments/68857402/twgeneral_scripteditor_predefined_functions.png

  • Show Library Scripts: Displays available Script Units that are not already in use as script units in the currently open script.

    Note: Scripts added to a local folder that are to be in permanent use should be added to the database repository, see Save script units to the repository.

  • Syntax Check: This button checks the syntax of the scripts and reports errors. Errors are shown below the script pane.

  • Save to Repository (CTRL + R): Saves edited script units to the database repository. For details, see Save script units to the repository.

  • Close Unit (CTRL + F4): Closes the selected script unit. See also how to Reopen used script units.

  • Change Font: Change the font type and font size for the script editor.

  • Drop-list: The drop-list displays all functions and procedures that are declared in the script. Select an item from the list to jump to the point in the script where that function or procedure starts.

Script Units

All script units are stored on the database. When Template Wizard is started, all script units from the database repository are downloaded to a local folder.

  • %PROGRAMDATA%\Vizrt\Viz Pilot x.y\Scripts
    New script units can be saved to the database when the template is saved. If the script unit is updated and already exists in the database, a dialog with three options appears asking if the database script unit should be updated with the local copy. The three options are:

  • Yes: Saves the template, and updates the script units on the database.

  • No: Saves the template, but does not update the script units on the database.

  • Cancel: Cancels all save operations for the template and script units.
    Script units that are saved back to the repository when a template is saved updates the local script unit copies every time the program is started.

Inserting a Local Script into the Main Script

images/download/attachments/68857402/twgeneral_useunitdeclaration.png

  1. Place the marker in the current script where the contents of the new script are to be placed.

  2. Right-click the script unit and on the Context Menu select Insert from File ... .

  3. In the Open dialog box, select the script and click Open.

Using a Script Unit from the Repository

  1. Click the Show library scripts button to open the Use Unit dialog box.

  2. Search for and select the script unit to add, and click OK.

    • A new tab will open in the Script Editor, showing the script unit.

    • A string of the form ‘USEUNIT <myscript> will be added into the main script to indicate that the selected script unit is being used.

      Tip: To stop using a script unit, delete the relevant ‘USEUNIT comment from the main script.

Reopening Used Script Units

By default, a template with script units will not display the script unit tabs if the template is closed and later reopened. To reopen used script units do either of the following:

  1. Place the marker in front of the ‘USEUNIT <myscript> tag and press CTRL + ENTER.

    Or:

  1. Right-click the script unit and on the Context Menu that appears, select Open ... .

  2. In the Open dialog box, select the used script unit and click Open.

Saving Script Units to the Repository

images/download/attachments/68857402/twgeneral_save_script_to_repos_r.png

  1. Open the Script Editor.

  2. Right-click the editor, and on the Context Menu select New Edit Window.

  3. Write/Add the script to save to the repository.

  4. Click the Save button (CTRL + R).

  5. In the Save As dialog box enter the File name and click Save.

Tip: Create and save a test script and delete it from the local Script Units folder. Restart Template Wizard to test that the script has been uploaded correctly.

Retrieving Script Units From the Database

This procedure can be used to download new or updated scripts while Template Wizard is running (for example, on other clients).

  • On the File menu, select Refresh Scripts.

Resolving Conflicts Between Local and Repository Script Units

images/download/attachments/68857402/twgeneral_repositoryconfict.png

When new files are uploaded to the client, there might be cases where repository files are different from local files. To handle situations like these, a user can do one of two things:

  • Overwrite the local file with the repository file,
    or

  • Rename the local file and then overwrite.
    It is also possible to use a file comparison tool (diff tool) to compare the file in the repository with your local file. When specifying which tool to use, add the entry diff_tool in the ContentPilot.ini file. The diff_tool entry must also be followed by the path to the tool itself.

Example: diff_tool=C:\ProgramFiles\Araxis\Araxis Merge 2001 v6.0 Professional\Merge.exe

Exporting a Template That Uses Script Units

To export a template that uses script units, use the export/import functionality in Template Wizard, see Export and Import in Template Wizard.

Save Template to File can be used to save templates, but it does not save the included Script Units. If using Save to File, the script unit files must be copied separately.

Live Update

IMPORTANT! Live Update has been superseded by Update Services. If you need to use Live Update, you must also use the Legacy Playlist.

Live Update can be used to update data by adding the OnLiveUpdate function to the Script Editor. This function is called at regular intervals when the template is on air after being run from the playlist in Director. The function can be used to continuously update the scene with new data (for example stock quotes).

Using the OnLiveUpdate function requires that the template is saved (see Save Template) with the Live Update check-box checked.

Note: The update intervals are set in the ContentPilot.ini file.

It's also possible to do live updates using the OnActionEvent function, however, this function is not called at regular intervals, only when specific actions are performed in Director (for example Start, Continue etc.).

The Live Update mechanism relies on Director executing the scripts. Director must therefore be up and running at all times when there are Live Update templates in the playlist.

For other control applications such as Viz Trio this is not an optimal workflow. The Update Script mechanism is therefore recommended since it works on the Media Sequencer alone, and is therefore available to all products connected to the Media Sequencer. See Update Script Editor.

Caution: Having a Director up and running at all times when there are numerous Live Update templates in the playlist will cause Director to load all templates in the background. This will consequently use a lot of memory.

Viz Trio Template

It is possible to create templates that can be used in Viz Trio. The following example and procedure explain how to create a custom user interface for Viz Trio. Note that the Script Example uses specific Viz Trio macro commands. Template Wizard is unable to fully test Viz Trio templates. A Viz Trio client is therefore required.

Script Example

The OnClick event (defined as Button1Click) triggers the macro command TrioCmd with the parameters to read, set a value, and take page 1000 on air.

Sub Button1Click(Sender)
TrioCmd("page:read 1000")
TrioCmd("page:set_property 01 ") & yourvalue
TrioCmd("page:take")
End Sub

For more information on macro commands, see the Viz Trio User Guide.

Creating a Template for Viz Trio

  1. Choose File and New to create a blank template.

  2. Add components and define script events as required (see Script Example).

  3. Add Viz Trio macros to the code that will be triggered by the events.

  4. Save the template to a file, and copy it to the Viz Trio client machine’s vtwtemplates directory or shared directory.

  5. Start the Viz Trio client and set the template to active in the Show Settings.