# Component Scripting - get only a certain type of component from getComponents()

**URL:** <https://forum.inductiveautomation.com/t/component-scripting-get-only-a-certain-type-of-component-from-getcomponents/19940>\
**Category:** Ignition\
**Created:** [October 2, 2018, 9:33pm UTC](https://forum.inductiveautomation.com/t/component-scripting-get-only-a-certain-type-of-component-from-getcomponents/19940 "2018-10-02T21:33:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbraun](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tbraun](https://forum.inductiveautomation.com/u/tbraun)\
**Post date:** [October 2, 2018, 9:33pm UTC](https://forum.inductiveautomation.com/t/component-scripting-get-only-a-certain-type-of-component-from-getcomponents/19940/1 "2018-10-02T21:33:49Z")

</div>

I’d like to get a list of all the check boxes objects within a root container. Is there a way to test for component type?

```auto
win = system.gui.getWindow("Trending/ToolScreens/Trend")

template = win.getRootContainer().getComponent("TrendView").templates

comps = win.getRootContainer().getComponents()

tags = system.tag.browseTags(parentPath = "Trends/Tag History Pens")

param = "TagPath"

x = type(comps[0])

for comp in comps:

	print comp == x

```

---

<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:** [October 2, 2018, 9:41pm UTC](https://forum.inductiveautomation.com/t/component-scripting-get-only-a-certain-type-of-component-from-getcomponents/19940/2 "2018-10-02T21:41:15Z")

</div>

```auto
from com.inductiveautomation.factorypmi.application.components import PMICheckBox
for comp in rootContainer.getComponents():
    if isinstance(comp, PMICheckBox):
        pass # do something

```

Note that technically, you’ll want to call `getComponents()` recursively, and you also need to separate Vision “container-like” components from raw JComponents (all of which have a `getComponents` method).

Class names for the various default components are available [here](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/factorypmi/application/components/package-summary.html).

---

<div class="post-metadata">

**Author:** ![tbraun](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tbraun](https://forum.inductiveautomation.com/u/tbraun)\
**Post date:** [October 2, 2018, 9:47pm UTC](https://forum.inductiveautomation.com/t/component-scripting-get-only-a-certain-type-of-component-from-getcomponents/19940/3 "2018-10-02T21:47:57Z")

</div>

Thank you,

I did just get this to work:

for comp in comps:

```
if 'PMICheckBox' in str(x.getClass()):
```
