Viz Pilot User Guide

Version 8.1 | Published August 16, 2017 ©

Import Components

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

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

This section contains the following topics:

  • Story Importer Component

  • Direct Story Importer Component

Story Importer Component

images/download/attachments/30114770/twcomponents_iconstoryimporter.png
A template using the TStoryImporter can either be 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

  • XML example

  • Script Example

  • To create a macro using External IDs in Director

  • To create data elements based on External IDs

  • To use a script to control the filling of data in the template

External ID

images/download/attachments/30114770/twcomponents_templatemanager_externalid.png

When a template is created, it is saved and typically added to a concept. In Template Manager the template can be given an external ID (see Variants) for use with the 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 To 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, the 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 system(s), 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> <templateID>100</templateID>
<dataName>Data Element 001</dataName>
<comment/>
<data>
<field>FirstName LastName 001</field>
<field>Designation 001</field>
</data>
</event>
<event>
<templateID>100</templateID>
<dataName>Data Element 002</dataName>
<comment/>
<data>
<field>FirstName LastName 002</field>
<field>Designation 002</field>
</data>
</event>
<event>
<templateID>100</templateID>
<dataName>Data Element 003</dataName>
<comment/>
<data>
<field>FirstName LastName 003</field>
<field>Designation 001</field>
</data>
</event>
</group>
</playlist>

Script Example

images/download/attachments/30114770/twcomponents_storyimporter_script.png
The component triggers its OnStoryData event to start filling the template with Data.

Sub StoryImporter1StoryData(Sender, Data)
if Data.Count > 0 then
TTWUniEdit1.Text = Data.Strings(0)
TTWUniMemo1.UTF8Text = Data.Strings(1)
TTWUniMemo2.UTF8Text = Data.Strings(2)
end if
End sub

To create 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/30114770/twcomponents_contentpilot_macro_02.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.

To create data elements based on External IDs

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

  2. Enter the information needed.

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

  4. Add the data elements to the playlist.

To use a script to control the filling of data in the template

images/download/attachments/30114770/twcomponents_storyimporter_script2.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

  3. Add the following script:

    Sub StoryImporter1StoryData(Sender, Data)
    if Data.Count > 0 then
    TTWUniEdit1.Text = Data.Strings(0)
    TTWUniMemo1.UTF8Text = Data.Strings(1)
    TTWUniMemo2.UTF8Text = Data.Strings(2)
    end if
    End sub
  4. Select the TStoryImporter component in the template and set the OnStoryData value to the name of the script

Direct Story Importer Component

images/download/attachments/30114770/twcomponents_icontdirectstoryimporter.png

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 the previous section on Story Importer Component.

Notable Properties

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

To use 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/30114770/twcomponents_story_actions_property.png

  3. Link edit fields to index values such that they correspond with the sequence of data coming from the external system.

    images/download/attachments/30114770/twcomponents_story_actions_editor.png

  4. Click OK.

  5. Save the template.