Seed Data from URL

The script below randomly selects one of the lines from this list and puts that value into a clip property named “DataListValue”.

var dataList = $util.readFromURL("http://www.myhost.com/directory/file.csv");

var a = dataList[Math.floor(dataList.length * (Math.random()))];

// To iterate through the list (instead of random), use these options:
// var a = dataList[$util.currentClipIndex]; (different users in a track)
// var a = dataList[$util.currentTrackIndex]; (each track gets a different user)

$prop.set("MessageClip", "DataListValue", a);
$util.result.postMessage($util.result.LEVEL_INFO, "Data List Value: " + a);
$util.result.postMessage($util.result.LEVEL_INFO, "Data List Length: " + dataList.length);