Band, Track, Chain, Checkpoint, and Script Objects

Document created by DPM Admin Employee on Jul 21, 2017Last modified by Trishala Kalal on Aug 14, 2017
Version 2Show Document
  • View in full screen mode

These objects represent Band, Track, Target, Chain, Checkpoint, Delay, or Script objects, respectively, in the Composition.

 

Band, Track, Chain, Checkpoint, and Script Properties

All of the following Band, Track, Target, Chain, Checkpoint, and Script properties are read-only.

  • name (string)

The name of this item. An item’s name can be changed by setting this property, with the following restrictions:

  • The name can only be changed before any activity has occurred for the given item. The item cannot have started playing yet, cannot have started repeating yet, and no other actions for it can have occurred yet (e.g. no other properties of it can have been set).
  • The name specified by the script must, of course, be a legal item name (255 chars max, no square brackets or slashes), and must not be the same name as another item in the same container.
  • parent (object)

The parent object of this item.

  • propertyList (object)

A PropertyList object that allows access to all of the Custom Properties contained in this object.

  • systempropertyList (read only – object)

A SystemPropertyList object that allows access to all of the System Properties contained in this object.

  • type (string)

A string that indicates the type of this object.

  • children (array of objects)

An array of objects representing the children of this object, if any.  Null if the object has no children.

  • index (read only – integer)

Returns the position (zero-based index) of this item’s parent’s array of children.

  • nextItem (read only – object)

Returns the next item after this one in this item’s parent’s array of children, or null if this is the last item.  In other words, returns the next sibling in the object hierarchy.  Equivalent to:
item.parent.children(item.index + 1)
where "item" is the current item.

  • previousItem (read only – object)

Returns the previous item before this one in this item’s parent’s array of children, or null of this is the first item.  In other words, returns the next sibling in the object hierarchy.  Equivalent to:
item.parent.children(item.index - 1)
where "item" is the current item.

  • forEachValue (read only – string, number, date/time, or null)

If this item is repeating due to a “for-each” repeat, this property contains the for-each value associated with this instance of the object.  This will be a value in the array used for the for-each.

If this item is not repeating due to a “for-each” repeat, this property will be null.

  • repeatIndex (read only – integer)

An integer value that represents the “repeat index” of this item if it repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if the current item does not repeat or has a repeat count of one (in other words, it is -1 if it doesn’t actually repeat).

  • playNumber (read only – integer)

An integer value that represents the “play ordinal number” of this item.  Starting with the number 0, each play is assigned a unique number.  The numbers are contiguous (no gaps).

Play number sequences are maintained within the item’s parent only.  For example, if a parent item repeats, then the child items inside each repeat of the parent will have their own play number sequence starting at 0.

An item will only have a non-zero play number if it repeats.  The play number is equivalent to the repeat index, except that the play number is 0 for items that don’t repeat or have a repeat count of one, whereas the repeat index would be -1 in those cases.

Always 0 for Targets and Checkpoints.

  • playNumberBeforeRenewal (read only – integer)

If this item repeats in parallel with the “Renew parallel repeats” option enabled, this is an integer value that is the “playNumber” value of the original parallel repeat for this item if it has been renewed because a prior parallel repeat ended. If this is the original parallel repeat, the value of playNumberBeforeRenewal will be equal to the value of playNumber. If this item does not repeat in parallel, the value will be zero.

For example, if parallel repeat number 5 of the item ends, but the Renew parallel repeats checkbox is enabled, the ending repeat will be replaced with a new, replacement repeat. The new repeat will have new repeatIndex and playNumber values (according to how many other repeats have already occurred). However, the playNumberBeforeRenewal value will still be 5 in this example.

This property is always 0 for Composition, Checkpoint, Delay, and Target.

  • REPEAT_TIMING_PARALLEL (read only – int)

 

A constant that can be passed in calls to the "setRepeat" method.  (See the description of the "setRepeat" method.)

  • REPEAT_TIMING_SERIAL (read only – int)

 

A constant that can be passed in calls to the "setRepeat" method.  (See the description of the "setRepeat" method.)

  • REPEAT_TYPE_COUNT_CONSTANT (read only – int)

 

A constant that can be passed in calls to the "setRepeat" method.  (See the description of the "setRepeat" method.)

  • REPEAT_DISTRIBUTION_CONSTANT (read only – int)

A constant that can be passed in calls to the "setRepeat" method.  (See the description of the "setRepeat" method.)

 

Target Only Cookie Property

  • cookies (readable and settable – array of “structs” (objects with properties))

This contains the current list of cookies being maintained. This list changes as responses are received that contain cookies.

The value is null if there are currently no cookies being maintained.

There is a single list of cookies maintained across all Targets within the same instance of the same Clip. Thus the value for this property will be the same for all Targets in the same instance of the same Clip, and setting this property affects the Clip’s cookie processing across all Targets within the Clip.

This property can be set to replace the entire list of cookies. This can be done by modifying the existing list, or by creating an entirely new list.

The value of the property is an array of Objects. Each object in the array has the following property values:
• “name” (String) – the name of the cookie.
• “domain” (String) – the domain name of the cookie.
• “path” (String) – the cookie’s path.
• “value” (String) – the value of the cookie.
• “expirationDate” (Date object) – the expiration date of the cookie (null if none).
• “secure” (Boolean) – true if it is a secure cookie.

 
Here is an example Script that retrieves the current cookie values and displays them in the Result:

var cookies = $context.currentClip.targets[0].cookies;
if (cookies == null)
{
$context.result.postMessage($context.result.LEVEL_INFO, "No cookies.");
}
else
{
var text = "";
for each (var cookie in cookies))
{
text += "name=" + cookie.name + ", ";
text += "domain=" + cookie.domain + ", ";
text += "path=" + cookie.path + ", ";
text += "value=" + cookie.value + ", ";
text += "expirationDate=" + cookie.expirationDate + ", ";
text += "secure=" + cookie.secure + "\n";
}


$context.result.postMessage($context.result.LEVEL_INFO, cookies.length + " cookies.", text);
}

Here is an example Script that replaces the entire current cookie list with a new list that contains two cookies named “MyCookie1” and “MyCookie2”:

var newList = new Array();
var cookie = new Object();
cookie.name = "MyCookie1";
cookie.domain = "myhostname";
cookie.path = "/some/path";
cookie.value = "Value of MyCookie1";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;
newList[0] = cookie;

cookie = new Object();
cookie.name = "MyCookie2";
cookie.domain = "myhostname";
cookie.path = "/some/path";
cookie.value = "Value of MyCookie2";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;
newList[1] = cookie;
$context.currentClip.targets[0].cookies = newList;

Here is an example Script that finds the current cookie named “ChocolateChip” and changes it’s value to “42”:

var list = $context.currentClip.targets[0].cookies;
if (list != null)

{
 for each (var cookie in list)
{
  if (cookie.name == "ChocolateChip")
{
cookie.value = "42";
$context.result.postMessage($context.result.LEVEL_INFO, "Cookie value replaced.");
break;
  }
 }
}

$context.currentClip.targets[0].cookies = list;

Here is an example Script that adds a new cookie named “ChocolateChip” to the current cookie list:

var list = $context.currentClip.targets[0].cookies;

if (list == null)
list = new Array();

var cookie = new Object();
cookie.name = "ChocolateChip";
cookie.domain = "myhostname";
cookie.path = "/my/path";
cookie.value = "Cookie value";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;

 list[list.length] = cookie;

 >$context.currentClip.targets[0].cookies = list;

Band, Track, Chain, Checkpoint, and Script Methods

getChild Method

Returns a specific child object by name, or null if there is no child with the specified name.

 

 

object getChild(string childName)

getItemViaPath

Given a type of item and the path to that item in the Composition object hierarchy, returns the object in the hierarchy that represents that item.


object getItemViaPath(string itemType, string path)

The "itemType" parameter value indicates the type of item (not case sensitive):

  • "Composition"
  • "Band"
  • "Track"
  • "Clip"
  • "Chain"
  • "Message"
  • "Browser Action"
  • "Delay"
  • "Checkpoint"
  • "Target"

The "path" parameter contains a path as specified for In Situ Substitution Specifications. The path can be relative to the current item (for example to specify another item in the same Clip, the Band, Track and Clip portions of the path can be omitted).

 

clearRepeat Method

Removes any current repeating specification from this item (so that it will play exactly once).


void clearRepeat()

setRepeat Method

Sets a new repeating specification for this item.

The "timingType" parameter indicates which type of repeat timing is to be used.  It must be one of the following values:

  • REPEAT_TIMING_PARALLEL
  • REPEAT_TIMING_SERIAL
  • The "repeatType" parameter indicates what sort of value is contained in the "control" parameter.  Currently the "repeatType" parameter must always be set to "REPEAT_TYPE_COUNT_CONSTANT".
  • The "control" parameter is the count of the number of repeats to be performed.  If the value is less than or equal to zero, the item will not be played at all.
  • The "distributionType" parameter indicates what sort of value is contained in the "distribution" parameter.  Currently the "distributionType" parameter must always be set to "REPEAT_DISTRIBUTION_CONSTANT".
  • The "distribution" parameter is a time length, in milliseconds, by which the start of each repeat is to be offset from the start of the prior repeat.  This value only applies to parallel repeats, and must be set to zero for serial repeats.

void setRepeat(int timingType, intRepeat Type, long control, int distributionType, long distribution)

end Method

Requests that play be terminated. If an optional error text string is provided, the Track will be considered to have ended in error. If not currently playing, no action is taken.

Note that this is not an “abort” – play will be ended after any currently playing item(s) in the complete.

This method doesn't apply to checkpoint.

void end(String optionalErrorText)

endRepeat Method

Requests that repeating for this item be ended.  If this itemp is not currently playing, no action is taken.

Note that this is not an “abort” – repeating will be ended after any currently playing individual repeat completes.

This method is permitted for serial repeating only, it is not supported for parallel repeating and an error will be generated if it is attempted to call this method for a parallel repeat.

This method doesn't apply to checkpoint.

void endRepeat()

Target-Only Method

 

signURL Method

string signURL(string url)

This method “Signs” a URL according to the OAuth (“Open Authorization”) protocol.

The “url” parameter is a complete HTTP URL.  The return value is a modified version of the URL, “signed” according to OAuth.

The information needed to perform the signing operation is taken from the following System Property values of the Target:

 

  • “oauth_consumer_key”
  • “oauth_consumer_secret”
  • “oauth_token”
  • “oauth_token_secret”
  • “oauth_signature_method”
 

Attachments

    Outcomes