I’m setting up a script to populate a drop down box with a list of available windows. So far, the script correctly finds all the windows in a specific folder and displays the path of the window.
What I’d like to do is .name property off the window as that holds a more descriptive name of the window. Is there a way to get that property name without the window being open? The only method I know if is the system.gui.getWindow(name), but that only works provided the window is already opened.
(I’m using Ignition 7.6, but would be interested in know if later one could do it as well)
Looking into it, I think the technique(s) in this thread might be the only option - though I will reiterate as I did there that something you get working in 7.6 has no guarantee of working on a newer version of Ignition. Plus, adapting Nick’s project to 7.6 could be its own set of headaches.
Hmm… thanks Paul, that certainly is an impressive way of doing it. I do want to make sure this stays largely future resilient, for the time being I’m giving my window names more descriptive titles. For now at least I’m using this basic setup that runs once when the screen is first loaded
# Populate the Dropdown menu
#Get all windows in project
windows = system.gui.getWindowNames()
dDown = system.gui.getParentWindow(event).getComponentForPath('Root Container.PIC_SELECT.Dropdown')
#create an index variable
i = 0
# Examine each Window and only add it to dropdown menu provided it is
# in the "Screens" folder
for path in windows:
# Examine only the first 7 characters
if path[:7] == "Screens":
# Index Value, Screen Name, Path to screen
newRow = [i, path[8:], path]
# Add row to Dropdown Box
dDown.data = system.dataset.addRow(dDown.data, newRow)
# Increment index location
i += 1
1 Like