Page 1 of 1
Refresh Screen
Posted: Wed Mar 19, 2014 4:08 pm
by bernard602
How do you automatically refresh a screen in Genie? I need to hit the ENTER button every 5 minutes.
Re: Refresh Screen
Posted: Wed Mar 19, 2014 4:16 pm
by David
Hi Bernard.
For 1 particular screen?
This can be done using JavaScript timers:
https://developer.mozilla.org/en-US/doc ... ipt/Timers
Basically you'd want to use 'setTimeout()' from the 'onload' event of the screen, storing the return value. Then use the 'onsubmit' event to cancel the timer so that it doesn't fire after a normal screen submit. Something along these lines (untested):
Code: Select all
// In onload event:
// Global variables are properties of 'window', so 'window.myTimer' in effect creates a global variable 'myTimer' on the page. Should really attach to a predefined object, maybe defined in 'custom.js'...
window.myTimer;
myTimer = setTimeout(function() {
myTimer = null;
pressKey("Enter");
}, 300000);
// In 'onsubmit' event:
if (myTimer != null) {
clearTimeout(myTimer);
myTimer = null;
}
Re: Refresh Screen
Posted: Wed Mar 19, 2014 4:49 pm
by bernard602
Thanks. That worked.
Re: Refresh Screen
Posted: Wed Mar 19, 2014 4:57 pm
by David
Wow. First try? Something must be wrong. :-).