I’m working on a small program that lets the user select a specific area of their screen by clicking their mouse and then throughout its run records what windows were visible to the user at that location and for how long.
Initially I simply fetched the window title using pygetwindow, which kind of works, but I’ve found that window titles change very frequently. For example some video games change their video title to the name of the current level, or browsers change their window title based on the active tab. So I’m looking for a better way to identify windows in my records file.
PID is also a no go as it will change every time I restart a program.
Ideally I’d like to fetch the .exe path of the window, as it displays the name of the program and will not change unless I move the executable itself. Is this possible? If not, is there any other (or better) way to statically id a program for my purposes?