Hi, I’m new with JavaScript for pdf document. I try to make a small JavaScript, but no any result..:(
Issue: As soon as I open a pdf document, a timer must startup, after x-milliseconds an app.alert must appears with option button. Click OK must go-to URL, and Cancel go-back-to pdf.
But, how can I set interval/timer before the alert windows appears? And, how can I define the buttons on the app.alert?
Thanks.
Hi,
So set a javascript to run after a period of time you could use the SetInterval or setTimeout.
As for the dialog the app.alert is not the most customisable but you could use the execDialog function to show your own dialog, however this is a little involved.
Please see the Acrobat JavaScript Guide for the documentation
SetInterval http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_Acr oJS.88.159.htmlSetTimeout - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_Acr oJS.88.160.html
execDialog - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_Acr oJS.88.136.html
Hope this helps
Malcolm
Message was edited by: BarlaeDC : To remove unnecessary link
I think i understand it. I have now small script:
function MyPopup()
{
if(1==app.alert("ClickMe",3,1, "popup text"))
app.launchURL("http://www.abc.com");
}
app.setTimeOut("MyPopup()",2000);
But now another problem:
Timer/interval with popup works great in Acrobat, but when i save it, and I open it again with Reader then there is no timer/interval anymore. Popup appears immediately after pdf opens, without waiting on the timer function!!
Can someone help me with this problem?
Hi,
I am not sure what version you are trying it in but using your code I created the file linked below and it works in Reader X
https://acrobat.com/#d=UduYeEQUWSY7kf94k1Cy4Q
Hope this helps
Malcolm
North America
Europe, Middle East and Africa
Asia Pacific