# Getting Component Values From Script

**URL:** <https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093>\
**Category:** Ignition\
**Created:** [June 25, 2019, 8:10pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093 "2019-06-25T20:10:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [June 25, 2019, 8:10pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/1 "2019-06-25T20:10:15Z")

</div>

hello. I am currently trying to get the value of a checkbox that exists in a window from a script. However, I am having trouble with an error that notes "window (xyz) is not currently open.". Has anyone been able to perform this? How so?

This is the code statement causing the error:

> system.gui.getWindow("DataLoad").rootContainer.getComponent("ChkBoxDepartment").selected

---

<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:** [June 25, 2019, 8:16pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/2 "2019-06-25T20:16:31Z")

</div>

Your syntax is correct. The error seems obvious. If the DataLoad window isn’t open, there’s no checkbox.

---

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [June 25, 2019, 8:27pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/3 "2019-06-25T20:27:46Z")

</div>

The window is definitely open as the scripting function is being called from a button on that window.

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [June 25, 2019, 8:46pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/4 "2019-06-25T20:46:49Z")

</div>

While your syntax seems correct, if the button is on the same window as the as the checkbox, you can simplify your call by doing:

```auto
system.gui.getParentWindow(event).getRootContainer().getComponent('ChkBoxDepartment').selected

```

Edit: Changed the selector to one that is more likely going to work in more cases.

---

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [June 25, 2019, 9:29pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/5 "2019-06-25T21:29:21Z")

</div>

Right. And I have that working. But I am looking to move the code you mentioned to a script, which means I need to use the Open Window I originally posted.

---

<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:** [June 25, 2019, 9:32pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/6 "2019-06-25T21:32:09Z")

</div>

Are you _sure_ that the **name** of the window is exactly `DataLoad`? Is it inside of any folders, maybe?

---

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [June 26, 2019, 12:18pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/7 "2019-06-26T12:18:12Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0f5dacc0bc73c746c630170569ba1b9f5718a633.png)

Maybe there is something I am missing? I am relatively new to Ignition. Do I need to include Project/Main Windows/DataLoad??

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 26, 2019, 2:45pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/8 "2019-06-26T14:45:03Z")

</div>

You are missing **Main Windows** /DataLoad. Right click on your window and select Copy Path.

---

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [June 26, 2019, 5:42pm UTC](https://forum.inductiveautomation.com/t/getting-component-values-from-script/26093/9 "2019-06-26T17:42:24Z")

</div>

Thank you!
