Copy link to clipboard
Copied
here in this script:
var mydlg = app.dialogs.add({name:"employees"});
with(mydlg.dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"employees list"});
}
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"select one"});
var empName = dropdowns.add({stringList:["joe","Sarah","Anne","Andy"], selectedIndex:0});
}
mydlg.show()
}
var Name = empName.selectedIndex;
alert (Name)
when select any element in the list such as the 3th element will get "2",
but i want to get: "Anne"
can any one help me please, thanks.
Copy link to clipboard
Copied
Hey!
Just change this line:
var Name = empName.selectedIndex;
to this:
var Name = empName.stringList[empName.selectedIndex];
Hope that helps.
--
Marijan (tomaxxi)
http://indisnip.wordpress.com/
Copy link to clipboard
Copied
Or try this code:
var empName = ["joe","Sarah","Anne","Andy"]; var mydlg = app.dialogs.add({name:"employees"}); with(mydlg.dialogColumns.add()){ with(dialogRows.add()){ staticTexts.add({staticLabel:"employees list"}); } dialogRows.add(); with(dialogRows.add()){ staticTexts.add({staticLabel:"select one"}); var S_empName = dropdowns.add({stringList:empName, selectedIndex:0}); } mydlg.show() } alert (empName[S_empName.selectedIndex])
Shonky
Copy link to clipboard
Copied
You messed it up little bit, didn't you?
var empName = ["joe","Sarah","Anne","Andy"];
var mydlg = app.dialogs.add({name:"employees"});
with(mydlg.dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"employees list"});
}
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"select one"});
var S_empName = dropdowns.add({stringList:empName, selectedIndex:0});
}
mydlg.show()
}
alert (empName[S_empName.selectedIndex])
--
tomaxxi
Copy link to clipboard
Copied
Yea tommaxi, u r right.
How quotes removed from my code.
I have tested and paste code from ExtendScript Toolkit. How it happed?
Anyway thanks tommaxi
Shonky
Copy link to clipboard
Copied
great
Shonky, Tomaxxi
thanks so much
Find more inspiration, events, and resources on the new Adobe Community
Explore Now