Copy link to clipboard
Copied
I am looking to put a delay in a message but the following does not work for me
app.setTimeOut(app.alert("Hello"), 5000);
Any ideas on what i'm doing wrong.
Thanks,
Alan
Copy link to clipboard
Copied
The code to execute must be a string:
app.setTimeOut("app.alert(\"Hello\")", 5000);
Copy link to clipboard
Copied
Hi try67,
thank you that worked perfectly.
is it possible to apply the principle to a function
Thanks,
Alan
Copy link to clipboard
Copied
Hi,
I think i have resolved the issue.
Regards,
Alan
Copy link to clipboard
Copied
Unfortunately what i thought was gonna work didnt and for some reason i cant get a delay for 60 seconds the max it 9.
Is there an issue with 60 seconds
Copy link to clipboard
Copied
No, should work fine. Are you aware the delay is in ms, so 5000 is 5 seconds?
Copy link to clipboard
Copied
Hi try67,
Yep I'm.aware of the Ms I set it to 9000 and works but when I increase to 60000 nothing happens.
app.setTimeOut("app.alert(\"Hello\")", 5000);
Works perfect until I try to go past 10 seconds.
Copy link to clipboard
Copied
Try this, Instead of using a single timeout, use an interval of 5 seconds and a counter.
global.nIntCount = 0;
global.nInterval = app.setInterval("if(++global.nIntCount >= 12){app.clearInterval(global.nInterval);app.alert(\"Hello\");}", 5000);
Copy link to clipboard
Copied
Thank you that worked perfectly
Copy link to clipboard
Copied
- You need to save the return value of the setTimeOut method to a variable, even if you don't use it later on.
- While the alert window is open the counter does not progress, as that window is modal and blocking further execution of code.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now