Can anyone suggest how to get the session custom property and the logged in user name in the gateway timer script?
Thanks
Can anyone suggest how to get the session custom property and the logged in user name in the gateway timer script?
Thanks
Gateway scripts will be in a different scope (gateway scope rather than session scope), and will not be tied to a particular session. The script would not know which session to target.
What are you trying to achieve with the script?
You could possibly do this using system.perspective.getSessionInfo and system.util.sendRequest. (Links are to IA docs.)
It looks like calling system.perspective.getSessionInfo()
returns a list of objects. Each object represents one session and includes the session ID, username, project, and lots of other information. You could send a request using system.util.sendRequest
to each Session that's running an appropriate project. That project would need to have a message handler that was configured to send back the custom property you're trying to acquire.
All that said, I echo @Daniel.Snyder in asking, "What are you trying to achieve?" There's maybe a more elegant solution than what I've described here.
The machines are categorised under different module. The selected module information will be there in session. I need to open the popup if there is any alarm for the selected equipment. Currently opening popup is handled in timer script. In timer script i need to fetch the selected machine information from the session custom property.
"Currently" meaning some other HMI that you are trying to duplicate? Standalone HMIs don't have multi-user capabilities and don't have any notion of "scope". Ignition does.
In Ignition, opening popups must happen in a client/session scope. Full stop.
Developing Application in perspective. Currently alarm popup is displaying for all machines. But I need to open the popup for only the selected machines. Selected machine information will be there in session custom property.
Have the timer event send a message to your sessions (using system.util.sendMessage
with scope='S'
) and have the session message handler examine the custom property. Include enough information in the message for that message handler to make the decision about opening the popup.
Its working. Thanks