Getting the name of the active window

I want to write a python script on Windows that saves the title of the program that the user is currently using, for example http://www.rescuetime.com . I donโ€™t want to use a savior for privacy reasons, but instead I write a script that does something similar to itself to collect data about how much I use my computer.

Is there any easy command I can use to read this information?

+6
python windows
source share
1 answer

From daniweb

import win32gui w=win32gui w.GetWindowText (w.GetForegroundWindow()) 
+9
source share

All Articles