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

Script AE Dropdownlist array of a folder issue

New Here ,
Sep 16, 2020 Sep 16, 2020

Copy link to clipboard

Copied

hello, i'm trying to make a list of all files inside my main folder and put it inside a dropdownlist.

but i don't now why is not working.

I have a result NaN instead of a list with my files

here is my code ,thanks a lot


// list of all files inside MyFolder
var MyFolder = Folder("/R/MyFolder/");
var arrayPresets = MyFolder.getFiles('');
var fileNames = getFileNames(arrayPresets);
function getFileNames(arrayPresets) {
var fileNames = [],
baseName = "";
for (var i = 0, il = arrayPresets.length; i < il; i++) {
baseName = arrayPresets[i].displayName.split(".")[0];
fileNames.push(baseName);
}
return fileNames;
}

//====================UI=======================================
//=============================================================
function myScript(thisObj){
function myScript_buildUI(thisObj){
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "test", [300, 300, 300, 300], {resizeable:true});

res = "group{orientation:'column', alignment:['left', 'top'], alignChildren:['fill', 'fill'],\
myTabSettings: Panel{type:'tabbedpanel',text:'',\
myPanelList: Panel{type:'tab',text:'Test', orientation:'column',alignChildren:['fill', 'fill'],\
groupOneButtons: Group {text:'', orientation:'row',alignChildren:['center', 'center'],\
TextButton: StaticText{text:'Folders:', preferredSize:[43,25]},\
ListButton: DropDownList{properties:{items:[fileNames]}, preferredSize:[170,25]},\
},\
},\
},\
}";
//Add resource string to panel
myPanel.grp = myPanel.add(res);

//add my folder array to my list ??
myPanel.grp.myTabSettings.myPanelList.groupOneButtons.ListButton.properties.items=fileNames.toString()
alert(fileNames.toString())
//~ myPanel.grp.myTabSettings.myPanelList.groupOneButtons.ListButton.text=" + fileNames.toString() + "


//====================SHOW==UI================================

//Setup panel sizing and make panel resizable
myPanel.layout.layout(true);
return myPanel;
}
var myScriptPal = myScript_buildUI(thisObj);
if (myScriptPal != null && myScriptPal instanceof Window){
myScriptPal.center();
myScriptPal.show();
}
}
myScript(this);

 

TOPICS
Scripting

Views

136

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
Mentor ,
Sep 16, 2020 Sep 16, 2020

Copy link to clipboard

Copied

LATEST

This looks odd:

 

for (var i = 0, il = arrayPresets.length; i < il; i++)

 

 

Try:

 

for (i = 0; i < arrayPresets.length; i++)

 

*Martin

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