Scripting: Dialogbox with user input text frames. Help!
Hey! I am new to the forums and new to scripting. I am working on a basic dialog box to help alleviate some very repetitive task.
Basically I have a dialog box appear with 3 fields for the user to enter information into. I want to take their data and have it placed into 3 different text frames on the page. This information would need populate in 3 different locations throughout the document. Unfortunately because I am still new to the world of scripting I am struggling to figure out how to do this. Below is the script that I have thus far. I was able to get everything working with my radio buttons just having issues approaching the input text. Honestly I am not even sure where to begin, I keep finding conflicting data and have gotten overwhelmed and confused.
Any help or guidance would be great appreciated.
// DIALOG
// ======
var dialog = new Window("dialog");
dialog.text = "Enter Text";
dialog.preferredSize.width = 250;
dialog.orientation = "column";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
// GROUP1
// ======
var group1 = dialog.add("group", undefined, {name: "group1"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;
// PANEL1
// ======
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.text = "Text";
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 10;
panel1.margins = 10;
var statictext1 = panel1.add("statictext", undefined, undefined, {name: "statictext1"});
statictext1.text = "Small text 1";
statictext1.preferredSize.width = 250;
var edittext1 = panel1.add('edittext {properties: {name: "edittext1"}}');
edittext1.text = "Edit Text";
edittext1.preferredSize.width = 250;
var statictext2 = panel1.add("statictext", undefined, undefined, {name: "statictext2"});
statictext2.text = "Large Text";
var edittext2 = panel1.add('edittext {properties: {name: "edittext2"}}');
edittext2.text = "Edit Text";
edittext2.preferredSize.width = 250;
var statictext3 = panel1.add("statictext", undefined, undefined, {name: "statictext3"});
statictext3.text = "Small Text 2";
var edittext3 = panel1.add('edittext {properties: {name: "edittext3"}}');
edittext3.text = "Edit Text";
edittext3.preferredSize.width = 250;
// PANEL2
// ======
var panel2 = group1.add("panel", undefined, undefined, {name: "panel2"});
panel2.text = "Color";
panel2.orientation = "column";
panel2.alignChildren = ["left","top"];
panel2.spacing = 10;
panel2.margins = 10;
var radiobutton1 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton1"});
radiobutton1.text = "Blue";
var radiobutton2 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton2"});
radiobutton2.text = "Red";
var radiobutton3 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton3"});
radiobutton3.text = "White";
// GROUP2
// ======
var group2 = dialog.add("group", undefined, {name: "group2"});
group2.orientation = "row";
group2.alignChildren = ["left","center"];
group2.spacing = 10;
group2.margins = 0;
var button1 = group2.add("button", undefined, undefined, {name: "button1"});
button1.text = "OK";
var button2 = group2.add("button", undefined, undefined, {name: "button2"});
button2.text = "Cancel";
dialog.show();
// RADIO INPUT
// ======
var doc = app.activeDocument;
if (radiobutton1.value == true)
{
doc.objectStyles.itemByName("SM_Background").fillColor = "Baker Blue";
doc.objectStyles.itemByName("SM_Bar").fillColor = "Bright Red";
doc.paragraphStyles.itemByName("SM_Large_Twitter").fillColor = "White";
doc.paragraphStyles.itemByName("SM_Small_Twitter").fillColor = "White";
}
if (radiobutton2.value == true)
{
doc.objectStyles.itemByName("SM_Background").fillColor = "Medium Red";
doc.objectStyles.itemByName("SM_Bar").fillColor = "Bright Red";
doc.paragraphStyles.itemByName("SM_Large_Twitter").fillColor = "White";
doc.paragraphStyles.itemByName("SM_Small_Twitter").fillColor = "White";
}
if (radiobutton3.value == true)
{
doc.objectStyles.itemByName("SM_Background").fillColor = "Background Grey";
doc.objectStyles.itemByName("SM_Bar").fillColor = "Bright Red";
doc.paragraphStyles.itemByName("SM_Large_Twitter").fillColor = "Medium Red";
doc.paragraphStyles.itemByName("SM_Small_Twitter").fillColor = "Dark Grey";
}
