sequence.clone() not returning the sequence?
Hello,
The following script throws the error "undefined is not an object" in version 13.0:
var theSequence = app.project.activeSequence;
var newSequence = theSequence.clone();
newSequence.clone();
The documentation says that it should "return a Sequence if successful, 0 if not."
My workaround is to guess the new sequence name then search all sequences in the project for that name. Not really ideal, though it works for now.
var theSequence = app.project.activeSequence;
theSequence.clone();
var targetName = theSequence.name + " Copy"; //sets targetName to the expected name of the cloned Sequence
var newSequence = findSequence(targetName);
newSequence.clone();
function findSequence(seqName)
{
var targetSequence;
var allSequences = app.project.sequences;
var sequenceCount = allSequences.numSequences;
for(var i = 0; i < sequenceCount; i++)
{
if(allSequences.name == seqName)
{
targetSequence = allSequences;
i = sequenceCount;
}
}
return targetSequence;
}
Please let me know if I'm just using sequence.clone() (or javascript) incorrectly!
Thanks!