You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
LESSON
Open Dynamic Window(s) on Startup
Description
Learn how to open a dynamic set of windows when a client is opened based on a hostname, IP address, user, and more using the Client Event Startup Script.
Video recorded using: Ignition 7.7
Transcript
(open in window)[00:00] Rather than opening up a static set of windows on startup, it is possible to open up a dynamic set of windows based on a host name or an IP address or a user who's logged in and more. The first thing we want to do is make sure that all of the windows in the designer are set to not open on startup. Here I have two windows, main window one and navigation, that both have the icon to the right-hand side that are set to open on startup. I want to right-click to uncheck the open on startup flag for both of these. The reason I'm doing this is I don't want Ignition to control which windows get opened. I want to control which windows get opened. If I save this right now and open up the runtime, I won't see any windows open on startup. It'll be blank. What I want to do is control which windows get opened based on a condition and I can do that in a startup script. I go up here to Project, Client Event Scripts, and there's a startup script that will run as soon as the user logs into the runtime. From here I can grab the host name, the IP address, the user who's logged in, the roles user has, whatever, and do condition statements to open up a different set of windows based on something here. Here's an example. I can grab the host name from the tag and if the host name is equal to host one, I can open up main window one and the pop-up window. Otherwise, I can open up the navigation window and main window two. I can open up two different sets of windows here based on the host name. You can put whatever conditions you want here, but you want to make sure that you swap to main screens and the open windows for pop-ups and docked windows. That's why I'm swapping here to the main windows because that's the background main screen's going to fill in the rest of the space there. As soon as you get this in place and press OK and save your project, when you launch the runtime, depending on the host name, that's what I'm using here, I'll open up either a different set of windows, and my host is not host one so I should get to the second set, main window two and the navigation window. As soon as I log in, I will see my navigation window and main window two here. If I was opening this client up somewhere else, I would see a different set of windows potentially.