# How to get window custom property for each window Instances

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224>\
**Category:** Ignition\
**Tags:** vision, perspective\
**Created:** [October 14, 2022, 10:09am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224 "2022-10-14T10:09:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![snehal.raj](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@snehal.raj](https://forum.inductiveautomation.com/u/snehal.raj)\
**Post date:** [October 14, 2022, 10:09am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/1 "2022-10-14T10:09:19Z")

</div>

I have a used a custom property of window to find weather that window is pinned or not.  
When i click on Button, it go through below script and find all opened window, points to the custom property.  
However for the instance of same window it doesn't work. it reads the same value as previous for instance of window.

#Get Windows name that button is on  
WindowName = system.gui.getParentWindow(event)  
#Get Current maximize window name  
CWindowName = system.nav.getCurrentWindow()  
#Convert to String  
stringsearch = str(WindowName)

#Check if it a drop Menu configuration  
if event.source.parent.parent.DropMenu==False:  
#This is NOT a drop menu  
#Search String for drop menu, then close drop menu  
if stringsearch.find("Menu\_") \> -1:  
#Close Parent window  
system.nav.closeWindow(WindowName)

```
#Close All open Pop ups # change v2.1.221012
 #Get all open window names
windows = system.gui.getOpenedWindowNames()
#system.gui.messageBox( 'There are %d windows open' % len(windows))
for path in windows:
	 window= system.gui.getWindow(path)
	 system.gui.messageBox( str(window))
	 if path != CWindowName and window != WindowName :
	 	WinPinned= window.getRootContainer().temp_WinPin
	 	system.gui.messageBox( str(WinPinned))
		if WinPinned is False:
			system.nav.closeWindow(window)

```

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

---

<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:** [October 14, 2022, 12:29pm UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/2 "2022-10-14T12:29:41Z")

</div>

Don't use `system.gui.getOpenedWindowNames()`. That obviously can't distinguish between multiple windows of the same name. Instead, use `system.gui.getOpenedWindows()`, which delivers all of the window **objects** present. Check each window **object**'s `.path` property to see which it is. Use that object's `.rootContainer` to then inspect its contents.

---

<div class="post-metadata">

**Author:** ![snehal.raj](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@snehal.raj](https://forum.inductiveautomation.com/u/snehal.raj)\
**Post date:** [October 18, 2022, 7:01am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/3 "2022-10-18T07:01:02Z")

</div>

Thanks. Its working now!

---

<div class="post-metadata">

**Author:** ![snehal.raj](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@snehal.raj](https://forum.inductiveautomation.com/u/snehal.raj)\
**Post date:** [November 8, 2022, 11:13am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/4 "2022-11-08T11:13:47Z")

</div>

Hi, I want to do the same thing in Perspective.  
what can I use instead of "system.gui.getOpenedWindowNames()", as this not perspective supported function.

---

<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:** [November 8, 2022, 1:10pm UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/5 "2022-11-08T13:10:31Z")

</div>

Perspective doesn't have windows. It has pages and views. Look under the `system.perspective.` section of the manual for alternatives. (They won't work the same way. That is, you won't get page or view **objects**. Perspective doesn't expose those.)

---

<div class="post-metadata">

**Author:** ![snehal.raj](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@snehal.raj](https://forum.inductiveautomation.com/u/snehal.raj)\
**Post date:** [November 30, 2022, 6:55am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/6 "2022-11-30T06:55:56Z")

</div>

Hi,

I write down following script to find open Pages in Current Session.  
See Attached image.  
though I can only list PageIds for open pages.  
How can I access each page using this page ID list.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c00bc3244f1242eaf709f333450c865a91901b80.png)

---

<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:** [November 30, 2022, 1:41pm UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/7 "2022-11-30T13:41:51Z")

</div>

> [@snehal.raj](#):
>
> How can I access each page using this page ID list.

You can't. Perspective only exposes its objects **within** the relevant environment. Send a message with the proper scope to each page. Do the per-page logic in a message handler within the page.

---

<div class="post-metadata">

**Author:** ![snehal.raj](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@snehal.raj](https://forum.inductiveautomation.com/u/snehal.raj)\
**Post date:** [December 12, 2022, 7:19am UTC](https://forum.inductiveautomation.com/t/how-to-get-window-custom-property-for-each-window-instances/65224/8 "2022-12-12T07:19:35Z")

</div>

Hi,

Can you Elaborate more?  
I just need any popup (View instance) to be identified for closing it when change main window/view.
