# How to put a UDT variable in a script

**URL:** <https://forum.inductiveautomation.com/t/how-to-put-a-udt-variable-in-a-script/88479>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [April 7, 2024, 3:06pm UTC](https://forum.inductiveautomation.com/t/how-to-put-a-udt-variable-in-a-script/88479 "2024-04-07T15:06:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Crawford](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Ryan\_Crawford](https://forum.inductiveautomation.com/u/Ryan_Crawford)\
**Post date:** [April 7, 2024, 3:06pm UTC](https://forum.inductiveautomation.com/t/how-to-put-a-udt-variable-in-a-script/88479/1 "2024-04-07T15:06:27Z")

</div>

Good Morning Everybody,

I know this is been answered a few times but do have some trouble understanding, so apologies in advance.

I need to read and write to UDT tags that I want to put into a script. The tags are under the "default" tag provider, and the UDT path would be something like Folder1, Folder2, Folder3, UDT instance, UDT tag.

I have had a look at the documentation online but still am having no luck. Any help with this would be great.

Thanks.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [April 7, 2024, 3:10pm UTC](https://forum.inductiveautomation.com/t/how-to-put-a-udt-variable-in-a-script/88479/2 "2024-04-07T15:10:52Z")

</div>

Did you look at `system.tag.readBlocking` and `system.tag.writeBlocking`?

> **[system.tag.readBlocking | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-readBlocking)**
>
> Reads the value of the tags at the given paths.

> **[system.tag.writeBlocking | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-writeBlocking)**
>
> Writes values to tags at the given paths.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 7, 2024, 3:16pm UTC](https://forum.inductiveautomation.com/t/how-to-put-a-udt-variable-in-a-script/88479/3 "2024-04-07T15:16:39Z")

</div>

The easiest way to get going on the UDT tag paths is to treat them like any other tag.

- Go to the tag browser, find your UDT instance, expand as required, right-click on the required tag in your UDT structure and select Copy Path.
- Paste that value into the list of tag paths in the functions @jlandwerlen has pointed you towards.

You can, of course, then modify the tag path by script with the machineId, or whatever.
