# Client Startup Script

**URL:** <https://forum.inductiveautomation.com/t/client-startup-script/2399>\
**Category:** Ignition\
**Created:** [December 7, 2010, 5:44pm UTC](https://forum.inductiveautomation.com/t/client-startup-script/2399 "2010-12-07T17:44:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shawn\_75](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@shawn\_75](https://forum.inductiveautomation.com/u/shawn_75)\
**Post date:** [December 7, 2010, 5:44pm UTC](https://forum.inductiveautomation.com/t/client-startup-script/2399/1 "2010-12-07T17:44:47Z")

</div>

I am attempting to open and center a popup window on client startup.

```auto
system.nav.openWindow("window1")
system.nav.centerWindow("window1")
```

My window does not center. It does move somewhat from where it would be if I do not attempt to center it with the client startup script. This occurs when the client is set to “Web Start” and also when set to “Web Start Maximized.”

Any ideas?

---

<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:** [December 7, 2010, 7:59pm UTC](https://forum.inductiveautomation.com/t/client-startup-script/2399/2 "2010-12-07T19:59:16Z")

</div>

Well, the centerWindow function will center the popup over the currently maximized window. If you don’t have a maximized window already open it may not work correctly. Try the following code instead:[code]def center(window):  
import system  
try:  
parent = window.parent  
if parent != None:  
window.setLocation(parent.width/2 - window.width/2, parent.height/2 - window.height/2)  
except ValueError:  
pass

window = system.nav.openWindow(“Window”)  
center(window)[/code]You can make the center function a global script module function that you can use everywhere.
