Copy link to clipboard
Copied
I have previously posted my Big Picture objective. Here, I take a Big Step Back, to get a grip on this, in the simplest context I can think of [welcome advice from (try67)]. But I am hindered by perilous partial-understanding of scripting [enough rope to...].
I've reviewed the JavaScriptTM for Acrobat® API Reference. I've scoured online references/suggestions/examples. I've created a slew of test documents. Almost without exception, they function 'dead in the water.' I am missing some things basic, and fundamental.
I sense I get hung up on [despite awareness of need for precision]
I've considered setTimeOut, and setInterval, all sorts of ways. Here's what seems the simplest case [courtesy Thom Parker, 2008]. Upon a Button Event:
app.alert("Hello World", 3);
This works, as seen in the attachment.
But then, on a separate Buttion, I try to trigger the Alert as a parameter of setTimeOut:
// Utilize setTimeout ( expression, timeout );
//where expression is the JavaScript code to run after timeout milliseconds have elapsed.
//
setTimeout (app.alert("Hello World", 3), 2000 );
This fails, as seen in the attachment.
I can readily imagine that an entirely different approach is called for. But I am at a loss for insight/instinct as to whether this demands a defined routine/function/variables/declarations, etc., in what order, etc. I bet a number of you can see, at a glance, where I'm way off base.
Commentary most appreciated.
app.setTimeOut ('app.alert("Hello World", 3)', 2000 );
The script input is a string. And "setTimeOut" is a member of the app object. And the "O" in "out" is capitalized.
JavaScript is case sensitive. You must use the functions in the correct context and verbatim.
Here's the reference entry, Use It:
Copy link to clipboard
Copied
app.setTimeOut ('app.alert("Hello World", 3)', 2000 );
The script input is a string. And "setTimeOut" is a member of the app object. And the "O" in "out" is capitalized.
JavaScript is case sensitive. You must use the functions in the correct context and verbatim.
Here's the reference entry, Use It:
Copy link to clipboard
Copied
I told you, you'd know at a glance!
Thanks, Thom.
Copy link to clipboard
Copied
Note that I updated my post with the correct syntax.
Copy link to clipboard
Copied
I hear you on the caps; was aware, as my Subject Line indicates, but goofed in the script.
That Adobe SDK documentation is one of those many I read repeatedly. Just goes to show the value of Forum, as a teaching tool [that even the best technical writing doesn't speak to the entire spectrum of user qualifications].
Note that I'm here attaching the corrected PDF, marked SOLVED, for benefit of other readers.