We've transitioned to having a master project, and several subprojects within that master folder. I would like to have it so that if a user navigates from Subproject A to Subproject B, after x minutes of inactivity they're redirected back to subproject A. I've been able to implement this in a pretty convoluted and tedious way. Basically, when a user navigates from A to B, I write the path to window A in a client tag. On B, I have several timers (one for each window). When the timer hits the max value - 1, the timer will close the current window and navigate back to the window path stored in the client tag. When I navigate from Window B-1 to B-2, I set the timer on B-1 to 0 again and the timer on B-2 should then start counting up from 0. The problem I'm having is on the transition from B-1 to B-2, the timer on B-1 never seems to go back to 0 despite my explicit assignment; instead, it keeps counting up and will still trigger the return to A, sometimes even when I just navigate from B-1 to B-2 and the max length of neither timer should have had time to reach its trigger condition.
Does anyone know why this is happening? Should timers not be used like this? Is there a better method?
Code for button from B1 to B2
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to update
# this script without overwriting your changes.
event.source.parent.getComponent('Timer').value = 0
#system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
window = system.nav.swapTo('SafetyCenter/SOPsAndLockouts/SOPViewer')
system.nav.centerWindow(window)
Code for button from B2 to B1
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to update
# this script without overwriting your changes.
#Reset Timer
event.source.parent.getComponent('Timer').value = 0
#system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
window = system.nav.swapTo('SafetyCenter/Home Screen')
Code for Timer B1
if (event.source.value == event.source.max-1):
#event.source.value = 0
#system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
prevWindow = system.tag.read("[client]PreviousWindow").value
event.source.parent.getComponent('Timer').value = 0
system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
if(prevWindow != ""):
window = system.gui.getWindow('SafetyCenter/Home Screen')
system.nav.closeWindow(window)
system.nav.openWindow(prevWindow)
else:
system.gui.messageBox("This machine has no other project to return to. If you are experiencing issues, please restart the computer.", "No other project found")
Code for Timer B2
if (event.source.value == event.source.max-1):
event.source.value = 0
system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
prevWindow = system.tag.read("[client]PreviousWindow").value
#event.source.parent.getComponent('Timer').value = 0
#system.tag.write('[client]AllInOne/IdleTimerOn.Value',"false")
if(prevWindow != ""):
window = system.gui.getWindow('SafetyCenter/SOPsAndLockouts/SOPViewer')
system.nav.closeWindow(window)
system.nav.openWindow(prevWindow)
else:
system.gui.messageBox("This machine has no other project to return to. If you are experiencing issues, please restart the computer.", "No other project found")