I’m attempting to figure out a. If Microsoft Power Point is running, and b. If so, is it running in full screen mode or “slide show” mode.
Detecting whether or not an instance of PowerPoint is running was fairly straight forward.
def check_for_ppt():
global ppt
stime = time.time()
f = (os.popen('tasklist').read())
if 'POWERPNT.EXE' in f:
ppt = True
else:
ppt = False
But I’m unsure where to go from here. Is there a way to detect the state of another program? I guess in a pinch, I could ping parts of the extremes of the screen and test whether the pixels returned black or not (as they would be during a presentation), and just hope that I don’t get too many false positives. But outside of that, I’m not sure.
Can python ‘hook’ into another program and see what’s going on?
You can probably do this using PowerPoint’s COM interface and the win32com.client module.
I don’t have PPT here to write the code, but it looks like you’ll have to connect to PPT and get the Application.Presentations object and find the active Presentation. When you have the active Presentation, get its SlideShowSettings and check its ShowType for ppShowTypeKiosk.