Sign in to follow this  
Followers 0
SkellySoul

Exit Script?

4 posts in this topic

Hello.

I made a quick alarm clock for my girlfriend to wake her up for work and I am able to exit this script no problem on my computer and she is able to exit the script as well but sometimes she says she has to reboot in order to stop the script.

HotKeySet("{ESC}" , "_Exit")

ToolTip("Alarm is Set for 5 AM" & @CRLF & @CRLF & "Push Escape (ESC) to Exit"  , 0 , 0 , "I Love you Laura")

Do
    Sleep(500)
    MouseMove(Random(0 , 5) , Random(0 , 5))
Until @HOUR = 05

While 1
    Beep(Random(100 , 500) , Random(100, 500))
WEnd

Func _Exit()
    Exit
EndFunc

could it possibly because I didn't add a sleep in the loop and when Exit is pushed it isn't knowing its being pushed.

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

i would assume its because of no sleep in the while loop not the exit function :idea:

EDIT: i missread your orig post- yes its because there is no sleep in the while loop (i would also assume you see at least a 5-15% cpu spike with a while statement like that... i used to write alot of bots for mmorpg's and i'll def testify that you can hammer a hotkey and autoit won't see it if its too busy

Edited by MuffettsMan

Don't let that status fool you, I am no advanced memeber!

Share this post


Link to post
Share on other sites

i would assume its because of no sleep in the while loop not the exit function :idea:

EDIT: i missread your orig post- yes its because there is no sleep in the while loop (i would also assume you see at least a 5-15% cpu spike with a while statement like that... i used to write alot of bots for mmorpg's and i'll def testify that you can hammer a hotkey and autoit won't see it if its too busy

thanks, ill try that...it exited for me either way though but guess her computer is slower or something.

Share this post


Link to post
Share on other sites

I'm guessing you already registered the hotkey for another (or more likely another instance of the same) script. Try this:

If HotKeySet("{ESC}" , "_Exit") = 0 Then
    MsgBox(0,"Error registering hotkey","{Esc} could not be registered as hotkey." & @CRLF & "The program will now exit.")
    Exit
EndIf

ToolTip("Alarm is Set for 5 AM" & @CRLF & @CRLF & "Push Escape (ESC) to Exit" , 0 , 0 , "I Love you Laura")

Do
    Sleep(500)
    MouseMove(Random(0 , 5) , Random(0 , 5))
Until @HOUR = 05

While 1
    Beep(Random(100 , 500) , Random(100, 500))
WEnd

Func _Exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0