Gateway Tag Change Scripts

Hello,
I have a gateway tag change script that is looking at the change of an alarm tag, I want to make it execute only when the alarm is true and not when the alarm is false. Here is my script but for some reason it is still executing when the alarms goes true and when the alarms goes back to false.

[color=#0040BF]Alarm = system.tag.getTagValue(“system1/project1/HTST_1/ALARMS/MILK_TOO_HOT”)
curHour = system.tag.getTagValue(“curTime”)
Temp = system.tag.getTagValue(“system1/project1/HTST_1/Analog/TT130177_SCL”)
body="Pasturized Milk Temp @ " + str(Temp)+ “°F for over 10 min”

if curHour > 9 :
recipients = [“xxxxx@txt.att.net”,“xxx@txt.att.net”]
else :
recipients = [“xxxx@txt.att.net”]

if Alarm :
system.net.sendEmail(smtp=“smtp.xxx”, from="alarms@xxxx.com", subject=“Pasturized Milk Temp High”, body=body,html=0, to=recipients,username="alarms@xxx.com",password=“xxxx”)[/color]

What amd I doing wrong?

It should be something like:[code]if newValue.value == 1:
curHour = system.tag.getTagValue(“curTime”)
Temp = system.tag.getTagValue(“system1/project1/HTST_1/Analog/TT130177_SCL”)
body="Pasturized Milk Temp @ " + str(Temp)+ “°F for over 10 min”

if curHour > 9 :
    recipients = ["xxxxx@txt.att.net","xxx@txt.att.net"]
else :
    recipients = ["xxxx@txt.att.net"]

system.net.sendEmail(smtp="smtp.xxx", from="alarms@xxxx.com", subject="Pasturized Milk Temp High", body=body,html=0, to=recipients,username="alarms@xxx.com",password="xxxx")[/code]

Thanks,
How about when the script is driven by two tags?

You can look at the tag’s name or tag path. Take a look at this page:

inductiveautomation.com/supp … cripts.htm

You can use event.tagPath.itemName or str(event.tagPath) in your script.