Prevent opening 2nd instance of pop-up with same parameter

I am using a pop up with a custom property to pass an integer representing a machine number.

There are groups of up to five of these machine icons on several main windows.

When the user clicks on one of the icons, the pop-up is opened and the integer is passed to the pop-up and all of this is working well. The title of the popup contains a reference to the integer and so the window name as shown under navigation also shows that value.

I want the user to be able to open multiple instances of the window, but not multiple instances of pop-ups with the same machine number.

I am not having much luck figuring out a script to handle this. When I use system.gui.getOpenedWindows(), the tuple returned contains the same strings for all instances whether or not they were opened with unique values.

Is there a way to determine if a particular instance with a certain custom property value has already been opened?

Perhaps there is a way to use memory tags or something as flags that can be set when a pop up is opened. Or if there is a script that can identify the ‘Number’ within the opened pop-ups to skip re-opening them.


This topic might help you. TL;DR getOpenedWindows() returns the actual window objects. You can look at each window’s rootContainer properties in a loop to locate a duplicate.

You shouldn’t need to use client tags or anything like that. Maybe you can share a screenshot of the script you are using to open your window. You should be using a script with

system.nav.openWindowInstance(windowpath [, parameters])

So for each machine you would have a script of

system.nav.openWindowInstance("Machine Popup" {machineNum:3}) system.nav.openWindowInstance("Machine Popup" {machineNum:4}) system.nav.openWindowInstance("Machine Popup" {machineNum:5})

I have deployed the system with multiple instances disabled. When I am back on site (probably next week) I will try to get some screen shots of the details and try your suggestions.


I hope you have any idea about my concern, I write a script which is used to instantiate Valve Popup Window ds script below works very well when using the system.nav.openWindow. If I will used the system.nav.openWindowInstance it wont work properly. It will only read my Auto Popup location script only once. when i clicked again the next valve popup instance does not follow the exact x,y location of pop window.


script00 = event.source.NV
script01 = event.source.ValveName
script02 = event.source.ValveType

window = system.nav.openWindowInstance(‘Popups/Valve Popup_Common’, {‘NV’ : script00, ‘ValveName’ : script01, ‘ValveType’ : script02})
window = system.nav.openWindow(“Popups/Valve Popup_Common”)

##for relx
if event.source.parent.x < 960:
x = (event.source.parent.x) + (20)
((event.source.parent.x)+(20)+(381)) < 1920
x = (event.source.parent.x)+(20)

if event.source.parent.x < 960:
x = (event.source.parent.x) + (60)
((event.source.parent.x)+(20)+(381)) > 1920
x = (event.source.parent.x) - ((20)+(381))

##for rely
if event.source.parent.y < 453:
y = (event.source.parent.y) + (20)
((event.source.parent.y)+(20)+(278)) < 905
y = (event.source.parent.y)+(20)

if event.source.parent.y < 453:
y = (event.source.parent.y) + (40)
((event.source.parent.y)+(20)+(278)) > 905
y = (event.source.parent.y) - ((278)-(90))

window = system.gui.getWindow(“Popups/Valve Popup_Common”)

This should have been a new topic, but anyways:
Don’t use getWindow() if you already have the window in a variable, which you do. Just remove the linewindow = system.gui.getWindow("Popups/Valve Popup_Common")The getWindow() function cannot distinguish between multiple windows of the same name. So it returns the first one it finds, which might not be the one you want to work with.
Also, openWindow() doesn’t respect other copies of a window that have been opened with openWindowInstance(). You mustn’t use both functions on a given window. Choose one method or the other.