Illustrator Script: help needed – value of "edittext" (entered text) not returning
I am currently working on a dialog box again.
Question 1:
For the first time ever, I want to enter and use a value from an input field.
But something seems to be wrong, or my thoughts are somehow wrong...
Question 2:
It would be really cool if you could click on the individual items in the list and they would then appear in the corresponding order at the bottom of the text field or the result would also be transferred.
Question 3:
Does it make any difference whether the designations such as “statictext” are in single or double quotation marks?
Here is a simple version of the script...
#target illustrator
if (app.documents.length > 0) {
var docRef = app.activeDocument,
title = "my Window",
myDataBase = [
["DE","EN","FR"],
["eins","zwei","drei"],
["one","two","three"],
["un","deux","trois"]
];
var myOutput = createSelectBox(myDataBase);
alert("myOutput: "+myOutput);
} else {
alert("Bitte öffnen Sie eine Datei um das Script zu benutzen.");
}
// create dialog box
function createSelectBox(thisDataBase) {
var g,p,w;
var btnOk,
btnCancel,
DropItemNames,
listDropItems;
//// data panel
w = new Window("dialog", title);
w.alignChildren = "top";
p = w.add("panel", undefined, "Daten"); //// group with border
g = p.add("group"); //// group without border
g.alignChildren = "fill";
var myPanel1 = p.add ('group {orientation: "column", alignChildren: ["fill","fill"]}');
myPanel1.spacing = 5;
var myText1 = myPanel1.add ('group {orientation: "column", alignChildren: ["fill","fill"]}');
myText1.add ('statictext', undefined, 'Folgende Sprachen sind in dieser Datei enthalten:', {multiline: true});
var myList1 = myPanel1.add ("listbox", undefined, undefined, {readonly: true});
myList1.preferredSize = [400,150];
for (var i = 0; i < thisDataBase.length; i++) {
myList1.add ("item", thisDataBase[0][i])
}
//// input panel
p = w.add("panel", undefined, "Sprachauswahl");
g = p.add("group");
g.alignChildren = "fill";
var myPanel2 = p.add ('group {orientation: "column", alignChildren: ["fill","fill"]}');
myPanel2.spacing = 5;
myPanel2.preferredSize = [400,100];
var myText2 = myPanel2.add ('group {orientation: "column", alignChildren: ["fill","fill"]}');
myText2.add ('statictext', undefined, 'Bitte alle gewünschten Sprachen (Komma getrennt!) in der zu verwendendenten Reihenfolge hier eingeben (Beispiel: DE,EN,FR):', {multiline: true});
var myInputText = myPanel2.add ('group {orientation: "column", alignChildren: ["fill","fill"]}');
myInputText.add ('edittext', undefined, "Enter");
myInputText.characters = 50;
myInputText.active = true;
//// button group
g = w.add("group");
g.alignment = "center";
g.alignChildren = "fill";
btnOk = g.add("button", undefined, "OK");
btnCancel = g.add("button", undefined, "Cancel");
btnOk.onClick = function() { w.close(1); };
btnCancel.onClick = function() { w.close(0); };
if(w.show() == 1){
// BoxProcess();
return myInputText.text;
}
function BoxProcess(){
}
}

