How can I pause a client timer event script when a specific window is open?

I am running a screen swap timer script that cycles through 3 different windows every 30 seconds. I am curious to know if there is a way I can pause this scrip while I have a different window, that's not on the swap list, open. Here is the script I am using:

windows = ["lineDriveMotorData", "laminatorMotorData", "filledCoatingMotorData"]
currentWindow = system.tag.getTagValue("[System]Client/User/CurrentWindow")
try:
    idx = windows.index(currentWindow)
except:
    idx = 0
if idx == (len(windows) - 1):
    idx = 0
else:
    idx += 2-1
nextWindow = windows[idx]
system.nav.swapTo(nextWindow)

I have a separate window that is accessed by a tab strip, and I do not want this script to run while I am on that tab (it is a historical table that we will ideally need a longer time on to reach what we are searching for.)
Screenshot (47)

Ideally, I would like to resume the timer script when we navigate back to the "Auto Roll" tab.

Thanks for any advise.

You can't pause it. But you can use system.gui.getWindow() inside a try - except block to retrieve the subject window, and do the swapping in the except clause (when the window is not present).

2 Likes

Perfect! Thank you very much.