Skip to main content
Inspiring
April 26, 2019
Answered

Scripting - Dive into nested sequences

  • April 26, 2019
  • 1 reply
  • 2025 views

Hi guys, i have a problem with scripting.

I want to check some property of the clips in my active sequence and the relative nested sequences.

I know how i can loop trought the clips and property in the active sequence, but i don't know how to enter in the nested sequence and make some check and operations.

I don't know the right syntax, can you help me?

Thank you

This topic has been closed for replies.
Correct answer Justin Taylor-Hyper Brew

That would be because I made a typo, it's numSequences not numItems with Sequence Collections. Here's the updated:

function sequenceById(id) { 

    var sequences = app.project.sequences; 

    var len = sequences.numSequences; 

    for (var i = 0; i < len; i++) { 

        var sequence = sequences

        if (sequence.projectItem.nodeId === id) 

            return sequence; 

    } 

// Example Usage

var active = app.project.activeSequence.projectItem.nodeId;

sequenceById(active);

There's not an object model, but there are docs: http://ppro.aenhancers.com/

1 reply

Justin Taylor-Hyper Brew
Community Expert
Community Expert
April 26, 2019

Thought there was an easy method for getting a sequence from a projectItem, but I'm not seeing one. My approach would be to get the nodeId of the track item that you want to dive into, and then run it through a function like this to get that sequence:

function sequenceById(id) {

    var sequences = app.project.sequences;

    var len = sequences.numItems;

    for (var i = 0; i < len; i++) {

        var sequence = sequences;

        if (sequence.nodeId === id)

            return sequence;

    }

}

Cad81Author
Inspiring
April 26, 2019

Hi, thank you.

I have a project with 2 sequences.

I tryied to use your code, but when  i use an alert to show the "len" var, it says "undefined".

Any idea?

Thank you!

ps: is there an object model (like after effect) for premiere (like this http://docs.aenhancers.com/introduction/objectmodel/ )?

Justin Taylor-Hyper Brew
Community Expert
Community Expert
April 26, 2019

That would be because I made a typo, it's numSequences not numItems with Sequence Collections. Here's the updated:

function sequenceById(id) { 

    var sequences = app.project.sequences; 

    var len = sequences.numSequences; 

    for (var i = 0; i < len; i++) { 

        var sequence = sequences

        if (sequence.projectItem.nodeId === id) 

            return sequence; 

    } 

// Example Usage

var active = app.project.activeSequence.projectItem.nodeId;

sequenceById(active);

There's not an object model, but there are docs: http://ppro.aenhancers.com/