Viz Pilot User Guide

Version 8.7 | Published September 25, 2023 ©

Import Components

Import components are used when importing playlists from newsroom systems and when creating macros to automatically fill templates. Imports can be executed manually or automatically with the use of scripts and macros.

It is good practice for scene designers to name the scene’s Field Identifiers using 01, 02, and 03 rather than 1,2,3,4 ... 11,12 and so on. Using 1,2,3,4 will cause data to be assigned to the wrong fields when using Import components since the Media Sequencer will place 11 and 12 before 2 and so on.

This section contains the following topics:

Story Importer Component

images/download/attachments/68857560/twcomponents_iconstoryimporter.png
Using TStoryImporter, a template can be either manually or automatically filled using a macro or by importing an external data source (XML).

When filling a template, a template is specified with an External ID and data is added to the template. The order in which the data is filled is defined by the order of the ControlObjectName property which refers to the Field Identifier set by the scene designer.

This section contains the following topics:

External ID

images/download/attachments/68857560/twcomponents_templatemanager_externalid.png

When created, a template is saved and typically added to a concept. In Template Manager, the template can be given an external ID (see Variants) for use with Import components.

This ID is then used when creating data elements by triggering macros in Director, adding playlists to Director manually from newsroom systems (see Create a macro using External IDs in Director). External IDs are also used with newsroom systems that create data elements based on *cg commands; however, Import component does not support this workflow.

XML Example

The XML example below contains the name of the playlist, a group and three elements with an External ID (templateID). The XML playlists are generated by newsroom systems, and manually imported by Director’s XML Filler.

<?xml version="1.0"?>
<playlist>
<name>Name of playlist</name>
<group visible="true" name="Group name">
<event createType="CreateDataElement">
<templateID>110</templateID>
<dataName>Data Element 001</dataName>
<comment/>
<data>
<field>🌟</field>
<field>آخر النهر</field>
<field>Star</field>
</data>
</event>
<event>
<templateID>110</templateID>
<dataName>Data Element 002</dataName>
<comment/>
<data>
<field>💫</field>
<field>Pleione</field>
<field>Binary star</field>
</data>
</event>
<event createType="CreateDataElement">
<templateID>110</templateID>
<dataName>Data Element 003</dataName>
<comment/>
<data>
<field>✨</field>
<field>Ταύρος</field>
<field>Constellation</field>
</data>
</event>
</group>
</playlist>

Script Example

images/download/attachments/68857560/StoryImporterTemplateScreenshot.png

The component triggers its OnStoryDataW event to start filling the template with Data.

Sub StoryImporter1StoryDataW(Sender, Data)
if Data.Count > 0 then
TWUniEdit1.Text = Data.Strings(0)
SetUnicodeValue TWUniMemo1, Data.Strings(1)
SetUnicodeValue TWUniMemo2, Data.Strings(2)
end if
End sub

Note: From Viz Pilot 8.2, OnStoryDataW should be used instead of the old OnStoryData event, as OnStoryDataW handles Unicode better.

Creating a Macro Using External IDs in Director

  1. Start Director.

  2. On the Options menu select Keyboard Configuration... .

  3. Select and right-click the macros category, and from the context menu select Add Macro... .

  4. Click Show Macros... to open the Predefined Functions window.

  5. Select the create_data_element function under templates.

    images/download/attachments/68857560/image2018-2-13_13-59-45.png



  6. Click the hyperlink named copy to clipboard, and click Close.

  7. In the New Macro Shortcut window select the VBScript tab, and paste the newly copied script into the script editor.

  8. Edit the script.

    dim dataID
    dataID = VcpCommand("templates:create_data_element 400
    MyNewElement Headline/Title/Designation")
    VcpCommand "templates:open_template -1 " & dataID

    Note: The number 400 represents the external ID added in Template Manager. MyNewElement is the name of the template, and Headline, Title and Designation are data that will be filled into the template by the template script.

  9. Select the Enter Key field, and press the key combination for the macro.

  10. Enter a Macro Name, and click OK.

Creating Data Elements Based On External IDs

  1. In Director press the newly assigned key combination to trigger the macro (see Script Example).

  2. Enter the information required.

  3. Click the Save button to save it as a data element.

  4. Add the data elements to the playlist.

Using a Script to Control Data Filling in the Template

images/download/attachments/68857560/StoryImporterTemplateScreenshot2.png

  1. In Template Wizard, open the Object Inspector and check the Enable script option to enable scripting (CTRL+F12).

  2. Add the TStoryImporter component to the template (select the Import category from the dropdown).

  3. Select the TStoryImporter component in the template. Click Events in the object inspector and double click the OnStoryDataW event.

  4. Set the body of the newly created event handler like this:

    Sub StoryImporter1StoryDataW(Sender, Data)
    if Data.Count > 0 then
    TWUniEdit1.Text = Data.Strings(0)
    SetUnicodeValue TWUniMemo1, Data.Strings(1)
    SetUnicodeValue TWUniMemo2, Data.Strings(2)
    end if
    End sub

Note: From Viz Pilot 8.2, OnStoryDataW should be used instead of the old OnStoryData event, as OnStoryDataW handles Unicode better.

Direct Story Importer Component


The TDirectStoryImporter component is used for fetching template data from external sources such as XML files. This is similar to the Story Importer Component; however, the Direct Story Importer component is different in that it has an editor for mapping template text fields to index IDs, and is therefore easier to use without scripting. If advanced scripting is needed, the Story Importer Component component is recommended.

To understand the logic and use of the component in Director, see Story Importer Component.

Notable Properties

  • StoryActions: Opens the Story Actions Editor for linking text fields to index values.

Using the TDirectStoryImporter Component

  1. Add the TDirectStoryImporter component from the Import component palette to the template.

  2. Click the ellipse (...) button to open the Story Actions Editor.

    images/download/attachments/68857560/twcomponents_story_actions_property.png
  3. Link edit fields to index values so that they correspond with the sequence of data coming from the external system.

    images/download/attachments/68857560/twcomponents_story_actions_editor.png
  4. Click OK.

  5. Save the template.