Answered
Retrieve elements from an array
Hello friends, I'm new to scripting and I'm studying arrays and I don't know how to export all the items in an array to an external .txt file so that I can reload them again whenever I open the dialog box and add new items.
dialog = new Window("dialog");
dialog.text = "Dialog";
dialog.preferredSize.width = 300;
array=[];
st1 = dialog.add("statictext", undefined, undefined, {name: "st1"});
st1.text = "text";
st1.preferredSize.width = 100;
st1.justify = "center";
et1 = dialog.add('edittext {properties: {name: "et1"}}'); et1.text = "";
et1.preferredSize.width = 60;
bt = dialog.add("button", undefined, undefined, {name: "bt"}); bt.text = "add";
bt.onClick = function(){
n = et1.text;
array.push([n]);
st1.text = array;
et1.text = "";
};
dialog.show();
