Help determining whether window is focused

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
jwilcox25
Posts: 14
Joined: Thu Jan 22, 2009 4:19 am

Help determining whether window is focused

Post by jwilcox25 » Fri Jan 23, 2009 2:50 am

I'm a python newb, but I just wanted to write a quick script to determine whether or not notepad was the focused window. Doesn't seem to work unfortunately, please let me know what I'm doing wrong.

import win32gui
w=win32gui
eg.result = GetWindowText (w.GetForegroundWindow()) == 'notepad.exe'

[edit] ack i think if i just did w.GetWindowText instead, it might work. I'll test at home later

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Help determining whether window is focused

Post by Pako » Fri Jan 23, 2009 3:30 pm

The answer I sent in another topic: http://www.eventghost.org/forum/viewtop ... f=2&t=1218
Pako

Post Reply