How to log activated windows?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
stax76
Posts: 12
Joined: 20 Jan 2022, 10:07
Contact:

How to log activated windows?

Post by stax76 » 20 Jan 2022, 10:28

I've a very annoying defect on my system, sometimes there is a window popping up, and I don't know what it is because it can only be seen for a few milliseconds, I don't see much more than the blinking of the title bar of the currently active application. First I thought it was Anki because I use that a lot, but later I also noticed it in Sublime Text and MusicBee.

If I remember correctly, a Win32 hooking API exists for window activation, or I try to record the screen until it happens. I need to find out which crappy process is the culprit, any ideas for a simple solution?

User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: How to log activated windows?

Post by mikeyww » 20 Jan 2022, 11:05

Code: Select all

#SingleInstance Force
Loop {
 WinWaitNotActive, A
 SoundBeep, 1500
 WinGet, proc, ProcessName, A
 ToolTip, % list := proc (list ? "`n" : "") list
}

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: How to log activated windows?

Post by amateur+ » 20 Jan 2022, 16:07

The God!
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

stax76
Posts: 12
Joined: 20 Jan 2022, 10:07
Contact:

Re: How to log activated windows?

Post by stax76 » 22 Jan 2022, 02:23

@mikeyww

Thanks for helping. I was not able to fix the issue. Meanwhile, I recorded the screen with OBS, and this showed the title bar changes color a few milliseconds indicating that the application loses focus shortly, but there didn't appear another window on screen or in the taskbar, at least not in the recording.

User avatar
boiler
Posts: 16913
Joined: 21 Dec 2014, 02:44

Re: How to log activated windows?

Post by boiler » 22 Jan 2022, 06:04

Did mikeyww’s script indicate any changes in the active window? You haven’t mentioned that you used it.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to log activated windows?

Post by swagfag » 22 Jan 2022, 07:39

that script relies on the window actually becoming the foreground window. if it doesnt do that, then nothing gets logged obviously
if that is the case, u can monitor window creation using a WinEventHook

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: How to log activated windows?

Post by amateur+ » 22 Jan 2022, 10:30

Maybe this will work?

Code: Select all

#SingleInstance Force
Loop {
 oldActive := WinExist("A")	
 WinWaitNotActive, A
 while !(newActive := WinExist("A")) || (newActive = oldActive)
	Sleep 0
 WinGet, proc, ProcessName, A
 ToolTip, % list := proc (list ? "`n" : "") list
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

Post Reply

Return to “Ask for Help (v1)”