3 Replies Latest reply: Apr 9, 2012 4:56 AM by Christian Lett RSS

    Multicolumn Listbox Entries with Image Problem

    Christian Lett Community Member

      Hi all.


      I'm writing a script that features a multi-column list box to display some info. The info displayed is reloaded based on a dropdown list selection, so depending on the dropdown option, different data is displayed in the listbox.


      This is all working fine, except for when I want to include an image for each row in one of the columns. On first load, the data (with image) displays as expected. However when I change my data only the first row of the first column of data is displayed in the listbox (without an image).


      Here's the code I'm using (edited for confidentiality):


      for(var i=0; i<myData.length; i++) {

          var myRow = myUI.grp.p1.t1.myListBox.add("item", myData[i].column1.columnData);

          myRow.image = File("myIcon.png");

          myRow.subItems[0].text = myData[i].column2.columnData;

          myRow.subItems[1].text = myData[i].column3.columnData;



      If I comment out the "myRow.image..." line, everything loads into the listbox fine every time. Is this a bug, or am I missing something important?





        • 1. Re: Multicolumn Listbox Entries with Image Problem
          David Torno Community Member

          Not specifically sure what might be causing the issue, but have you tried using a try/catch to debug it? This usually works for me in narrowing down the specific error in addition to the line it happened at. It may reveal the deeper problem causing the issue.




          /// Your code here



               alert("Error at line: " + err.line.toString() + "\n\n"+err.toString());


          • 2. Re: Multicolumn Listbox Entries with Image Problem
            Christian Lett Community Member

            Thank you David - that indeed did reveal that for some reason the next time the list box tried to populate, there was "invalid image data". I can only assume that on first load, the relative path that the script is using toget the images is valid, but afterwards it forgets where it is, and the path is no longer valid. The images themselves are in the "ScriptUI Panels" folder and are small PNG files. I guess I'll have to put an absolute path to the images (this works).

            • 3. Re: Multicolumn Listbox Entries with Image Problem
              Christian Lett Community Member



              My images were in my ScriptUIPanels folder, and I was using a relative path to access them, e.g.


                  myRow.image = File("myIcon.png");

              Upon initialisation of the script, After Effects assumes relative paths like this are the folder from which the script is being run, in this case ScriptUI Panels. However after initialisation, this changes to the Support Files folder, hence the reason why it couldn't find my images.


              If I declare a variable


                  AE_SCRIPTS_FOLDER_PATH = Folder.current.fsName;


              upon script initialisation, I can use this as an absolute path to access my images from wherever I like in the script.


              Thanks for the assistance!