Single-element data array, select unique values – second example

The incrementing is done based on track and clip indexes. This is necessary when each serial repeat of a clip needs a different element in the array.  This example is different because it substitutes in zeros (0) instead of aborting the composition.

var oStrings =
[
  "benroslhl3444deb1292",
  "fiskiahefp6637jae4621",
  "schhenhfzo1060gay2955",
  "wilsmas8511get6345",
  …
];

// Check for exceeding the maximum serial repeats of the Clip.
if ($context.currentClipIndex > 49)
{
  eval("throw \"Maximum serial repeats exceeded.\";");
}
else
{ 
  // choose element from array based on Track and Clip repeat
  // the extra 0 ? 0 stuff subs in a zero if the index comes back as undefined.
  var a = oStrings[($context.currentTrackIndex < 0 ? 0 : $context.currentTrackIndex) * 50 + ($context.currentClipIndex < 0 ? 0 : $context.currentClipIndex)];
 
  // set clip property to contents of ?a? ? the selected value
  $prop.set("MessageClip", "user", a);

  // show debug information in results
  $context.result.postMessage($context.result.LEVEL_INFO, "User: " + a);

}