I'm trying to create a setup where when a specific tag changes to true, an event will run that sends a message to a session event message handler that then opens the popup. I have the initial message/popup part working, but I want to add to it so that this message/popup repeats every 30 seconds.
Has anyone tried something similar? And if so, how did you accomplish this? My thought was to create a while loop that repeats while the tag value is true and has a delay and sendMessage in it, but I couldn't get that working. I also need the potential of this happening to multiple different tags at once (i.e. multiple gateway tag change events running) as a worse case scenario, so ideally the solution doesn't bog down the gateway too much.
If it helps, here is the current code for the gateway event:
if previousValue.value == False and initialChange == False:
projectName = system.project.getProjectName()
warnInfo = {'message': "Bool_On Checked", 'id': "feanordidnothingwrong"}
system.util.sendMessage(project=projectName, messageHandler="popup_sessionevent", payload=warnInfo, scope="S")
and this is the session event:
def handleMessage(session, payload):
for user_session in system.perspective.getSessionInfo():
if user_session.id == session.props.id: # if potential user session is this session
for pageId in user_session.pageIds: # for every page of this session
system.perspective.openPopup(payload["id"],'General/Popups/Warning Popup',
params={'Message':payload["message"]},
showCloseIcon = False,
draggable = False,
modal = True,
pageId = pageId)