# Preload Screens on client Start up

**URL:** <https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141>\
**Category:** Ignition\
**Created:** [August 20, 2010, 4:12am UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141 "2010-08-20T04:12:03Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [August 20, 2010, 4:12am UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/1 "2010-08-20T04:12:03Z")

</div>

Is there a way to pre-load the screens (“windows”) during the client startup. The client starts up quickly, but when navigating to a screen it takes several seconds to load the screen, and there are many red boxes. After the first time loading the screen, the screen loads very quickly if you navigate away and then back to it.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 20, 2010, 3:14pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/2 "2010-08-20T15:14:59Z")

</div>

Well, you can have multiple screens open on startup and on a startup script you can close the ones you don’t need. As long as the windows cache mode is set to Auto or Always it will be quick to open it up the second time. The only thing here is that it will take a few more seconds to start up initially after login.

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 17, 2010, 6:02pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/3 "2010-09-17T18:02:52Z")

</div>

I attempted to do this and it crashed JavaSE. Here is what I did:

In the client startup script I put in the following:

`windows = system.gui.getWindowNames()
for path in windows:
	  if (name!='Header') and (name!='Footer'):
	  	system.nav.closeWindow(path)`

In the project I have all the windows that need to be pre-loaded set to “open on startup”. This script should close all the windows with the exception of the Header and Footer windows. Am I doing something wrong? I got the structure of the code from the sample located in the manual for system.gui.getWindowNames.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 17, 2010, 6:07pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/4 "2010-09-17T18:07:44Z")

</div>

It probably crashed because the script uses a variable called “name” when the variable is really called “path”. Seems odd that this would “crash” the whole system – is that what you’re describing?

Anyhow, the code wouldn’t have worked anyway because the client startup script runs before the windows open. You might simply try putting a delay on that code via an invokeLater(). For example

`def closeUnwanted():
     import system
     windows = system.gui.getWindowNames()
     for path in windows:
          if (path!='Header') and (path!='Footer'):
             system.nav.closeWindow(path)
system.util.invokeLater(closeUnwanted, 1000)`

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 17, 2010, 7:22pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/5 "2010-09-17T19:22:58Z")

</div>

Yes, the name variable didn’t look correct, but the manual shows that as an example.

I tried your script and I get the same issue. What occurs is that the client will load up, but it completely freezes. I have to go into the program manager to force is to shutdown.

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 17, 2010, 8:03pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/6 "2010-09-17T20:03:03Z")

</div>

I did some more testing and the issue is not truly JavaSE freezing, but rather the system is taking so long to load the 16 windows that I need preloaded that it appears to be frozen. I am okay with the startup taking a long time, but the issue is that the rotating circle shown in the top right corner disappears before everything is loaded making it appear that the HMI is up and running. However, the client is still attempting to render all the screens and then close them. If I wait for a long period of time I finally see the loaded screens get closed.

The implementation seems clunky and I generally don’t like depending on timing for doing something like this. I would prefer that the system could pre-load the 16 windows on startup and not continue until all the windows have been cached and then closed.

I need help, the delays in loading and the appearance that a window is loaded, when it isn’t, is causing all kinds of confusion.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 17, 2010, 8:54pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/7 "2010-09-17T20:54:42Z")

</div>

> [@jconnor34](#):
>
> The implementation seems clunky

Well sure. What you're trying to do is a hack - the system wasn't design with this in mind

> [@jconnor34](#):
>
> I need help, the delays in loading and the appearance that a window is loaded, when it isn't, is causing all kinds of confusion.

This isn't a complaint I hear very frequently. Perhaps there is something about the design of your windows that exacerbates the window loading time? Maybe you could describe them?

That said, we are aware that window loading speed isn't exactly stellar. We have a plan to make it faster, but we haven't had a chance to implement it yet. I used to hear these complaints more frequently, but since the last big speedup (a few years ago) they've become more infrequent.

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 17, 2010, 9:51pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/8 "2010-09-17T21:51:01Z")

</div>

I will try and describe this better:  
When I startup the client everything loads and it appears that the HMI is up and running. When the operator presses on a navigation button the screen is loaded but all the graphics on the screen are showing boxes with a light white transparent color. The box has a tag symbol with a green question mark in the top left corner. We only see this when we load a screen the first time. After it is initially loaded we can close it and navigate back to it and it loads instantly. We have timed the screen loading and we have had some screen take up to 11 seconds to load. Some of the screens have no complex images on them and they also take several seconds to load.  
Some of the screens don’t show the tag with the green question mark and they have numeric entry components. The operator presses on the numeric entry and nothing happens. They get very frustrated and then it finally pops up the numeric entry.  
The clients are running on Windows7 dual core processors with 4GB memory. Nothing else is running on these computers. I have four clients, but I am only testing one client at this point.

I would be more than happy to send you my project for you to look at. If I am doing something stupid I would like to understand what it is.

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [September 17, 2010, 10:46pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/9 "2010-09-17T22:46:38Z")

</div>

It seems to me that fixing the 11 second load time on the screen is a better solution than attempting to preload every screen. Check out the simplest (slow) screens first. Do you have slow/complex queries running? Large images? Anything else suspicious?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 18, 2010, 4:55am UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/10 "2010-09-18T04:55:07Z")

</div>

Feel free to send in the project, along with the names of some of the worst offending windows, and I’ll take a look and see if anything jumps out at me. 11 secs is a long time on a reasonably modern client - yours sound more than capable.

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 20, 2010, 10:38pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/11 "2010-09-20T22:38:44Z")

</div>

How should I get the project to you. It appears that I can’t send private attachments to you.

Thanks!

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [September 20, 2010, 10:44pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/12 "2010-09-20T22:44:26Z")

</div>

Upload the file to [http://www.inductiveautomation.com/uploads](http://www.inductiveautomation.com/uploads) with your username as the name and we will get it.

---

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [September 24, 2010, 2:16pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/13 "2010-09-24T14:16:12Z")

</div>

Has anyone had a chance to look at my project?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 28, 2010, 9:51pm UTC](https://forum.inductiveautomation.com/t/preload-screens-on-client-start-up/2141/14 "2010-09-28T21:51:36Z")

</div>

Yes I did - I sent you a PM, I think I need a full backup that includes the images in your Gateway.
