Window popup time of day

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

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.

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.

[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]

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

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.

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

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.

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.

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 or system.util.invokeAsynchronous.

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:

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.

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

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.