Skip to main content
JapinderSandhu
Inspiring
July 25, 2020
Answered

get specific sequence with qe dom, extendscript

  • July 25, 2020
  • 2 replies
  • 5853 views

Is there a way to get a specific sequence with the qe dom rather than just the active sequence? 

app.enableQE();
var seq = qe.project.getActiveSequence();
Then you will have access to: addTracks()

the problem here is im not trying to get the active sequence
 
I am trying to get sequence by a specific ID
 
This fails:

 

	for (var i = 0; i < qe.project.sequences.numSequences; i++) {
			var seq = qe.project.sequences[i];
			if (seq.sequenceID === newSeqID){
				var newSeq = seq;
			} 
		}



This works:

	for (var i = 0; i < app.project.sequences.numSequences; i++) {
			var seq = app.project.sequences[i];
			if (seq.sequenceID === newSeqID){
				var newSeq = seq;
			} 
		}​



my goal is to get the sequence using qeDOM so I can addTracks specified here:

https://community.adobe.com/t5/premiere-pro/add-a-track-in-a-sequence-extendscript/m-p/11313647?page=2#M285122


I made a seperate post here just in case some one else had the same question they can find it easier let me know if I should take it down 🙂 


This topic has been closed for replies.
Correct answer Bruce Bullis

Strange, works here. Perhaps it's something specific to that project.

2 replies

JapinderSandhu
Inspiring
July 28, 2020

Thanks so much for the response! I am truly grateful. 

I create a new sequence using :

qe.project.newSequence(seqName, presetPath);
my goal is to retreive the newly created qe dom sequence object.
 
I tried :

var newSeq = qe.project.newSequence(seqName, presetPath);
 
but newSeq returns true boolean not the actual sequence object 
 
so I thought I could perhaps retreive the sequence based on the seqName string? 

Is there any better way I feel like I am close but I cant figure it out 

 

		app.enableQE();

		var seqName = 'test_sequence_new';

		// qe dom to add new sequence with pre-defined preset 
		qe.project.newSequence(seqName, presetPath);

		
		var originalSeq = $._PPP_.getSequenceByID(originalSeqID);

		// get new qe dom sequence by name 
		for (var i = 0; i < qe.project.numSequences; i++) {
			var seq = qe.project.getSequenceAt(i);
			if (seq.name === seqName){
				var newSeq = seq;
			} 
		}

 





Bruce Bullis
Community Manager
Community Manager
July 28, 2020

Again, QE DOM will remain officially unsupported...

 

I suspect that your new sequence will be the last sequence;  qe.project.numSequences - 1.

JapinderSandhu
Inspiring
July 29, 2020

You sir are brilliant. 

One note - when I do

var seq = qe.project.getSequenceAt(qe.project.numSequences - 1);

 

I get evalscript Error 


when I do

 

var seq = qe.project.getSequenceAt(qe.project.numSequences - 2);

 

it returns the latest created sequence successfully. 

Is there an alternative way other than QE DOM to add tracks to a newly created sequence? Since QE DOM is unsupported?

I use  
qe.project.newSequence(seqName, presetPath); 

to create a new sequence, an alternative of using  
seq.addTracks(0), I was thinking of changing the actual PProPanel.sqpreset file that I use in presetPath parameter. 

 

Using the preset file it creates 3 video tracks, but I may need a variable  N number of video tracks. 


in PProPanel.sqpreset I noticed 

<VideoTracks>[]</VideoTracks>
 
so I tried to do : 

<VideoTracks>[10]</VideoTracks>
 
but this gave evalScriptError. 

Any other way to add tracks using PProPanel.sqpreset? 

this is what my file looks like:
 
 
I followed this guide for the createSequenceFromPreset function:
https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx
 
Reference to adding tracks:
 
 
 
 

 




Bruce Bullis
Community Manager
Community Manager
July 27, 2020

QE DOM remains, officially, unsupported.

I think you may have better luck trying to find a QE DOM sequence based on its .guid member...

 

app.enableQE();
var newSeq = qe.project.getActiveSequence();
var newSeqID = newSeq.guid;

for (var i = 0; i < qe.project.numSequences; i++) {
	var seq = qe.project.getSequenceAt(i);
	if (seq.guid === newSeqID){
		var newSeq = seq;
	} 
}​
New Participant
June 10, 2021

I just stumbled over the same problem. 

 

It seem that qe holds the sequences per bin and adjusts the numSequences count accordingly.

 

Except for the root bin/project item.

 

From what I am seeing numSequences instead holds the total count of the whole hierarchy there while every sub bin only shows the number of sequences on its own level and does not total the sub levels (which would be the correct way, given how getSequenceAt() is implemented.

 

For the following heirachy this leads to having a numSequences of 4 for qe.project, but qe.project.getSequenceAt(1) failing, since it only can access the one at index 0:

project (root bin) (numSequences=4, only one sequence accessible via getSequenceAt() despite numSequences=4)

seq1 
> bin1 (numSequences=1)
  > seq2
  > bin1_2  (numSequences=2)
    > seq3
    > seq4

 

So your example above should fail when any sequences are sorted into bins.

 

The only way I see how one could walk over all sequences is to first traverse all sub bins, count the found items and at the end ask the project bin for the remaining number of sequences.

 

Since that's bit cumbersome, it just looks like a bug in the implementation of numSequences vs getSequenceAt() on the root/project level. The count implementing a totaled perpesctive, while getSequenceAt() delivering a local one. Probably due to a mixup of the bin an project levels on that level in the QE DOM.

 

Can you confirm that this is a bug in the QE implementation?

Bruce Bullis
Community Manager
Community Manager
June 10, 2021

Can you confirm that this is a bug in the QE implementation?

That seems correct.