[Moderator's note: Topic moved from AutoHotkey v2 Development.]
I'm having an issue similar to the one pointed out here.
I stuck to the WinExist workaround suggested by jethrow back in 2011, with a 200ms delay, which reduces the CPU consumption from 15% to an average 2.5% (running AHK 2a over an i5-4590 quad-core CPU). By what Lexikos said back in the day, it should have been fixed by AHK 1.1.
The workaround is working fine and all, but still the 200ms delay bugs me a bit - I'm using it to skip ads on certain app but they still get to pop up for a few milliseconds in between the sleeping gaps. If I reduce the delay to 100ms, CPU reasonably doubles. I was wondering if it's the very same issue as before and if it can be fixed just as it did back then.
Sorry I'm posting this on the wrong board or if it sounds a bit irrelevant. I've been using AHK for many years, now (almost 5 years), became a programmer because of it and still it's the first time I've ever posted here.
[SOLVED] WinWait high CPU usage Topic is solved
[SOLVED] WinWait high CPU usage
Last edited by gyohza on 09 Oct 2019, 08:11, edited 1 time in total.
Re: WinWait high CPU usage
post concrete examples
ur snippet ported to v2 results in 0.57% cpu utilization for me on a105
ur snippet ported to v2 results in 0.57% cpu utilization for me on a105
Code: Select all
SetTimer "Timer", -3000
msgbox "Keep this window open for 3 secs & the WinWait causes 100% CPU`n`nClose it before 3 secs & the WinWait will use 0% CPU"
Timer() {
Tooltip "WinWait running..."
WinWait "PLEASE USE 100% CPU FOR NO REASON"
msgbox "WinWait done"
}
Re: WinWait high CPU usage Topic is solved
Yeah, I guess you're right. Yours wasn't really using up a lot of CPU, so I started to think it was because of Regex title matching, but when I tried tinkering around I found out the real culprit:
This was causing every Window procedure to use more CPU than it should.
Here's my past snippet for reference:
And here's the version with actual WinWait:
Consider it solved! Thanks for the heads up.
Code: Select all
DetectHiddenWindows "On"
Here's my past snippet for reference:
Code: Select all
adless() {
loop {
if (WinExist("^(title1|title2|title3)$ ahk_class ^Chrome_WidgetWin_0$ ahk_exe ^.*\\someapp\\theapp\.exe$")) {
/*
do stuff
*/
} else {
Sleep 100
}
}
}
SetTimer("adless", -1)
Code: Select all
adless() {
loop {
WinWait("^(title1|title2|title3)$ ahk_class ^Chrome_WidgetWin_0$ ahk_exe ^.*\\someapp\\theapp\.exe$")
/*
do stuff
*/
}
}
SetTimer("adless", -1)
Who is online
Users browsing this forum: Bing [Bot], just me, WarlordAkamu67 and 56 guests