3

How do I get the name of the currently active window (the one which has been clicked on and is being interacted with by the user) in Python?

The Python script should keep running in the background and as I open applications, it should detect which application has been opened.

For example, if I play a movie using the VLC media player, my script must detect that the VLC media player window is currently active. If I switch to the Chrome browser, my script should detect that the Chrome browser is currently active.

Akshay Damle
  • 1,220
  • 3
  • 18
  • 31
  • 1
    Can you explain any further? Do you want to track activities on the computer with a python program or are you just interested in the title of the console window you python script runs in? – Wolf Sep 20 '14 at 10:52
  • 1
    @Wolf I want to track activities on the computer with a python program. For example, if I've opened up the VLC media player, I want to know that the VLC media player is open and is the currently active window – Akshay Damle Sep 20 '14 at 19:43
  • I think, your question can be improved then. Seems quite interesting BTW – Wolf Sep 21 '14 at 10:21
  • Does this answer your question? [Obtain Active window using Python](https://stackoverflow.com/questions/10266281/obtain-active-window-using-python) – user202729 Jun 03 '23 at 02:59

1 Answers1

1

You could look at the following link and see what you can pull/use from it...all the best... http://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/