These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Text in Dialog Box

saj
Registered: Oct 15 2008
Posts: 52
Answered

I am creating a Metadata/Document Custom Properties Action Sequence that will allow the user to enter the appropriate information. However, I'm looking for an option that when the dialog box opens the place where you enter text will already have some text in it. I have done this when I use a similar script using a button and I can have the field have text already in it, but this is done as a sequence--with no option like that. Is there a way to do this?
 
Below is my current script. I'm looking for the text line to auto-fill with the word "Supplied" but still be able to be edited by the customer if needed.
 
// Dialog Definition
var oDlg =
{
strName: "",
initialize: function(dialog)
{
dialog.load({"usnm":this.strName});
},
commit: function(dialog)
{
var data = dialog.store();
this.strName = data["usnm"];
},
description:
{
name: "eBook Creation",
elements:
[
{
type: "view",
elements:
[
{
name: "File was",
type: "static_text",
},
{
item_id: "usnm",
type: "edit_text",
char_width: 15
},
{
type: "ok_cancel",
},
]
},
]
}
};
// Dialog Activation
oDlg.strName = this.info;
if("ok" == app.execDialog(oDlg))
{
this.info.eBook_Creator= oDlg.strName;
}
  
thank you in advance for any information or direction.

My Product Information:
Acrobat Pro Extended 10.1, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
In this dialog there is only one text edit field, and it is loaded with the value of the "strName" member (in the initialize function) when the dialog is displayed. So, in fact, everything is already in place for the functionality you need. What's the problem? All you have to do is assign "Supplied" to "strName" before the dialog is executed, like this.

oDlg.strName = "Supplied";
if("ok" == app.execDialog(oDlg))
{
this.info.eBook_Creator= oDlg.strName;
}


Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

saj
Registered: Oct 15 2008
Posts: 52
Accepted Answer
Thanks! Thats exactly what I was looking for...just didn't know where it was to go.
Much appreciated!