# How to know the position of a component from the sctript editor in vision

**URL:** <https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732>\
**Category:** Ignition\
**Tags:** vision, ignition80\
**Created:** [January 6, 2022, 4:27pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732 "2022-01-06T16:27:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jigarcia](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jigarcia](https://forum.inductiveautomation.com/u/jigarcia)\
**Post date:** [January 6, 2022, 4:27pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/1 "2022-01-06T16:27:09Z")

</div>

In vision, I need to know the x, y position of a component using the script editor to save it for future use, what function can I use?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 6, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/2 "2022-01-06T16:32:16Z")

</div>

I’m going to show you how you can dig down into the functions available on a component.

In designer open the window that has the components you want to look at.

Then open your script console (Tools-\>Script console)

Try the following -

```auto
win = system.gui.getWindow("TheWindowName")
rc = win.getRootContainer()

for component in rc.components:
    firstComponent = component
    break
print dir(firstComponent)

```

This will print out all the available methods and properties on the component. I just tested it with a label component and found that they have a `.x` and `.y` property so I could have done this after the initial script

```auto
print firstComponent.x
print firstComponent.y

```

and that prints out the x/y pixles of the placement of it.

Alternatively, manually, you can always right click a component and select Size/Position and it will give you the x/y as well.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [January 6, 2022, 4:53pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/3 "2022-01-06T16:53:02Z")

</div>

> [@bkarabinchak.psi](#):
>
> I’m going to show you how you can dig down into the functions available on a component

@pturmel wrote a script function that does this pretty conveniently. I don't use it much, so I don't know if it works with modern Ignition (8+), but it might be worth checking out.

> [@Finding all available methods from a component](https://forum.inductiveautomation.com/t/finding-all-available-methods-from-a-component/9670/8):
>
> The introspection script has evolved over time, particularly to return a string result instead of just printing. I found that useful for introspection in gateway scope using runScript() in an expression tag. Or to set the .text property of a scrollable text edit field for convenience. This is what it looks like today: # Introspection for Jython/Java # # Copyright 2008-2016 Automation Professionals, LLC \<sales@automation-pros.com\> # # Redistribution and use in source and binary forms, with or…

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 6, 2022, 5:00pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/4 "2022-01-06T17:00:59Z")

</div>

Yea that’s a nice function. Doing `dir` directly is the quick/dirty way to see all methods/properties available on a python object. His is a more explicit about what is a method and what is a property which is definitely useful.

---

<div class="post-metadata">

**Author:** ![jigarcia](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jigarcia](https://forum.inductiveautomation.com/u/jigarcia)\
**Post date:** [January 6, 2022, 5:10pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/5 "2022-01-06T17:10:46Z")

</div>

I think it does not work in the script console because it generates the error: Window Proof is not currently open.

even if the window that tells me is open.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 6, 2022, 5:11pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/6 "2022-01-06T17:11:50Z")

</div>

It’s open in the designer at the time of running your script? Try copy and pasting the window path.

Also you can always right click the component and check size/position.

---

<div class="post-metadata">

**Author:** ![jigarcia](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jigarcia](https://forum.inductiveautomation.com/u/jigarcia)\
**Post date:** [January 6, 2022, 5:38pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/7 "2022-01-06T17:38:29Z")

</div>

Iindeed, I put the path of the window wrong, thank you very much! it worked perfectly after correcting it

---

<div class="post-metadata">

**Author:** ![jigarcia](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jigarcia](https://forum.inductiveautomation.com/u/jigarcia)\
**Post date:** [January 6, 2022, 6:27pm UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/8 "2022-01-06T18:27:54Z")

</div>

So instructive, thank you very much for your help

---

<div class="post-metadata">

**Author:** ![A\_Power](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@A\_Power](https://forum.inductiveautomation.com/u/A_Power)\
**Post date:** [September 7, 2023, 2:16am UTC](https://forum.inductiveautomation.com/t/how-to-know-the-position-of-a-component-from-the-sctript-editor-in-vision/54732/9 "2023-09-07T02:16:41Z")

</div>

Legend.
