Hello. Im working in a cell that has several panels on each side of the machine.
As you can either control the machine from the left or right side, we created two overview screens with a mirrored version of the layout.
I would like to know if there is a way to know which panel you are opening the project in and create a script so the correct window is automatically opened after the project launches. Is there a client tag or any other way to identify the different panels the system is connected to? Probably by their IP address or something?
I do this all the time, but really don't care to try to match an IP, or hardware identifier.
I just use a blank text file, in a directory I name "hmiconfig". If there is no config file there, I open a popup to allow selecting the role of the terminal, and create the file
def Open_Client_Home():
import os
for window in system.gui.getOpenedWindows():
system.nav.closeWindow(window.getPath())
dir = "C:\hmiconfig"
if not os.path.exists(dir):
os.makedirs(dir)
system.nav.openWindow("Popups/Role_Select")
system.nav.centerWindow("Popups/Role_Select")
else:
if system.file.fileExists("c:\\hmiconfig\\E1.txt"):
windowPath = "Local_HMIs/E1/Startup"
system.tag.write("[client]Path/Machine/HMI_Role", "E1")
system.nav.openWindow(windowPath)
elif system.file.fileExists("C:\\hmiconfig\\E2.txt"):
windowPath = "Local_HMIs/E2/Startup"
system.tag.write("[client]Path/Machine/HMI_Role", "E2")
system.nav.openWindow(windowPath)
else:
system.tag.write("[client]Path/Machine/HMI_Role", "None")
system.nav.openWindow("Popups/Role_Select")
system.nav.centerWindow("Popups/Role_Select")
It's easy to implement, easy to set a role, or even modify it on the fly, if you move the terminal, or have a crash of another one
thank you all for your feedback!
In the end I did something even easier. Just had to put the content of both windows into a container and then copied one of those containers in the other window. Then I just used a simple if expression with the System tag that stores the IP address of the panel to enable the visibility of each container. It's such an easy solution for beginners and also for lazy people. In my case, I am both...
if ({[System]Client/Network/IPAddress.Value} = 'IP ADDRESS',1,0)