Find Out How

Print Friendly Version

Pre-Defined JavaScript Variables

Context  ($context )

Contains the object model that represents the Composition.

Context Properties

All of the following Context properties are read only:

  • composition
  • The "Composition" object that represents the top of the Composition object model.

  • result
  • The "Result" object that represents the Result being produced for the currently playing Composition.

  • currentBand
  • A "Band" object that represents the current Band according to the context in which the current script is executing.  Null if there is no current Band.

  • currentItem
  • An object that represents the current Item according to the context in which the current script is executing.  Null if there is no current Item.

  • currentTrack
  • A "Track" object that represents the current Track according to the context in which the current script is executing.  Null if there is no current Track.

  • currentClip
  • A "Clip" object that represents the current Clip according to the context in which the current script is executing.  Null if there is no current Clip.

  • currentChain
  • A "Chain" object that represents the current Chain according to the context in which the current script is executing.  Null if there is no current Chain.

  • currentMessage
  • A "Message" object that represents the current Message according to the context in which the current script is executing.  Null if there is no current Message.

  • currentBrowserAction
  • A "BrowserAction" object that represents the current Browser Action according to the context in which the current script is executing.  Null if there is no current Browser Action.

  • currentCheckpoint
  • A "Checkpoint" object that represents the current Checkpoint according to the context in which the current script is executing.  Null if there is no current Checkpoint.

  • currentScript
  • A "Script" object that represents the current Script according to the context in which the current script is executing.  Null if there is no current Script.

  • currentTarget
  • A "Target" object that represents the current Target according to the context in which the current script is executing.  Null if there is no current Target.

  • currentDelay
  • A "Delay" object that represents the current Delay component according to the context in which the current script is executing.  Null if there is no current Delay component.

  • currentBandIndex
  • An integer value that represents the "repeat index" of the current Band if the current Band repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Band, or the current Band does not repeat.

  • currentTrackIndex
  • An integer value that represents the "repeat index" of the current Track if the current Track repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Track, or the current Track does not repeat.

  • currentClipIndex
  • An integer value that represents the "repeat index" of the current Clip if the current Clip repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Clip, or the current Clip does not repeat.

  • currentChainIndex
  • An integer value that represents the "repeat index" of the current Chain if the current Chain repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Chain, or the current Chain does not repeat.

  • currentMessageIndex
  • An integer value that represents the "repeat index" of the current Message if the current Message repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Message, or the current Message does not repeat.

  • currentBrowserActionIndex
  • An integer value that represents the "repeat index" of the current Browser Action if the current Browser Action repeats, according to the context in which the current script is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Browser Action, or the current Browser Action does not repeat.

  • currentScriptIndex
  • An integer value that represents the "repeat index" of the current Script component, if that current Script component repeats, according to the context in which it is executing.  The first repeat starts at index zero.  The value is -1 if there is no current Script, or the current Script does not repeat.

  • userName
  • The user ID of the user that started the current Composition playing.

  • locationName
  • The name of the location (from the Server List) on which the Composition is playing. If the Composition is playing on multiple Maestro servers, this will be the name of the location of the particular server that this Script is playing on.

  • serverName
  • The name of the server (from the Server List) on which the Composition is playing. If the Composition is playing on multiple Maestro servers, this will be the name of the particular server that this Script is playing on.

 

Context Object Methods

abortScript

Immediately aborts play of the current Script, and considers the Script to have failed with the given error text.  If no error text is provided, the text Script aborted. is used.


void abortScript(string errorText)

readFromURL

Reads data from a CSV file (resource) at the specified URL, and returns that data as an array of strings. Each element in the returned array represents a row in the file.  For any row that contains multiple values, the value for that row is a nested array of the values in that row.

Parameters:

  • The url parameter is the URL to read from.
  • The format parameter is optional, but if specified must be the string CSV, which is the only value currently supported.
  • The useCache parameter is optional.  If the value is true, the data that is read is cached in memory, so that subsequent reads from the same URL in the same play of the Composition will retrieve the data from memory rather than re-reading from the URL.  If the value is false, the data will be read from the URL on every call.  If this parameter is omitted or null, true is assumed.

Example

To read from a file at http://host/files/Locations.csv, the following call would be made:
var userList = $context.readFromURL(http://host/files/Locations.csv);

If the file contained the following lines:

San Francisco,CA,94103
Timbuktu
Caribou,Aroostook County,Maine,USA
Hill Valley,CA,91905


The following array of strings would be returned:


userList[0][0]

San Francisco

userList[0][1]

CA

userList[0][2]

94103

userList[1]

Timbuktu

userList[2][0]

Caribou

userList[2][1]

Aroostook County

userList[2][2]

Maine

userList[2][3]

USA

userList[3][0]

Hill Valley

userList[3][1]

CA

userList[3][2]

91905


Array readFromURL(string url, string format,
boolean useCache)