Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to create a 2 second delay using javascript

New Here ,
Dec 15, 2021 Dec 15, 2021

Hello, Ken here from the UK

 

I am trying to create a two second delay in my javascript routine using this syntax which I know to be wrong:

 

var delay  = 2000;

setTimeout(blank() {

 this.getField(“blank6a”).display = display.visible

}, delay);

 

Could anyone provide help in how I can get a two second delay before a text (blank) is visible?

 

Thank you

 

TOPICS
JavaScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2021 Dec 15, 2021

Use the "app.setTimeout()" function:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%...

 

You could almost use the same code you've shown in the post, except there may be an issue with "this".  I usually store the current doc object in a variable that can be reached globally, just to avoid any local context issues.

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2021 Dec 16, 2021

Tom,

 

Thank you for your response. I am not a javascript coder having only used routines I have developed from Google searches. Your recommendation to use app.setTime function leaves me baffled as I am afraid as I simply cannot work out the syntax from the link you provided.

 

Would you kindly help me by providing me the code syntax for what I would like to achieve?

 

Best regards,

 

Ken

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2021 Dec 16, 2021

Try this:

 

var delay = 2000;
app.setTimeout("this.getField(\"blank6a\").display = display.visible;", delay);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2021 Dec 18, 2021

Try67,

 

Thank you but this code did not work either. I do believe.however, we are near.

 

Best Regards,

 

Ken

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2021 Dec 18, 2021
LATEST

Try it now:

 

var delay = 2000;
var to1 = app.setTimeOut("this.getField(\"blank6a\").display = display.visible;", delay);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines