I have 10 screens which I need to make them as screensavers when the HMI is idle for certain amount of time. The screen saver should cycle form the 1st screen to the 10th and continue cycling until the screen is being touched. Can someone please let me know what is the easiest way to do this?
Thanks.
I’ve done something similar with system.util.getInactivitySeconds in a client event
timer script.
Thank You for the link.
I was able to swap to the first screen after 60 secs of inactivity. But to cycle through multiple screens, I need to have some kind of time delay after 1st screen it should automatically go to the 2nd screen and 3rd …so on. Is there any command to add time delays after screens so that it would go on to the next screen after say 10 secs. ?
Do you always want it to switch to the same screen first and then go through a set of screens in order, or do you want to pick up where you left off?
Same screen first and go through set of screens in order.
I was able to go through set of screens in order using this script, but when it is at the last screen it should go back to the first screen and keep cycling. It is just staying at the last screen.
if system.util.getInactivitySeconds()>5 and system.nav.getCurrentWindow()!=“OverviewScreen”:
system.nav.swapTo(“Safety Slogan 1”)
if system.util.getInactivitySeconds()>10:
system.nav.swapTo(“Safety Slogan 2”)
if system.util.getInactivitySeconds()>15:
system.nav.swapTo(“Safety Slogan 3”)
if system.util.getInactivitySeconds()>20:
system.nav.swapTo(“Safety Slogan 4”)
if system.util.getInactivitySeconds()>25:
system.nav.swapTo(“Safety Slogan 5”)
Any idea how to keep the screens cycling in order until the HMI has been touched?
inactive = system.util.getInactivitySeconds()
windows = [
'window0',
'window1',
'window2',
'window3'
]
period = inactive / 5 # 5 would be however long you want one screen to stay up
screen = period % len(windows)
print windows[screen] # you would do swapTo here instead of print
One word of caution, this will execute every time the timer script runs, not just when the screens should switch (my timer script was running every second, so the output looked like this). One way you could mitigate this would be to only run the client timer script every 5 seconds. You may also be able to just ignore this; it may not make that much difference, but I haven’t tested it.
Edit: Changed dictionary to list. Removing an element from the middle of the list would have been inconvenient when using a dictionary where keys were required to be sequential.
Perfect! Worked like a charm. Thank You Sir for your help.