Forum Moderators: open
I am writing a jscript that will be ran via a scheduled task, therefore it wont be within a browser window so the window object doesnt exist.
Does anybody know of a function or if i am able to create the window object to use it? or has anybody done a similar thing before and knows how i can do what im trying to do some other way?
thanks for any help in advance guys.
Adrian
var d = new Date();
var now = d.getTime();
// delay
while (new-now < 10000){
var x= new Date();
var new = x.getTime();
} // delay is over, continue...
alert('hello world');
Caveat. I have no idea if it'll work, and you could easily end up with bugs that cause an infinite loop. Just an idea.
This question is unusual. Scheduled tasks don't usually use or need Timeouts. In the timeless world of crons, everything happens whenever it happens, with no human-interface or time-dependent activities to worry about... can you divulge what you're working on where you'd need a setTimeout where there's no window?