I have a script that is sending a text, if a tag is set to true I want it to execute the script.
This is the value change setup that I currently have that is not working.
Here is the SeanTextHelpCall Script.
from java.io import File
from javax.imageio import ImageIO
#importing the Time library for the date and the time.
from time import sleep
import datetime
# Importing the necessary modules for email sending
from java.nio.file import Files
from java.nio.file import Paths
def Main():
tags = [
#Regular Help Call Buttons
(".../Block A/Station 1010/Mode/Station 1010/CallPB", "Regular", "1010"),
(".../Block A/Station 1040/Mode/Station 1040/CallPB", "Regular", "1040"),
(".../Block B/Station 1100/Mode/Station 1100/CallPB", "Regular", "1100"),
(".../Block B/Station 1530/Mode/Station 1530/CallPB", "Regular", "1530"),
(".../Block B/Station 1160/Mode/Station 1160/CallPB", "Regular", "1160"),
(".../Block C/Station 1640/Mode/Station 1640/CallPB", "Regular", "1640"),
(".../Block D/Station 1310/Mode/Station 1310/CallPB", "Regular", "1310"),
(".../Block E/Station 1398/Mode/Station 1398/CallPB", "Regular", "1398"),
#Quality Help Call Buttons
(".../Block A/Station 1010/Mode/BlockA_Front_Help_CallPB_Quality", "Quality", "1010"),
(".../Block A/Station 1040/Mode/BlockA_Middle_Help_CallPB_Quality", "Quality", "1040"),
(".../Block B/Station 1100/Mode/BlockB_Beginning_Help_CallPB_Quality", "Quality", "1100"),
(".../Block B/Station 1530/Mode/BlockB_Middle_Help_CallPB_Quality", "Quality", "1530"),
(".../Block B/Station 1160/Mode/BlockB_Back_Help_CallPB_Quality", "Quality", "1160"),
(".../Block C/Station 1640/Mode/BlockC_Help_CallPB_Quality", "Quality", "1640"),
(".../Block D/Station 1310/Mode/BlockD_Help_CallPB_Quality", "Quality", "1310"),
(".../Block E/Station 1398/Mode/BlockE_Help_CallPB_Quality", "Quality", "1398")
]
#Getting Times & Dates
todays_date = datetime.date.today().strftime('_%m_%d_%y')
current_time = datetime.datetime.now().strftime('_%H_%M')
smtp = "WorkingSMTP.com"
username = "" # not required as smtpProfile is used
sender = "SMTPEMAIL@THISWORKS.com"
password = "password"
subject = ""
body = current_time + "\n"
for tagPath, helpType, station in tags:
if system.tag.read(tagPath).value: # Assuming you're reading the tag like this
body += helpType + " Help Call At Station " +station + "\n"
recipients = ["1231231234@txt.att.net"]
if "Help Call" in body:
system.net.sendEmail(smtp=smtp, fromAddr=sender, subject=subject, body=body,html=0, to=recipients, password=password)
The texts send through if I manually set the tags to TRUE and THEN manually execute in the script editor tool.
However, the script doesn't run automatically when I have the setup as I do in the Image.