if si's built in events arent' cutting the proverbial mustard
i'd go with simple win32 funcs.
simplest possible ones i could think of:
import win32gui
# callback
def enum_handler(hwnd, lParam):
wt = win32gui.GetWindowText(hwnd)
# if soft is minimized to task bar
if win32gui.IsIconic(hwnd) and 'Autodesk Softimage' in wt:
#if your timing is tight, probably better to use this
callback
# to store the pid, hwnd for future access
#-> _, pid =
win32process.GetWindowThreadProcessId(hwnd)
# although you'd still need to enum the pid->hwnd.
dunno without testing
print 'soft is minimized, abandon all hope!'
win32gui.EnumWindows(enum_handler, None)
# OR -
def softimage_has_focus():
## script editor will count as focused. probably no need to
call
# GetParent if running in a plug
# -> par_hwnd = win32gui.GetForegroundWindow()
par_hwnd =
win32gui.GetParent(win32gui.GetForegroundWindow())
if 'Autodesk Softimage' in
win32gui.GetWindowText(par_hwnd):
return True
return False
if softimage_has_focus():
print 'hullo Soft'
---------------------------------------------------------------
---------------------------
--
Jon Swindells
[email protected]
On Tue, Jul 22, 2014, at 11:58 PM, Matt Lind wrote:
The View object has an siViewState that can be checked if you
can find a way to tuck your event into a PPG of some sort.
Otherwise, you’re probably looking at something in the WSH
(Windows Script Host) API which should be accessible from
inside any scripted code.
Matt
From: [email protected]
[mailto:[email protected]] On Behalf Of
Fabricio Chamon
Sent: Tuesday, July 22, 2014 5:53 AM
To: [email protected]
Subject: Application focus ?
Hey experts,
is it possible to know wether xsi app has focus ? I have a
timer script that fires up some alerts, but want to run only if
softimage is not minimized. I took a look at Application object
and didn't find anything related..
thanks