I have a number of annoying windows which I want to automaticaly close on my system, I wanted to have a script running in the background that checks for the offending windows and removes them when they are detected.
I came up with the following script which does do the trick however it takes 47% of the cpu when looking in the Task Manager's running processes tab, This is obviously unacceptable.
Does anyone have an alternate solution to this problem or can spot a way to improve the performance of this script?
Code:
Loop
{
if WinExist("Windows - No Disk")
{
Gosub, FocusAndKill
}
if WinExist("Synchronisation Error")
{
Gosub, FocusAndKill
}
if WinExist("Warning: Unresponsive script")
{
Gosub, FocusAndKill
}
if WinExist("Removable Disk (U:)") and WinExist("ahk_class #32770")
{
Gosub, FocusAndKill
}
if WinExist("Autoplay") and WinExist("ahk_class #32770")
{
Gosub, FocusAndKill
}
if WinExist("End Program")
{
WinActivate
MouseClick, left, 212, 225
}
if WinExist("Security Error: Domain Name Mismatch")
{
WinActivate
MouseClick, left, 216, 189
}
}
FocusAndKill:
WinActivate
WinKill
return