System.util.execute within a window

Hi -
I’m trying to call an external app - Win 7 - using system.util.execute - which I can do, but the app runs in the background instead of on top of my Ignition window where I need it. Any idea on how I can either a) run it from within some type of container within a window or at the least, put it on top of my existing window.


Steve Dobson

we were having the same problem which has been introduced since I think SP3 on win XP.
just giving the window/app focus isn’t enough anymore (just makes Icon flash in tool bar) we ended up toggling the “stay on top” flag to force the window to be displayed. I’m not at work at the moment so if you like I’ll pop the code we use for this up on Monday (Australia time).

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 #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 #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
allWindows = system.gui.getOpenedWindows()

topWindow = SwingUtilities.getAncestorOfClass(Window, allWindows[0])
state = topWindow.getExtendedState()
if Visible:
	state &= ~Frame.ICONIFIED
	if KeepOnTop==0:
	state |= Frame.ICONIFIED

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…