Restrict Application to open once

Is there a way to restrict the user to launch the application only once? thanks

Yes, you can use a client startup event script to check the sessions returned by system.util.getSessionInfo(), and if any other client has the same project open, exit. A message box before exiting might be useful to show where the other client is running.

Here’s what I’ve done in our systems. This gives the option to close the client or not, usefull if you have a designer open because it counts that as an open client.

# Check to see if there is already an Ignition client open on this PC. Trying to cut down on multiple clients open on one machine.
projName = system.util.getProjectName()
hostName = system.tag.read("[System]Client/Network/Hostname").value
sessionInfo = system.util.getSessionInfo()

rowIndex = 0
clientCount = 0
for row in sessionInfo:
	if sessionInfo[rowIndex][1] == projName and sessionInfo[rowIndex][2] == hostName:
		clientCount += 1
		if clientCount > 1:
			if system.gui.confirm("There is already a client open on this PC, do you want to close this client?", "Client Already Running"):
				system.util.exit()
			break
	rowIndex += 1
1 Like

Thank you Duffanator! It works great.