System.util.execute within a window

Ok, so I remoted in :slight_smile: …
We make our app “hog the screen” so to speak to make sure it stays on top of everything else if the operator needs to respond/action anything in our program.
Here’s the client script we use (monitoring tag change at client)

import system,app value = system.tag.getTagValue("[Client]CurrentDown") autoHide = system.tag.getTagValue("[Client]AutoHide")>0 flags=system.util.getSystemFlags() if (value > 0) and (flags and system.util.CLIENT_FLAG == system.util.CLIENT_FLAG) and ("DT_Operator" in system.security.getRoles()): #popup app.Popup.Iconify(Visible=1,KeepOnTop=0) elif (autoHide>0) and (value == 0) and (flags and system.util.CLIENT_FLAG == system.util.CLIENT_FLAG) and ("DT_Operator" in system.security.getRoles()): #popdown app.Popup.Iconify(Visible=0,KeepOnTop=0)

And our “Iconify” function looks like this:
(Yes, it is a downtime event management application… written before the OEE module existed :frowning: )

[code]def Iconify(Visible, WindowName=“DowntimeEvents”, KeepOnTop=0):
#PJR 20100313
#This Script forces the Ignition App to appear/dissapear.
#It works for both windowed & full screen launch modes
from java.awt import Window
from javax.swing import SwingUtilities
from java.awt import Frame
import system
allWindows = system.gui.getOpenedWindows()
if len(allWindows)==0:
#No Windows open? open one first
system.nav.openWindow(WindowName)
allWindows = system.gui.getOpenedWindows()

topWindow = SwingUtilities.getAncestorOfClass(Window, allWindows[0])
state = topWindow.getExtendedState()
if Visible:
	state &= ~Frame.ICONIFIED
	topWindow.setExtendedState(state)
	topWindow.setAlwaysOnTop(1)
	topWindow.toFront()
	if KeepOnTop==0:
		topWindow.setAlwaysOnTop(0)
else:
	state |= Frame.ICONIFIED
	topWindow.setExtendedState(state)
	topWindow.setAlwaysOnTop(0)
	topWindow.toBack()[/code]

Not exactly what you were after but works for us :smiley:
BTW the same PC was running another of our .NET apps that was also set to “stay on top” which is why we used this method.

Hope it helps…