"Window becomes active" event Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Spitzi
Posts: 315
Joined: 24 Feb 2022, 03:45

"Window becomes active" event

Post by Spitzi » 20 Mar 2024, 02:55

My solution so far is with a Timer:

Code: Select all

SetTimer(CheckActiveState, 500)

CheckActiveState() {
	static wasActive := false
	if WinActive("Hanging-Manager") {
		if !wasActive {
			ToolTip("Activated")
			wasActive := true
		}
	} else {
		if wasActive {
			ToolTip("Deactivated")
			wasActive := false
		}
	}
}
Is there an easyer way to detect when a window becomes active?

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

Re: "Window becomes active" event  Topic is solved

Post by boiler » 20 Mar 2024, 03:25

See Descolada’s WinEvent library.

Spitzi
Posts: 315
Joined: 24 Feb 2022, 03:45

Re: "Window becomes active" event

Post by Spitzi » 20 Mar 2024, 03:48

@boiler. Thank you for pointing that out to me. Exactly what I needed and so much more.

Post Reply

Return to “Ask for Help (v2)”