Windows 10 - Winexist

Get help with using AutoHotkey and its commands and hotkeys
daywalker
Posts: 23
Joined: 18 Jun 2019, 01:37

Windows 10 - Winexist

23 Jan 2020, 02:59

Hello,

changing from Win7 to WIn10 i noted that the CPU Usage of my tool is greatly increasing (about <1% to 10-15%).
I use a timer function which repeatly calls WinExist() or IfWinExist.

Below a demo code (cant show the whole code).

I know that there a a lot of If-then-else clause combined partially with regex and detecthiddenwindows, but as it works really fine on Win7, why there is such a CPU Usage on Win10?
Has anyone same experiences with Win10 (or a solution)?

Code: Select all

SetTimer, timerevent, 1000
return

timerevent:
 SetTimer, timerevent, OFF
 IfWinExist, MyWindowtoCheck
 {
 } else if WinExist("AnotherWindowtoCheck1")
 {
 } else if WinExist_Mode("AnotherWindowtoCheck2",,,,"RegEx","on")
 {} 
 ; ... and so on
 ; ... and so on 
 ; ... and so on
 SetTimer, timerevent, ON
 return

WinExist_Mode(WinTitle, WinText="", ExcludeTitle="", ExcludeText="", Using_TitleMatchmode="", Using_DetectHiddenwindows="")
{
	local
	
	old_mode := A_TitleMatchMode
	old_speed := A_TitleMatchModeSpeed
	old_detect := A_DetectHiddenWindows
	
	if Strlen(Using_TitleMatchmode)
		SetTitleMatchMode, %Using_TitleMatchmode%
	if Strlen(Using_DetectHiddenwindows)
		DetectHiddenWindows, %Using_DetectHiddenwindows%
	
	res := WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText)
	
	SetTitleMatchMode, %old_mode%
	SetTitleMatchMode, %old_speed%
	DetectHiddenWindows, %old_detect%
	
	return res
}

Return to “Ask For Help”

Who is online

Users browsing this forum: AHK_EagerBeginner, Chemomancer, Chunjee, kunkel321, malikye, MrCheeseman, tertius, vmech and 56 guests