# Reading the names of open windows

**URL:** <https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918>\
**Category:** Ignition\
**Created:** [June 9, 2010, 10:21am UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918 "2010-06-09T10:21:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [June 9, 2010, 10:21am UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918/1 "2010-06-09T10:21:02Z")

</div>

I need to check the names of the currently open windows in a client before opening a new window, so that I can return to the original windows when done.

I tried to use system.gui.getOpenedWindows(), but the name property of each window object doesn’t return the full window path, it only returns the name and misses out the names of folders the window is in.

The system.gui.getWindowNames() function does return the full path, but despite the help file saying `Returns a list of the currently open window names sorted alphabetically.`it actually returns the names of every window in the project, open or not.

Is there any way of returning a list of open windows including their full path?

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [June 9, 2010, 3:46pm UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918/2 "2010-06-09T15:46:01Z")

</div>

The function system.gui.getOpenedWindows() returns window handles, which can be used by the system.nav.openWindow() and system.nav.closeWindow() functions. If you are returning to those windows in the same script this should be sufficient, but there isn’t a good way to store window handles otherwise. Do you need this so you can return after the operator does something else?

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [June 9, 2010, 3:51pm UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918/3 "2010-06-09T15:51:46Z")

</div>

Yes, the operator will be switching out to another window and needs to be able to return to where he started.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [June 9, 2010, 4:54pm UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918/4 "2010-06-09T16:54:27Z")

</div>

Unfortunately this doesn’t currently exist in a system function. I’ll put in a feature request, but in the mean time you can use this code as a workaround.

`#get all the window names
names = system.gui.getWindowNames()
#empty list to be filled with open window names
header = ["name"]
windowList = []
#loop through the names
for name in names:
	try:
		#check if the window is open. this throws a ValueError if not
		system.gui.getWindow(name)
		#append the name (this only executes if there was no error)
		windowList.append([name])
	except ValueError:
		#the window wasn't open, do nothing
		pass
#put the completed list of names into a property on this button
event.source.data = system.dataset.toDataSet(header, windowList)`  
This code will store the paths of the currently open windows to a dataset property on the button pressed.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [June 9, 2010, 7:46pm UTC](https://forum.inductiveautomation.com/t/reading-the-names-of-open-windows/1918/5 "2010-06-09T19:46:19Z")

</div>

Thanks for this workaround, Bobby. I’ll be able to easily adapt it to do what I want.
