Viz Pilot User Guide

Version 8.2 | Published July 23, 2018 ©

Script Editor

images/download/attachments/28386080/twgeneral_enablescript_53.png

There are two ways of adding 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

  • Script Editor Toolbar

  • Script Units

  • Live Update

  • Viz Trio Template

Context Menu

images/download/attachments/28386080/twgeneral_scripteditorcontextmenu.png

The context menu of the Script Editor contains the following items:

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

  • Open: Opens a script file in a separate tab. See also how To 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 window(s) (i.e. they are 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): Search for a text string.

  • Replace: Search 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/28386080/twgeneral_scripteditor_toolbar.png

  • Open Script Unit: Opens a script file in a separate tab. See also how To 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/28386080/twgeneral_scripteditor_predefined_functions.png

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

    Note: If scripts that are added to a local folder will be permanently used, they should be added to the database repository, see To 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 To 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 lists 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 on the database, a dialog with three options appears, asking if the database script unit should be updated with the local copy. The following options are;

  • Yes: Saves the template, and updates the script unit(s) on the database.

  • No: Saves the template, but does not update the script unit(s) on the database.

  • Cancel: Cancels all save operations for the template and script unit(s).
    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.

This section contains the following topics:

  • To insert a local script into the main script

  • To use a script unit from the repository

  • To reopen used script units

  • To save script units to the repository

  • To retrieve script units from the database

  • To resolve conflicts between local and repository script units

  • To export a template that uses script units

To insert a local script into the main script

images/download/attachments/28386080/twgeneral_useunitdeclaration.png Sc

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

  2. Right-click the .Script Editor vBase and on the Context Menu select Insert from File ... .

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

To use 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.

To reopen used script units

A template with script units will not by default 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 the CTRL+ENTER keys on the keyboard.
    Or:

  1. Right-click the .Script Editor vBase and on the Context Menu that appears, select Open ... .

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

To save script units to the repository

images/download/attachments/28386080/twgeneral_save_script_to_repos_r.png

  1. Open the .Script Editor vBase.

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

  3. Write/Add the script that will be saved 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 is uploaded correctly.

To retrieve script units from the database

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

  • On the File menu, select Refresh Scripts.

To resolve conflicts between local and repository script units

images/download/attachments/28386080/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:

  1. Overwrite the local file with the repository file, or

  2. 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 should also be followed by the path to the tool itself.

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

To export 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 (e.g. stock quotes).

Using the OnLiveUpdate function requires that the template is Save Templated with the Live Update check-box checked.

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

It is also possible to do “live updates” using the OnActionEvent function, however, this function is not called at regular intervals, but when specific actions are performed in Director (e.g. Start, Continue etc.).

The Live Update mechanism relies on Director executing the scripts. This means that you will have to have a Director 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; hence, the Update Script mechanism is recommended as it works on the Media Sequencer alone, and is therefore available to all products connecting 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 and consequently use a lot of memory.

Viz Trio Template

It is possible to create templates that can be used in Viz Trio. This following example and procedure explains what to in order 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; hence, a Viz Trio client is needed.

Script Example

The OnClick event (i.e. 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’s Guide.

To create a template for Viz Trio

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

  2. Add components and define script events as needed (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.