# Timer in Client event scripts

**URL:** <https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 26, 2022, 10:00am UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299 "2022-07-26T10:00:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [July 26, 2022, 10:00am UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/1 "2022-07-26T10:00:34Z")

</div>

Hi,

I am running a timer script in Client event scripts

Once the screen lock in Client whether timer script will still running??? Or it will stop???

---

<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:** [July 26, 2022, 12:14pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/2 "2022-07-26T12:14:54Z")

</div>

Still running, unless the computer goes to sleep.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [July 26, 2022, 12:27pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/3 "2022-07-26T12:27:19Z")

</div>

Is there any way to stop it when its locked?

And resume when its unlocked

---

<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:** [July 26, 2022, 12:33pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/4 "2022-07-26T12:33:48Z")

</div>

I don’t know if Windows exposes screen locked status in any way java can read. You cannot stop the event from running, by you could check a boolean to skip the processing when locked. The trick will be to determine from within Ignition if the screen is locked. I don’t know that answer.

For production HMIs, I set the desktop to presentation mode, so the screen with neither blank out nor lock. If not a production HMI, you probably should not _ **care** _ that the screen is locked.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 26, 2022, 12:35pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/5 "2022-07-26T12:35:52Z")

</div>

He may just mean the Vision Lock Screen, which is triggered by a script that looks at the inactivity timer by default. He could set a Boolean and skip processing as you suggested if that’s the case.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [July 26, 2022, 12:36pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/6 "2022-07-26T12:36:38Z")

</div>

Yes i have found a way

In first line i need to use this one condition

If `not` `system.security.isScreenLocked():`

Its correct right?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 26, 2022, 12:37pm UTC](https://forum.inductiveautomation.com/t/timer-in-client-event-scripts/62299/7 "2022-07-26T12:37:17Z")

</div>

Yeah that should work.
