Copy link to clipboard
Copied
It's good it's not working, as you'll end up with an infinite loop of a function that calls itself within it...
I see two issues with it, beyond that:
- The first parameter needs to be a string, not a function. In your case it would be:
"processPage()"
- You should always use a variable to handle the return object of setTimeOut. If you don't do that it often doesn't work, even if you don't use that variable for anything later on. So the complete line should be:
var to1 = app.setTimeOut("processP
...Copy link to clipboard
Copied
It's good it's not working, as you'll end up with an infinite loop of a function that calls itself within it...
I see two issues with it, beyond that:
- The first parameter needs to be a string, not a function. In your case it would be:
"processPage()"
- You should always use a variable to handle the return object of setTimeOut. If you don't do that it often doesn't work, even if you don't use that variable for anything later on. So the complete line should be:
var to1 = app.setTimeOut("processPage()", 1000);
But again, this will lead to an infinite loop. What exactly are you trying to achieve with this code?
Copy link to clipboard
Copied
Thank you, it is ok. My func will finish by p++;
Copy link to clipboard
Copied
Ah yes, since p is defined outside the function it should be OK...
Copy link to clipboard
Copied
Oh, sometime. it still not ok.
var p=0;
var link_info="";
function processPage()
{
if (p < 10)
{
link_info += "page:"+p;
p++;
var t=app.setTimeOut("processPage()", 1000);
console.println(p);
}
else
{
event.value = link_info;
}
}
processPage();
Output:
1
undefined2
3
4
5
6
Copy link to clipboard
Copied
I ran it from the Console and it worked fine. Where did you place the code, exactly?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now