# On Client Startup Open previous windows Multi Monitor

**URL:** <https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 9, 2024, 8:58pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981 "2024-07-09T20:58:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melvin\_Miclat](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Melvin\_Miclat](https://forum.inductiveautomation.com/u/Melvin_Miclat)\
**Post date:** [July 9, 2024, 8:58pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/1 "2024-07-09T20:58:18Z")

</div>

Im trying to set up Multi Monitor and would like to open up screen that is previously open before exit or shutdown.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 9, 2024, 9:18pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/2 "2024-07-09T21:18:15Z")

</div>

Haven't done this before, my initial thought would be to "export" the config to some sort of external file when the client shuts down and then read the same file when it starts up.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 9, 2024, 10:20pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/3 "2024-07-09T22:20:30Z")

</div>

Database. I imagine that the client and desktop handle names could be inserted or updated on window close, and then, they could be retrieved during the client startup script.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 9, 2024, 10:24pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/4 "2024-07-09T22:24:07Z")

</div>

I've done this on a project before, but it's a bit complex.

First, make sure all of your secondary desktops you've opened have a naming convention similar to "Desktop #", so in mine, the primary is always named "primary", but the secondary desktops are named "Desktop 1", "Desktop 2", and "Desktop 3" for a quad-screen setup.

I had ours also set up to track per computer settings, but to simplify this example, I'll leave that out.

You'll need a memory string array tag that needs to be at least as large as the number of screens you will be tracking (I think I set ours to 10 even though we only have/use 4)

I have function in a project script `Vision.Navigation`:

```python
def updateActiveWindowList(deskHandle, event):
	'''
	Updates the client window array with new values on window navigation
	
	Args:
		deskHandle (str): Desktop handle to update (Should be in the format "Desktop #")
		event: Event called by VisionOpenWindow
		
	'''
	
	deskIndex = 0 if deskHandle == 'primary' else int(deskHandle[8:])
	tagPaths = ['OpenedWindows[%d]' % deskIndex]
	system.tag.writeAsync(tagPaths, [event.source.path])

```

That script is called from the `visionWindowOpened` event handler on each main window with this:

```python
Vision.Navigation.updateActiveWindowList(system.gui.getCurrentDesktop(), event)

```

Then on the client startup script when opening all the desktops, I read in this tag value and populate each desktop based on the index of the desktop with a fallback/default window if it's blank.

---

<div class="post-metadata">

**Author:** ![Melvin\_Miclat](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Melvin\_Miclat](https://forum.inductiveautomation.com/u/Melvin_Miclat)\
**Post date:** [July 9, 2024, 10:52pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/5 "2024-07-09T22:52:07Z")

</div>

Thank you. This helps a lot. I will try to apply what you have here.

---

<div class="post-metadata">

**Author:** ![Melvin\_Miclat](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Melvin\_Miclat](https://forum.inductiveautomation.com/u/Melvin_Miclat)\
**Post date:** [July 11, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/6 "2024-07-11T19:20:22Z")

</div>

Hi Michael,

I'm not sure where to put the scripts that you showed here?

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 11, 2024, 7:49pm UTC](https://forum.inductiveautomation.com/t/on-client-startup-open-previous-windows-multi-monitor/92981/7 "2024-07-11T19:49:19Z")

</div>

The `updateActiveWindowList` is in a script file here on my project:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/e/be52bfcb5a5cb4c63b2ae026875914f512144f27.png)

And the one-line is calling that script in the `visionWindowOpened` event handler on the main view for each screen:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5a5415a001c314fbbde022db90f54b28eb9b6269.png)
