# Startup window after publishing changes

**URL:** <https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766>\
**Category:** Ignition\
**Created:** [January 9, 2019, 3:50pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766 "2019-01-09T15:50:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 3:50pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/1 "2019-01-09T15:50:37Z")

</div>

When I publish changes right now the main screen is staying on the page it was, prior to the publish, after it reloads. I’d like it to return to the window that is selected for open on startup. I’ve tried a few different things through the property change script to try to force it to swap to the home screen but none of them have worked. Out of curiosity I used the system.nav.getCurrentWindow function and printed the results to the console. In there the results of the print are telling me the window I want to open is the current window even though the actual window that was loaded is the one that was opened prior to publishing changes.

Has anyone run into this before? Any suggestions on how to force it to open the correct 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:** [January 9, 2019, 4:23pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/2 "2019-01-09T16:23:48Z")

</div>

Verify you are ‘swapping’ from open window to main window. Its possible the main window is opening in the background. The getCurrentWindow function will only return the ‘main screen’ even though 2 are open.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 4:30pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/3 "2019-01-09T16:30:22Z")

</div>

I didn’t even think to check if its opening another main window. Even though I’m using the swapTo function it is opening another main window as it restarts. Now the fun is figuring out how to stop it from doing that.

---

<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:** [January 9, 2019, 4:36pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/4 "2019-01-09T16:36:21Z")

</div>

Could use `system.gui.getOpenedWindows()` to get all opened and close the ones you don’t want? Not sure about the timing of your scripts.

---

<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:** [January 9, 2019, 4:44pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/5 "2019-01-09T16:44:17Z")

</div>

One of the windows in your config is not properly defined as a "main" window - all windows are technically the same object, so they are differentiated by properties. To be a proper 'main window' to work with `swapTo`, your window should be:

> A Main window is one that is set to start maximized, and has its Border and Titlebar display policies set to 'When Not Maximized' or 'Never.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 4:47pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/6 "2019-01-09T16:47:50Z")

</div>

These are the settings on the window I have set for the start up window. I also checked one of the screens thats staying up and it is set up the same way.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/91e58e8644a4ff26c347550d3ebd94ee3a4855a5.png)

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 4:49pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/7 "2019-01-09T16:49:34Z")

</div>

I think it may be a timing issue. Using system.nav.getCurrentWindow() in the property change script it cycles twice during start up, the first time it returns none. The second time it returns the window I want loaded.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 9, 2019, 5:07pm UTC](https://forum.inductiveautomation.com/t/startup-window-after-publishing-changes/21766/8 "2019-01-09T17:07:03Z")

</div>

I got it figured out. In my script I needed it to wait for the componentRunning newValue to be true before changing a setting. I added that in and now it loads like I wanted it to. Thank you Nick and PGriffith. Nick getting me to notice it was opening extra windows got me looking in the right direction.
