Skip to main content
drorlazar
Participating Frequently
June 23, 2016
Question

selecting render queue items via script

  • June 23, 2016
  • 2 replies
  • 1078 views

Hi

i'm looking for a way to select items in the render queue via script.

i'm creating a listBox that contains all the RQ items ( i need to list them in a simpler way then the RQ window, and i'm keeping the index number of each item), and i want to select from that list items and select them in the RQ.

ideas?

thanks

Dror

try{

    

function createUserInterface (thisObj,userInterfaceString,scriptName){

            var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName,

                                        undefined,{resizeable: true});

            if (pal == null) return pal;

           

            var UI=pal.add(userInterfaceString);

           

            pal.layout.layout(true);

            pal.layout.resize();

            pal.onResizing = pal.onResize = function () {

                                                            this.layout.resize();

                                                            }

            if ((pal != null) && (pal instanceof Window)) {

                    pal.show();

            }

    return UI;

};

{var res ="group {orientation:'column',\

                                    alignment:['fill','fill'],\

                                    alignChildren:['fill','top'],\

                                    folderPathListbox:ListBox{\

                                                        alignment:['fill','fill'],\

                                                        properties:{\

                                                        multiline:true,\

                                                        multiselect:true,\

                                                        numberOfColumns:6,\

                                                        showHeaders:true,\

                                                        columnTitles: ['#','OM','Date','Time', 'Comp Name', 'Render Path']}\

                                                        },\

                                    buttonGroup:Group{orientation:'row',\

                                                            alignment:['fill','bottom']\

                                                            alignChildren:['fill','bottom'],\

                                                            buttonPanel: Panel{\

                                                                                    text:'Actions',\

                                                                                    orientation: 'row',\

                                                                                     alignment:['fill','bottom']\

                                                                                    refButton: Button{text:'Refresh'}\

                                                                                    dupButton: Button{text:'Duplicate'}\

                                                                                    selButton: Button{text:'Select in RQ'}\

                                                                                    expButton: Button{text:'Export'}\

                                                                                }\

                                                            searchPanel: Panel{\

                                                                                    text:'Search',\

                                                                                    orientation: 'row',\

                                                                                    searchBox: EditText{text:'search by fileName'},\

                                                                                    searchButton: Button{text:'Search'},    \

                                                                                }\

                                                            }\

                    }";

                       

}

function listRQ (rqList){

    try{

            var folderPathListbox = rqList;

            var proj = app.project;

            var totalRenderQ = proj.renderQueue.numItems;

            for(var i= 1; i<=totalRenderQ;  i++){

                    var totalOM= proj.renderQueue.item(i).numOutputModules;

                     for (var om= 1; om<=totalOM; om++){

                                    var dateList, timeList, curItem;

                                    if (proj.renderQueue.item(i).startTime != null){

                                                var min = proj.renderQueue.item(i).startTime.getMinutes() <10 ? "0"+ proj.renderQueue.item(i).startTime.getMinutes() : proj.renderQueue.item(i).startTime.getMinutes();

                                                var year = proj.renderQueue.item(i).startTime.getFullYear().toString().substr (-2,2);

                                                timeList = (proj.renderQueue.item(i).startTime.getHours()-1)+":" + min;

                                                dateList =proj.renderQueue.item(i).startTime.getDate()+"/"+(proj.renderQueue.item(i).startTime.getMonth()+1)+"/"+year ;

                                    }else{     

                                            dateList = "not ";

                                            timeList = "rendered";

                                        }

                                    curItem = folderPathListbox.add ('item', i );                              // Column 1

                                    curItem.subItems[0].text = om;                                               // Column 2

                                    curItem.subItems[1].text = dateList.toString();                          // Column 3

                                    curItem.subItems[2].text = timeList.toString();                          // Column 4

                                    curItem.subItems[3].text = proj.renderQueue.item(i).comp.name; // Column 5

                                    curItem.subItems[4].text = proj.renderQueue.item(i).outputModule(om).file.toString().replace(new RegExp(",","g"), "\r").replace(new RegExp("%20","g"), " ").replace(new RegExp("%5B","g"), "[").replace(new RegExp("%5D","g"), "]"); // Column 6   

                                }

            }

          }catch(err){alert(err)}

    return folderPathListbox;

    }

var UI = createUserInterface(this,res,"Better RQ");

var myList = UI.folderPathListbox;

var lsRq = listRQ(myList);

//~ alert(lsRq.toString());

{ // buttons action

UI.buttonGroup.buttonPanel.refButton.onClick = function () {

                                                    lsRq.removeAll();

                                                    listRQ(myList);

                                                    writeLn("all done");

                                                    }

UI.buttonGroup.buttonPanel.dupButton.onClick = function () {

                                                    var lstSlct = new Array ;

                                                    lstSlct = myList.selection;

                                                    if ( lstSlct != null){

                                                        var totalDup = lstSlct.length;

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

                                                                var lsId = lstSlct.toString();

                                                                var dup =  parseInt(lsId);

                                                                app.project.renderQueue.item(dup).duplicate();

                                                                writeLn("duplicated #"+dup);

                                                            }  

                                                    }else{

                                                        alert ("select Something");  

                                                     }

                                                   

                                                    }

UI.buttonGroup.buttonPanel.selButton.onClick = function () {

                                                                        app.project.renderQueue.showWindow(true) ; //shows the RQ

                                                                        alert ("selButton");

    }

UI.buttonGroup.buttonPanel.expButton.onClick = function () {

                                                                                       // var  compName = myList.                      

                                                                                        alert ("expButton");

    }

}

}

catch(err){

    alert ("Error at line # " + err.line.toString() + "\r" + err.toString());

    }

This topic has been closed for replies.

2 replies

Legend
June 24, 2016

Xavier is right, that ExtendScript does not carry this access. You might be able to write an AE plugin though, and trigger that from the script. Just a thought, and I'm not plugin developing savy, so I'm not sure how difficult that is.

UQg
Legend
June 23, 2016

rq items dont have the "selected" property (in the gui, yes, but it was not ported to extend script).

Form the guide, it seems that scripts can read/write the selection state only for things in the project and timeline panel.

Xavier

drorlazar
drorlazarAuthor
Participating Frequently
June 25, 2016

thanks.

at least i know not to chase my solution in that direction..