Adobe 65009333 Scripting Guide - Page 59
Working with ScriptUI
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 59 highlights
User Interfaces Working with ScriptUI 59 //Display the dialog box. if(myDialog.show() == true){ var myParagraphAlignment, myString, myPointSize, myVerticalJustification; //If the user didn't click the Cancel button, //then get the values back from the dialog box. //Get the example text from the text edit field. var myString = myTextEditField.editContents //Get the point size from the point size field. var myPointSize = myPointSizeField.editValue; //Get the paragraph alignment setting from the radiobutton group. if(myRadioButtonGroup.selectedButton == 0){ myParagraphAlignment = Justification.leftAlign; } else if(myRadioButtonGroup.selectedButton == 1){ myParagraphAlignment = Justification.centerAlign; } else{ myParagraphAlignment = Justification.rightAlign; } var mySwatchName = mySwatchNames[mySwatchDropdown.selectedIndex]; //Remove the dialog box from memory. myDialog.destroy(); //Now create the document and apply the properties to the text. var myDocument = app.documents.add(); with(myDocument.stories.item(0)){ //Set the contents of the story to the string you entered //in the dialog box. contents = myString; //Set the alignment of the paragraph. texts.item(0).justification = myParagraphAlignment; //Set the point size of the text. texts.item(0).pointSize = myPointSize; //Set the fill color of the text. texts.item(0).fillColor = myDocument.swatches.item(mySwatchName); } } else{ myDialog.destroy() } Working with ScriptUI JavaScripts can make, create, and define user-interface elements using an Adobe scripting component named ScriptUI. ScriptUI gives scripters a way to create floating palettes, progress bars, and interactive dialog boxes that are far more complex than InCopy's built-in dialog object. This does not mean, however, that user-interface elements written using Script UI are not accessible to users. InCopy scripts can execute scripts written in other scripting languages using the method.