# Window Open / Close Script

**URL:** <https://forum.inductiveautomation.com/t/window-open-close-script/19982>\
**Category:** Ignition\
**Created:** [October 4, 2018, 9:57pm UTC](https://forum.inductiveautomation.com/t/window-open-close-script/19982 "2018-10-04T21:57:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayden](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Jayden](https://forum.inductiveautomation.com/u/Jayden)\
**Post date:** [October 4, 2018, 9:57pm UTC](https://forum.inductiveautomation.com/t/window-open-close-script/19982/1 "2018-10-04T21:57:37Z")

</div>

Hi All,

I’m having a little trouble with a script and i’m hoping to get some assistance.

I have a Tabbed Navigation project. As part of the project I have a few docked windows that I would like to only open when certain Tabs are selected.

I have added a property change script on my First Tier Tabs as follows, however it does not seem to be functioning (docked windows are always closed). Any ideas?

```auto
if system.gui.getParentWindow(event).getComponentForPath('Root Container.First Tier Tabs').name == "Butter":
	system.nav.closeWindow('Milk CIP Docked Window')
	system.nav.closeWindow('Milk Production Docked Window')

elif system.gui.getParentWindow(event).getComponentForPath('Root Container.First Tier Tabs').name == "Milk":
		system.nav.openWindow('Milk Production Docked Window')
		
else: system.nav.closeWindow('Milk CIP Docked Window')

```

---

<div class="post-metadata">

**Author:** ![nick.schuetz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nick.schuetz/32/6160_2.png) [@nick.schuetz](https://forum.inductiveautomation.com/u/nick.schuetz)\
**Post date:** [October 4, 2018, 11:58pm UTC](https://forum.inductiveautomation.com/t/window-open-close-script/19982/2 "2018-10-04T23:58:24Z")

</div>

If you want to open the windows from the tab, you could use a property change script on the tab object where:

```auto
if event.propertyName == 'selectedTab'
    if newValue == 'Butter':
        system.nav.openWindow('Milk CIP Docked Window')

```

On every tab property change you can check if you want the window opened or closed.

However, I wouldn’t recommend opening and closing docked windows. Usually they are open the entire time. You could put the information from the docked window into a template and just place it on the screens you want it on.

---

<div class="post-metadata">

**Author:** ![Jayden](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Jayden](https://forum.inductiveautomation.com/u/Jayden)\
**Post date:** [October 6, 2018, 3:39am UTC](https://forum.inductiveautomation.com/t/window-open-close-script/19982/3 "2018-10-06T03:39:27Z")

</div>

Thanks Nick,

I’ll give this a try
