• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scripting - Dive into nested sequences

Participant ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

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

TOPICS
SDK

Views

1.5K

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

Community Expert , Apr 26, 2019 Apr 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 o

...

Votes

Translate

Translate
Community Expert ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

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;

    }

}

Votes

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 ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

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/ )?

Votes

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
Community Expert ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

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/

Votes

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 ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

Nice, it works good, thank you!

Now i have another issue that i don't know how to solve:

with this code, i loop through all project's sequence. Instead, what i need is to dive into the nested sequence that are present only in the target sequence (i.e. the activeSequence).

Example:

in the project there are 5 nested sequences and 1 as main sequence.

The main sequence contains only 2 nested sequences. I would like to dive into only these 2 sequences and not all 5

Actually i'm using this code:

numberElements = app.project.rootItem.children.numItems;

Elements = app.project.rootItem.children;

but with this code, i get the value of the entire project. How to solve?

Again, thank you

Votes

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
Community Expert ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

You already have a loop to loop through all video tracks yea? Then when you're going through each clip chec if it's projectItem is a sequence with:

clip.projectItem.isSequence()

When you come across a sequence, then get the sequence with the method we discussed above. Does that answer your question?

Votes

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Hi, all works fine now, thank you!

Probably i will come back for other difficulties with my little script

Votes

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

And as i promised, i'm back

Now i have an array with media that i would like to copy in another folder on hard drive. Is possible throught scripting to copy files on disk (windows or mac)?

Thanks!

Votes

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
Community Expert ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Yes this is, why don’t you make a new question for this as the topic is not related to this thread. Thanks!

Votes

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

LATEST

Done

Votes

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