Copy link to clipboard
Copied
I'm trying to reference an already existing sequence by name. I've found a way round it by looping through the project untill a name matches:
for (var d=0; d<proj.rootItem.children.numItems; d++){
var ditem = proj.rootItem.children[d];
var dname = ditem.name;
if (dname == "MySequence" && ditem.isSequence()) {
var MySeq = ditem;
}
}
However, it doesn't interpret the object as a sequence, this code outputs MySequence = [object Sequence]:
alert(MySeq.name + " = " + MySeq);
Whereas this outputs MySequence = [object ProjectItem]
alert(tempseq.name + " = " + app.project.activeSequence);
Any clues how to firce it to interpret MySeq as a Sequence?
It doesnt interpret it as an object sequence, because it is an object projectItem (you iterate through project items). Project item could be a clip, a bin or a sequence.
To speed up the process you can iterate through:
app.project.sequences // it is a collection of all sequences in project
Also, if you are matching one sequence to another I would use sequenceID to get proper sequence, instead of a name (there could be duplicates).
Copy link to clipboard
Copied
Sorry, I got muddled with alerts ther - [object Sequence] and [object ProjectItem] other way round
(I cannot edit this post for some bizarre reason)
Copy link to clipboard
Copied
It doesnt interpret it as an object sequence, because it is an object projectItem (you iterate through project items). Project item could be a clip, a bin or a sequence.
To speed up the process you can iterate through:
app.project.sequences // it is a collection of all sequences in project
Also, if you are matching one sequence to another I would use sequenceID to get proper sequence, instead of a name (there could be duplicates).