Story Importer Component

graphics/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 information on the following topics:

External ID
graphics/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
graphics/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.

    graphics/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
graphics/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