# Restrict Application to open once

**URL:** <https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687>\
**Category:** Ignition\
**Created:** [April 12, 2018, 2:34pm UTC](https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687 "2018-04-12T14:34:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hp1](https://avatars.discourse-cdn.com/v4/letter/h/34f0e0/32.png) [@hp1](https://forum.inductiveautomation.com/u/hp1)\
**Post date:** [April 12, 2018, 2:34pm UTC](https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687/1 "2018-04-12T14:34:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 12, 2018, 5:12pm UTC](https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687/2 "2018-04-12T17:12:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [April 12, 2018, 6:42pm UTC](https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687/3 "2018-04-12T18:42:08Z")

</div>

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.

```auto
# 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

```

---

<div class="post-metadata">

**Author:** ![hp1](https://avatars.discourse-cdn.com/v4/letter/h/34f0e0/32.png) [@hp1](https://forum.inductiveautomation.com/u/hp1)\
**Post date:** [April 12, 2018, 7:09pm UTC](https://forum.inductiveautomation.com/t/restrict-application-to-open-once/17687/4 "2018-04-12T19:09:04Z")

</div>

Thank you Duffanator! It works great.
