AutoHotkey Community

It is currently May 27th, 2012, 10:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: July 28th, 2006, 9:52 am 
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



Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2006, 10:03 am 
Offline

Joined: July 20th, 2006, 6:41 pm
Posts: 144
Location: Los Angeles
I suggest moving this to the "Ask For Help" section of the forum - this is mainly where people post their scripts and functions (that do work)

-Kerry


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2006, 10:38 am 
Good idea, will do, can a moderator delete this thread, i'll post this again in the correct place.


Report this post
Top
  
Reply with quote  
PostPosted: July 28th, 2006, 12:45 pm 
May be that :
Code:
SetTimer, ShoutThemUp, 1000   ; Auto Execute section (See Help)
(...)
Return

; Execute your loop (not kill it !!!) every second should be sufficent
ShoutThemUp;
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2006, 12:48 pm 
Of Course
Code:
ShoutThemUp;
must be
Code:
ShoutThemUp:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2006, 3:02 pm 
Bruce (Lee) wrote:
Of Course
Code:
ShoutThemUp;
must be
Code:
ShoutThemUp:

Bloody hell Dad, Can't you spell? Shouldn't it be:
Code:
ShutThemUp:
???
Love to ma boy!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2006, 7:34 pm 
The translate software I use on Internet is avery bad one !!!
Bang bang bang !!!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Maestr0 and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group