AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ExitApp not working

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
shipoopi
Guest





PostPosted: Fri Apr 11, 2008 2:27 pm    Post subject: ExitApp not working Reply with quote

Code:

#notrayicon
#singleinstance force
loop,
{
winkill,Data Execution Prevention - Microsoft Windows
}
Sleep, 30000
ExitApp


I have the above code added to my list of startup programs on my work laptop. I keep getting an annoying message because of an issue with my antivirus software. Eventually the problem will be fixed the right way, but for now I wrote the above script to kill the repeating window. This script consumes a lot of CPU power, so I want it to automatically close after 30 seconds. But it doesn't close after 30 seconds. What am I doing wrong?
Back to top
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Fri Apr 11, 2008 2:33 pm    Post subject: Reply with quote

Code:

#notrayicon
#singleinstance force
Settimer,Exit,30000
loop,
{
winkill,Data Execution Prevention - Microsoft Windows
Sleep,100
}

Exit:
ExitApp

_________________
[Join IRC!]
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Apr 11, 2008 2:35 pm    Post subject: Reply with quote

Looks like you are in an endless loop so it never reaches the Sleep command. Try using SetTimer
http://www.autohotkey.com/docs/commands/SetTimer.htm
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 134
Location: PA

PostPosted: Fri Apr 11, 2008 3:12 pm    Post subject: Reply with quote

does the error continuously pop up forever? or only for a certain amount of time or popups?

you could have it loop with a sleep of around 100 that detects when the popup exists, then closes it after.

what to do:
find the title of the popup window, make sure it's not a variable name in the title. if it is a specific title, great.
use:
Code:
IfWinExist, titleOfAntivirusPopup

If necessary, (to make sure you find the right window) add a comma after this code and include some text IN the window that will always show up. i.e. the name of the file or error or warning.

so you could use:
Code:
SetTimer, loopAV, 150         ;(timeTillRelaunchOfLoopAV)
return

loopAV:
IfWinExist, Data Execution Prevention - Microsoft Windows
WinKill, Data Execution Prevention - Microsoft Windows
return

^!H::                 ; press CTRL-ALT-H to shutdown script
ExitApp


NOTE: this should work if memory serves me right, and the cpu usage isn't bad. i have code somewhere to do something similar, so if this doesn't bring down the cpu usage...holler back and i'll check it out.
this code was not tested.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group