processItem($context.currentClip); function processItem(parentItem) { // Minimum and maximum values for Delay durations (milliseconds). var minDelayTime = 24000; //default = 24000 var maxDelayTime = 32000; //default = 32000 if (parentItem == null) return; var children = parentItem.children; if (children == null) return; var child; var randomDelayTime; for (var i = 0; i < children.length; i++) { child = children[i]; if (child != null) { if (child.type == "Delay") { // Set random duration for any Delays. randomDelayTime = new String(minDelayTime + Math.max(Math.round(Math.random() * (maxDelayTime - minDelayTime)), 0)); child.systemPropertyList.setPropertyValue("Duration", randomDelayTime.split(".")[0]); } // This part is for future error processing. //else if (child.type == "Chain") //{ // // For all Chains whose names start with "FailureAction", set repeat count to zero. // if (child.name.indexOf("FailureAction") == 0) // child.setRepeat(child.REPEAT_TIMING_SERIAL, child.REPEAT_TYPE_COUNT_CONSTANT, 0, child.REPEAT_DISTRIBUTION_CONSTANT, 0); //} processItem(child); } } }