# Client IP Address in Script

**URL:** <https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235>\
**Category:** Ignition\
**Created:** [May 8, 2017, 9:25pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235 "2017-05-08T21:25:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayden](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Jayden](https://forum.inductiveautomation.com/u/Jayden)\
**Post date:** [May 8, 2017, 9:25pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235/1 "2017-05-08T21:25:32Z")

</div>

Hi All,

I have a number of popup screens that are triggered to open from a Tag Value Change. At the moment these popups open on all clients. I’d like to only have the popup open on the relevant client. I have tried to use the Client IP address as a way to isolate the popup to a specific client, however it does not seem to work. Please see my Scripts below. Can anyone help get this to work?

**Before Change (Was working and opening on all clients)**

```
if currentValue.value==1:
	if previousValue.value==0: 
		system.nav.openWindow('Popups/Prompts/B_Prompt_2')
		system.nav.centerWindow('Popups/Prompts/B_Prompt_2')

```

**After Change (Not working at all)**

```
if "[System]Client/Network/IPAddress" is "169.254.223.201":
	if currentValue.value==1:
		if previousValue.value==0: 
			system.nav.openWindow('Popups/Prompts/B_Prompt_2')
			system.nav.centerWindow('Popups/Prompts/B_Prompt_2')
```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 8, 2017, 9:45pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235/2 "2017-05-08T21:45:46Z")

</div>

You will need to read the IP Address tag to use it in your script; at the moment, your code is checking that the string “[System]Client/Network/IPAddress” is an instance of the literal string “169.254.223.201”; which is what’s failing.

Switch to using system.tag.read() and the rest of the code should work:

```auto
if system.tag.read("[System]Client/Network/IPAddress").value == "169.254.223.201":
	if currentValue.value==1:
		if previousValue.value==0: 
			system.nav.openWindow('Popups/Prompts/B_Prompt_2')
			system.nav.centerWindow('Popups/Prompts/B_Prompt_2')

```

---

<div class="post-metadata">

**Author:** ![Jayden](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Jayden](https://forum.inductiveautomation.com/u/Jayden)\
**Post date:** [May 8, 2017, 10:35pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235/3 "2017-05-08T22:35:54Z")

</div>

Excellent, Ill give it a go

Thanks for the help,

---

<div class="post-metadata">

**Author:** ![accyroy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/accyroy/32/3386_2.png) [@accyroy](https://forum.inductiveautomation.com/u/accyroy)\
**Post date:** [May 9, 2017, 3:00pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235/4 "2017-05-09T15:00:32Z")

</div>

Just in case this doesn’t work for you, I’ve found linux clients do not report the correct IP address, they report the loopback address. If you have linux clients or may have in the future it might be worth basing this off of hostname which is reported correctly from any OS.

---

<div class="post-metadata">

**Author:** ![heybales](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/heybales/32/3358_2.png) [@heybales](https://forum.inductiveautomation.com/u/heybales)\
**Post date:** [May 9, 2017, 6:52pm UTC](https://forum.inductiveautomation.com/t/client-ip-address-in-script/14235/5 "2017-05-09T18:52:55Z")

</div>

I agree on using Hostname.

Also, there is a nice method for doing this described in Inductive University.  
[https://inductiveuniversity.com/video/custom-security?r=/course/security](https://inductiveuniversity.com/video/custom-security?r=/course/security)
