Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page describes how to use two advanced BrightAuthor features: custom autorun plugins and parser scripts. These instructions assume a certain level of familiarity with BrightScript. This is not a comprehensive guide to writing custom scripts for BrightAuthor; rather, it is meant to provide a general outline and best practices for writing those scripts.

...

Plugins allow you to add script extensions to a standard presentation autorun. Plugins have two primary benefits over custom autoruns: They can be easily inserted into multiple presentations, including newer and older versions of the same presentation; and they are not dependant dependent on a certain autorun or firmware version, greatly reducing the complexity involved in updating custom BrightScript deployments.

Note
titleNote

Custom plugins are only available BrightAuthor plugins can be added to presentations in BrightAuthor 3.7 or later.

To designate one or more custom plugins for a BrightAuthor presentation, navigate to File > Presentation Properties > Autorun. Click the Add Script Plugin button, give the plugin a name (which must be the same as the <plugin_name> described in the initialization function below), and click the Browse button to locate and select a .brs file to use as a plugin.

Plug-in scripts must include an initialization function in the form of <plugin_name>_Initialize(). This initialization function is passed three parameters:

  • msgPort as As Object
  • userVariables as As Object
  • o as As Object: This is the .bsp associative array from the autorun. It is required for the initialization function to return an associative array.

To process events, the plugin script must provide a ProcessEvent function () function that is a member of the associative array returned by the initialization function described above. The ProcessEvent() function is given passed a single event object. The function then returns a Boolean indicating whether or not the autorun should continue processing the event object: The function will return True if it handles the event and the standard autorun should not continue processing the event.

...

The following example code shows how to write a script that receives a Send Plugin Message Command from the autorun. This code listens for a message sent to the plugin named “Pizza” and then prints the message:

...

The following example code shows how to write a script that sends a message string to trigger a Plugin Message event.

Code Block
linenumberstrue
print "pizza_ProcessEvent - entry"
    print "type of m is ";type(m)
    print "type of event is ";type(event)

    if type(event) = "roTimer" then

        pluginMessageCmd = CreateObject("roAssociativeArray")
        pluginMessageCmd["EventType"] = "EVENT_PLUGIN_MESSAGE"
        pluginMessageCmd["PluginName"] = "Pizza"
        pluginMessageCmd["PluginMessage"] = "toppings"
        m.msgPort.PostMessage(pluginMessageCmd)
        return true

    endif

    return false

End Function

...

You can use a script to parse non-MRSS feeds and provide the data in a format that can be used by Media RSS Feed states in BrightAuthor. To designate a parser for an MRSS feed, navigate to File > Presentation Properties > Data Feeds in BrightAuthor.

...