Get sequence by name

Community Beginner ,
Jul 13, 2022 Jul 13, 2022

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? 

TOPICS
SDK

Views

57

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jul 13, 2022 Jul 13, 2022
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 projectAlso, if you are matching one sequence to another I would use sequenceID to get proper sequence, instead of a name (there could be duplicates). 

Likes

Translate

Translate
Community Beginner ,
Jul 13, 2022 Jul 13, 2022

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)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

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). 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines