Allow to Set foreground window in windows with python

45 views Asked by At

I am trying to write a python script helping me a little with my window management.

I want to be able to set any window on the screen as the foreground window, and actually in pywin32/win32gui there is a function: SetForegroundWindow.

But the documentation states, that I can only do that if my process is currently in focus.

Makes sense, I guess. Dont want to allow any process to interrupt my workflow and set the foreground window.

But AutoHotKey can also do that!

Is there a workaround or another way? Can I somehow set the foreground window from python even if my process is just a background process?

0

There are 0 answers