I’d like to open a popup based on the value of a tag. I have tried this as a timer client and tag change client script, both with no luck. On the tag change script, if I change that tags value then I get the popup, but it’s like it’s not seeing the condition. any ideas what I am doing wrong or where I need to put this code
if “testPressureOut” > 15000:
system.nav.openWindow(‘SHP_popup’)
system.nav.centerWindow(‘SHP_popup’)
else:
system.nav.closeWindow(‘SHP_popup’)
It works in the timer script on the page but ultimately i’d like the popup to be there as long as the value is > X, and go away when the value drops below X. Won’t this need to be in a client script so that no matter what page is currently open that it will always be checking this value?
you should be able to stick this in a tag change script. put the tag in the tag list for the tag change script. Then you need to modify the script that adam or mudge posted to fit your tag path and window name. I would also put some print statements to see what is going on.
print "start script"
testPressureOut = system.tag.read("[default]foler/folder/mytag").value
print testPressureOut
if testPressureOut > 15000:
print "pressure greater than 15000, open window"
system.nav.openWindow('SHP_popup')
system.nav.centerWindow('SHP_popup')
else:
print "pressure less than 15000, do nothing"
system.nav.closeWindow('SHP_popup')
i’m still not having luck with it, I’ve even tried different tags just to make sure and I’ve even deleted and recreated that test mem tag (testPressureOut). hmmm
you do have the testPressureOut tag in the tag change script tag list under the tag tab in your screenshot right? also, that print statement needs to be "print testPressureOut", not "print testValue". thats probably why it is failing, because it doesnt recognize that variable.
Hey diat150 yes, I noticed that typo and corrected. Now the script runs and everytime I change that testPressureOut value I get the popup, regardless of whether or not it’s above or below 15000. weird…
print “start script”
testPressureOut = system.tag.read(“testPressureOut”).value
print testPressureOut
if testPressureOut > 15000:
print “pressure greater than 15000, open window”
system.nav.openWindow(‘SHP_popup’)
system.nav.centerWindow(‘SHP_popup’)
else:
print “pressure less than 15000, do nothing”
system.nav.closeWindow(‘SHP_popup’)
Anyone have any idea on how to do this on a mouse click script? I have a graphic that I want to run a mouse clicked script on… where if the tag is =1 I want one pop-up to open, and if it’s =0 I want a different pop-up to open.
I’ve tried this:
selectONE = system.tag.read("[]/MyTag").value
if selectONE=1:
system.nav.openWindow('ThisPopup')
system.nav.centerWindow('ThisPopup')
else:
system.nav.openWindow('ThatPopup')
system.nav.centerWindow('ThatPopup')
# Open pop-up based on whether B8700S is selected for Membrane or Bio aeration
#
# Start script - assign alias to tag
AerationSelect=system.tag.read("CSWT1MB/BLOWERS/Global_Blower_Setpoints/pbB8700S_Membrane_Aeration_Select").value
# Check alias value
if AerationSelect==1:
# If aliased tag = 1 then B8700S Selected for Membrane Aeration - open Train Blower pop-up populated with B8700S info
system.nav.openWindow('Program Windows/Popups/puTrainBlower', {'BlowerID' : 'B8700S_HMI', 'TagPath' : 'B8700S_Info', 'TagID' : 'B8700S_Control'})
system.nav.centerWindow('Program Windows/Popups/puTrainBlower')
else:
# else B8700S Selected for Bio Aeration - open MBR Blower pop-up populated with B8700S info
system.nav.openWindow('Program Windows/Popups/puMBRBlower', {'BlowerID' : 'B8700S_HMI', 'TagPath' : 'B8700S_Info', 'TagID' : 'B8700S_Control'})
system.nav.centerWindow('Program Windows/Popups/puMBRBlower')
The word SyntaxError means that you wrote some code wrong. (In this case, it was the indentation on line 6) You’ll get it eventually; it just takes time if you’re new to this sort of thing.