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

**URL:** <https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [June 19, 2024, 2:00pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091 "2024-06-19T14:00:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_RDFTX](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin_rdftx/32/56713_2.png) [@Justin\_RDFTX](https://forum.inductiveautomation.com/u/Justin_RDFTX)\
**Post date:** [June 19, 2024, 2:00pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/1 "2024-06-19T14:00:53Z")

</div>

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:

```python
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)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3f85c2ac35d0f09a9412e2beb283719e242335f8.png)

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

Thanks for any advise.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 19, 2024, 2:04pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/2 "2024-06-19T14:04:04Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Justin\_RDFTX](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin_rdftx/32/56713_2.png) [@Justin\_RDFTX](https://forum.inductiveautomation.com/u/Justin_RDFTX)\
**Post date:** [June 19, 2024, 5:16pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/3 "2024-06-19T17:16:50Z")

</div>

Perfect! Thank you very much.

---

<div class="post-metadata">

**Author:** ![garth1reynolds](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@garth1reynolds](https://forum.inductiveautomation.com/u/garth1reynolds)\
**Post date:** [March 4, 2025, 4:31am UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/4 "2025-03-04T04:31:56Z")

</div>

Could you please share the working script for this please Id like to steal it 😃

---

<div class="post-metadata">

**Author:** ![Justin\_RDFTX](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin_rdftx/32/56713_2.png) [@Justin\_RDFTX](https://forum.inductiveautomation.com/u/Justin_RDFTX)\
**Post date:** [March 4, 2025, 1:18pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/5 "2025-03-04T13:18:28Z")

</div>

```python
windows = ["Line_Speed_V2", "Process_Temps", "Line_Output", "Line_Efficiency"]
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)

```

---

<div class="post-metadata">

**Author:** ![Justin\_RDFTX](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin_rdftx/32/56713_2.png) [@Justin\_RDFTX](https://forum.inductiveautomation.com/u/Justin_RDFTX)\
**Post date:** [March 4, 2025, 1:19pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/6 "2025-03-04T13:19:08Z")

</div>

This is what I have and it works flawlessly

---

<div class="post-metadata">

**Author:** ![Justin\_RDFTX](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin_rdftx/32/56713_2.png) [@Justin\_RDFTX](https://forum.inductiveautomation.com/u/Justin_RDFTX)\
**Post date:** [March 4, 2025, 3:47pm UTC](https://forum.inductiveautomation.com/t/how-can-i-pause-a-client-timer-event-script-when-a-specific-window-is-open/92091/7 "2025-03-04T15:47:27Z")

</div>

Im sorry, I posted a different window change script that I am using.

This is the one that I am running relevant to this topic

```python
windows = ["lineDriveMotorData", "laminatorMotorData", "filledCoatingMotorData"]
currentWindow = system.tag.getTagValue("[System]Client/User/CurrentWindow")
try:
	system.gui.getWindow("historicalTables")
except:
	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)

```
