Copy link to clipboard
Copied
The title itself.
Hello community, I have a button that let me choose betwen 3 types of texts. Depending on the text its what'll be shown with a stamp (Same stamp for any text). And this process repeat itself on all pages.
The problem is when I try to copy this button into another document the action does not come with it and when I copy the javascript and manually put it into the action the Stamp does not show, just the text.
Thanks in advance.
Copy link to clipboard
Copied
Where is the script selecting the three types of texts from?
Is it from text field objects? Dropdown menus? listboxes?
Copy link to clipboard
Copied
Its a dropdown option menu. Here, I think its better if I share the whole script.
try
{
var Opcion = app.popUpMenu(["Approval", "Test 1", "Test 2", "Test 3" ], "-", "Draft" );
console.println(Opcion);
var x_AP = "Draft";
if (Opcion=="Test 1" ||
Opcion=="Test 2" ||
Opcion=="Test 3")
{
var x_AP = "Approval";
var s = app.response( {cQuestion: "Format : Day - Month - Year", cTitle: "Date of approval ( "+Opcion+" )"} );
var d = util.scand("dd/mm/yy", s);
}
this.removeField("Authorize");
for (var i=0; i < this.numPages; i++)
{
var annots = this.getAnnots({ nPage:i });
console.println(annots);
if (annots != null)
{
for (var j = 0; j < annots.length; j++)
annots[j].destroy();
}
var annot = this.addAnnot( {
page: i,
print: true,
type: "Stamp",
rect: [474.57, 0.37, 590.50, 46.88],
name: "Approved",
author: "Procedures",
AP: x_AP
});
if (Opcion != "Draft")
{
var g = this.addField("Authorize", "text", i, [479.11, 21.73, 581.53, 9.07] );
g.textSize= 5;
g.alignment= "center";
g.readonly = true;
}
}
if (Opcion != "Draft" &&
Opcion != null)
this.getField("Authorize").value =
Opcion + ": " +
util.printd("dd", d) + " of " +
util.printd("mmmm", d) + " of " +
util.printd("yyyy", d);
}
catch(e)
{
app.alert(e);
}