# openURL reading address from variable

**URL:** <https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [April 1, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936 "2022-04-01T15:37:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_Higgins](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nathan\_Higgins](https://forum.inductiveautomation.com/u/Nathan_Higgins)\
**Post date:** [April 1, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/1 "2022-04-01T15:37:24Z")

</div>

I am trying to use the open URL command, but I need to read the IP Address for the URL out of a variable. How would I script that?

---

<div class="post-metadata">

**Author:** ![cconnor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cconnor/32/33235_2.png) [@cconnor](https://forum.inductiveautomation.com/u/cconnor)\
**Post date:** [April 1, 2022, 6:07pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/2 "2022-04-01T18:07:43Z")

</div>

Are you referring to the scripting function system.net.openURL? What are you using as a variable to store the IP Address for the URL?

---

<div class="post-metadata">

**Author:** ![Nathan\_Higgins](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nathan\_Higgins](https://forum.inductiveautomation.com/u/Nathan_Higgins)\
**Post date:** [April 1, 2022, 7:08pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/3 "2022-04-01T19:08:05Z")

</div>

![Screenshot 2022-04-01 150747](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/572b3c056b45b6f5b07b17fa4b321e6b4b9bbd3b.png)

I have the IP address shown here is a variable. I want to use this script in a template with a variable reference for the address for different devices the system is connecting to

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 1, 2022, 7:23pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/4 "2022-04-01T19:23:22Z")

</div>

I am having trouble following, you don’t have any variables shown, just a string containing a URL. If you mean you want to pass your template an ip address and build a URL out of that, then that’s easy. Create a parameter in your template and do some string concatenation in your event to form a proper URL.

---

<div class="post-metadata">

**Author:** ![cconnor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cconnor/32/33235_2.png) [@cconnor](https://forum.inductiveautomation.com/u/cconnor)\
**Post date:** [April 1, 2022, 7:35pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/5 "2022-04-01T19:35:03Z")

</div>

> I want to use this script in a template with a variable reference for the address for different devices the system is connecting to

The IP Addresses of the devices connected to Ignition's OPC UA Server can be found using the 'Hostname' [Device Diagnostics Tag](https://docs.inductiveautomation.com/display/DOC81/OPC+UA+Drivers#OPCUADrivers-DeviceDiagnosticTags) created for each device:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/05e18f9b60a61565c46905353e990ba789ad0cfd.png)

You can create an OPC tag through the Tag Browser or you can use [system.opc.read](https://docs.inductiveautomation.com/display/DOC81/system.opc.readValue) within your script with the item path to the 'Hostname' tag, for example 'ns=1;s=[DeviceName][Diagnostics]/Hostname'. This will return the IP Address of the device if you specify it under the 'Hostname' property in the device connection.

---

<div class="post-metadata">

**Author:** ![Nathan\_Higgins](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nathan\_Higgins](https://forum.inductiveautomation.com/u/Nathan_Higgins)\
**Post date:** [April 1, 2022, 7:38pm UTC](https://forum.inductiveautomation.com/t/openurl-reading-address-from-variable/57936/6 "2022-04-01T19:38:14Z")

</div>

The 192.168.59.112 will come from the host name of the device because there will be multiple devices and i want to make a template with a udt
