Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

ExtendScript - sort project folder by name

$
0
0

Hello,

 

I have some code that heavily relies on project folder being sorted by name - I just grab files from a project folder and add them to the comp timeline in the order that they are listed:

 

// add audio files into the timeline

    for(var i=1; i<=lib.numItems; i++) {

        var item = lib.item(i);

        if(item.typeName == "Footage" && item.hasAudio) {

            var layer = comp.layers.add(item);

            layer.startTime = head;

            head = layer.outPoint;

        }

    }

    comp.duration = head;

 

 

Documentation just comments on Project.selection: "All items selected in the Project panel, in the sort order shown in the Project panel."

How can i make sure that either my "folder items" or my selected items are sorted by name? Is it possible to access project window "sorting" property or do i have to push file names into array and just deal with them myself?

 

Note: If the project window is sorted by some other attribute then files are added to the timeline in incorrect order

 

Message was edited by: Masha Yamnitski


Viewing all articles
Browse latest Browse all 2143


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>