I've written the following code:function testMe(){ var code = "RealTest();"; app.setInterval(code, 50);}function RealTest(){ console.println("Inside RealTest()");}The RealTest is executed for few times and then stopped. I don't call clearInterval anywhere. Why does it stop automatically and how can I handle it to keep calling the code forever?
Salman Virk
What happens when you explicitely create an interval object:
var pp = app.setInterval(code, 50) :
Does this change something? I believe to remember reading in the Acrobat JavaScript documetnation that this is recommended.
Hope this can help.
Max Wyss.
Where is this code run? What else is going on while the interval is running?
Timers exists in the context of the current document. If the document is closed the timer ceases to exist. If the context is changed, the timer stops. Switching documents and running modal dialogs will both change the current runtime context.
Thom Parker The source for PDF Scripting Info pdfscripting.com All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!
The Acrobat JavaScript Reference, Use it Early and Often
The most important JavaScript Development tool in Acrobat The Console Window (Video tutorial) The Console Window(article)
Having trouble, Why Doesn't my Script Work