I have a customer that runs dual monitors on each computer, so we run 2 clients sessions on the computer, one fore each screen.
My question or challenge is that when the system runs a client script it runs on both screens. Is there a way to seperate/differentiate between the 2 client sessions so that the scripts run on a single client or the client of choice?
There are probably a number of things you could do, but the best way would probably depend a lot on how you wanted it to work. There are probably also a ton of tiny details to work out. But, without getting too bogged down, let me throw some ideas out:
First off, the system.util.getClientId() function is going to come into play somewhere. This provides the unique id for each session. Additionally, the system.util.getSessionInfo function might be useful, and maybe some others.
The easiest thing that comes to mind:
- Create two memory tags, one for “ControllingSessionId” (string) and one for “ControllingSessionHeartbeat” (date, or long).
- Create a timer script to “check the state”:
o If this session is active, update the heartbeat to the current time.
o If this session is not active, and the heartbeat is more than 10 seconds old (or whatever), write this session id to the tag, and update the heartbeat
- In each script, call an app module function that checks if the current session is the active session, and if not, exit the script.
This system could be augmented with a button that says “make this session the controller”, which simply writes its id to the tag.
As I said, there are probably several other ways to do this, but this was the first that came to mind.