# Window popup time of day

**URL:** <https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736>\
**Category:** Ignition\
**Created:** [June 29, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736 "2012-06-29T16:06:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnLynx](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JohnLynx](https://forum.inductiveautomation.com/u/JohnLynx)\
**Post date:** [June 29, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/1 "2012-06-29T16:06:11Z")

</div>

I would like to be able to open a window at a specific time of day. Appreciate any help on this.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [June 29, 2012, 4:23pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/2 "2012-06-29T16:23:13Z")

</div>

You can use a Client Timer Script! You can find it in the designer under Project -\> Event Scripts (Client). I would make one that ran every minute and opened the window on a specific time. Just make sure you check the time at the beginning of the script.

---

<div class="post-metadata">

**Author:** ![JohnLynx](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JohnLynx](https://forum.inductiveautomation.com/u/JohnLynx)\
**Post date:** [June 29, 2012, 4:27pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/3 "2012-06-29T16:27:07Z")

</div>

Could you give an example of how it would be written. I am quite new to Ignition and the scripting aspect of it all. Thanks.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [June 29, 2012, 5:08pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/4 "2012-06-29T17:08:13Z")

</div>

[code]from time import localtime, strftime  
curTime = strftime("%H:%M", localtime())  
print curTime

if curTime == “17:30”:  
#it’s beer thirty!  
system.tag.write(“Beer Cask 1/Flow Control/open”, 1)[/code]

---

<div class="post-metadata">

**Author:** ![JohnLynx](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JohnLynx](https://forum.inductiveautomation.com/u/JohnLynx)\
**Post date:** [June 29, 2012, 5:28pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/5 "2012-06-29T17:28:53Z")

</div>

thanks works with system.tag.write(“Beer Cask 1/Flow Control/open”, 1) being replaced with system.nav.openWindow(“windowname”)

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [June 29, 2012, 5:44pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/6 "2012-06-29T17:44:48Z")

</div>

That’s correct, although if you’re opening a window, system.nav.swapTo(“windowname”) will be the way to go. This function will properly handle closing the window that was previously in focus and open the new one. If you’re just opening a popup, then openWindow works fine.

---

<div class="post-metadata">

**Author:** ![Nelly](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nelly](https://forum.inductiveautomation.com/u/Nelly)\
**Post date:** [October 25, 2017, 6:06pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/7 "2017-10-25T18:06:53Z")

</div>

Hi,

I’d like to do something similar, have my alarm window come up when there is an alarm active, how do i do this if the alarm active tag is not a client tag but an OPC tag, can they be linked? Maybe I am on wrong thread as usual?

Regards  
Neil

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 25, 2017, 7:00pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/8 "2017-10-25T19:00:50Z")

</div>

You should be able to just put the open window script in the value changed event of the tag, except you want to check to see that the value of the tag is active, as opposed to checking what time it is.

---

<div class="post-metadata">

**Author:** ![Nelly](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nelly](https://forum.inductiveautomation.com/u/Nelly)\
**Post date:** [October 26, 2017, 1:58pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/9 "2017-10-26T13:58:26Z")

</div>

Thanks very much,

would I still need the “def” statement that comes up in that changed event box ?

totally new to scripts so sorry if I seem clueless.

---

<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:** [October 26, 2017, 2:12pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/10 "2017-10-26T14:12:03Z")

</div>

> [@Nelly](#):
>
> would I still need the "def" statement

The "def" statement creates a function for later execution. It is appropriate in script modules (`shared.*`, `project.*`) since those execute just once at initialization, and further execution is by calling the functions that were initialized.  
Event scripts execute completely each time the event happens. You would only use "def" within an event script if you need part of that code to be called separately, like when using [system.util.invokeLater](https://docs.inductiveautomation.com/display/DOC79/system.util.invokeLater) or [system.util.invokeAsynchronous](https://docs.inductiveautomation.com/display/DOC79/system.util.invokeAsynchronous).

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [October 26, 2017, 2:28pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/11 "2017-10-26T14:28:07Z")

</div>

Here is what I basically do to do this: On a Client Event Script -\> Tag Change create a new script “New Alarm Popup” referenced to “[System]Gateway/Alarming/Active and Unacked” in the Tags tab for a value change trigger.

On the Script tab enter code similar to this:

```auto
value = system.tag.read("[System]Gateway/Alarming/Active and Unacked").value

if value != 0:
	lstPriority = [4] ## Critical Alarms
	lstState = ["ActiveUnacked"]
	results = system.alarm.queryStatus(priority=lstPriority, state=lstState)
	if results:
              system.nav.openWindow('Alarms')

```

Obviously, you will have to modify this if you want something more sophisticated, but hope this helps get you started.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 26, 2017, 2:29pm UTC](https://forum.inductiveautomation.com/t/window-popup-time-of-day/4736/12 "2017-10-26T14:29:23Z")

</div>

Yes, you still need the generated code in the event:

```auto
def valueChanged(tagPath, previousValue, currentValue, initialChange, missedEvents):

```

There is a comment section following the definition that describes when the event is fired and the arguments that are passed to it.

place your code following the comment section.
