LESSON

Opening Windows on Startup

Description

Learn how to open a set of windows automatically when a Client is launched.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this video, we are going to take a look at how we can open Vision windows on startup. When building an Ignition project using Vision, you can have quite a few windows. While there is often some sort of navigation scheme that allows users to change what windows are being displayed, we do need to decide on which windows will be opened first when the user logs in. There are two main ways to do this. A built-in method, which allows you to directly pick windows to open on startup, but it doesn't offer any flexibility and will open the same windows every time. Or by using some simple scripting, which can be a little more difficult to set up, but can be more flexible in which windows open when the user logs in. You can see here in my project, I have a handful of windows that are already created. To select which windows to open on startup using the built-in method, I simply need to right click on the window and select Open on Startup.

[01:05] I can do this for as many windows as I want. So in addition to this main window one, I will also set the navigation window to open on startup. I will save and then open my client. Now, regardless of who I log in with, we can see that the navigation window, as well as main window one were both opened initially. Now to have the windows open to be dynamic based on some condition, we will need to use a script instead. I will close my client and go back to the designer. The first thing I want to do is remove the Open on Startup options from my main window one and navigation window. This is so the built-in system doesn't interfere with my script. Once I have done that, I want to go into my client event scripts, where I will find the option to add a startup script. This script runs when the client first starts, which is when the user logs in. Here, I will paste in a simple script.

[02:05] You can see, I am grabbing the username of the logged in user and using that in my comparison. The operator user will have the navigation window and main window one open initially, while everyone else will have the navigation window and main window two open initially. I will again save my project and open my client. I will log in as the admin user, which is not my operator user. And as you can see, main window two and the navigation window were what was opened initially. While I am choosing which windows to open based on the logged in user, you can decide which windows to open using whatever information you like, such as the roles of the user, where they are logging in from, or even what time of day it is.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.