How do I cause the Messages, Browser Actions, or Scripts in a Test Clip to use different values when the Test Clip is used in different Test Compositions, or in different places in the same Test Composition?

Document created by DPM Admin on Jul 21, 2017Last modified by Avril Dsilva on Aug 14, 2017
Version 3Show Document
  • View in full screen mode

General methodologies

There are two ways in which a Test Clip that is used in more than one Test Composition, or in more than one location within the same Test Composition, can adjust its behavior according to the location in which it is playing:

  1. Use of Custom Properties (preferred)

    Your Test Clip, as well as the items in your Test Clip, can contain Custom Properties. These Custom Properties can be used to insert values into Messages and Browser Actions before they are played (how to do that is discussed in other questions). In addition, any Scripts in your Test Clip can check the values of those properties and change their behavior accordingly.

  2. Checking the location via Scripting (not recommended)

    Scripts in your Test Clip can programmatically check the name assigned to the instance of your Test Clip in the particular Track in which it resides, or the name of the containing Track or Test Composition, and change their behavior accordingly. This is not the preferred method, however, because if someone unaware of the scripts changes the name of the Test Composition, Track, or Test Clip instance, or makes a copy of the Test Composition under a different name, the logic could be inadvertently broken.
 

Method 1 - Use of Custom Properties (preferred)

Your Test Clip, as well as the items in your Test Clip, can contain Custom Properties. These Custom Properties can be used to insert values into Messages and Browser Actions before they are played. In addition, any Scripts in your Test Clip can check the values of those properties and change their behavior accordingly.

When a Test Clip is added to a Track in a Test Composition, you can specify what initial values are to be set for the Test Clip-level Custom Properties and for the System Properties of the Targets within the Test Clip. (This is somewhat akin to passing parameters to a subroutine.)

 

After the Test Clip has been placed onto a Track in the Composition Editor, follow these steps:

  1. Select the Test Clip instance.
  2. Click the "Properties" button in the lower left.
  3. Select the "Property Explorer" tab.
  4. Select the particular Test Clip in the list, if it is not already selected.
  5. Select the "Custom" tab.
  6. The list of Test Clip-level Custom Properties contained within the Test Clip will be shown. You can then enter the values that these properties are to be set to when this instance of the Test Clip is played.
  7. You can also select any of the Targets within the Test Clip in order to specify initial values for the Targets' properties.

Note that you cannot directly set the Custom Properties of other items inside the Test Clip (such as Messages or Browser Actions). However, a Script inside the Test Clip could copy the values from the Test Clip Custom Properties to other Custom Properties, if the other items were not using Test Clip Custom Properties.

See the question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..." for more information about how to use Custom Properties in Messages and Browser Actions.

Method 2 - Checking the location via Scripting (not recommended)

A Script can programmatically traverse the object hierarchy of the Test Composition in which it resides, and can determine things such as the names of the containing Track, Band, or Test Composition, or the instance name assigned to the containing Test Clip. See the Scripting documentation for more details.

The Script could then adjust its behavior based upon its determination of where it is being used. This would allow the Script to modify Messages or Browser Actions, or change the values of Custom Properties used by Messages or Browser actions, or change the values of System Properties. For more information on how a Script can modify Messages or Browser Actions or change the values of properties, see the Scripting documentation, as well as the answer to the question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..."

This methodology is not recommended, however, because if someone unaware of this changes the name of the Test Composition, Track, or Test Clip instance, or makes a copy of the Test Composition under a different name, the logic could be inadvertently broken.

 

Attachments

    Outcomes