Open Dynamic Windows on Startup
Open Window(s) on Startup
Watch the videoSometimes a project needs to change its startup windows depending on who logged in, what security roles they have, or what computer the Client is launched on. In these cases, rather than setting a static startup window, you can write a Client Startup Script that uses the system.nav
library to open a dynamic set of windows based on hostname, IP address, and user who logged in.
This means you will remove the Open on Startup option from some or all of your windows and use a Client Startup Script to determine which windows will be opened. Typically, you will set your navigation window to Open on Startup, but decide on a main window in the startup script. The example below checks the users role before opening a window.
Code Snippet - Client Startup Role Check
# Checks the users role and opens a main window depending on the role
# Grabs a list of the users roles
roles = system.security.getRoles()
# Checks if they have Administrator role
if 'Administrator' in roles:
system.nav.openWindow('Administrator Screen')
# Checks if they have Operator role
elif 'Operator' in roles:
system.nav.openWindow('Operator Screen')
# If they have neither Administrator or Operator
else:
system.nav.openWindow('Welcome Screen')