acidfear Posted May 23, 2007 Posted May 23, 2007 I have this program that clicks 2 spots really fast. I tried a couple of things to try and exit this loop when a key is pressed using _Ispressed() and hotkeyset(). With hotkeyset, i have to hold the key for a while before it exits, or press it many times before it exits. _Ipressed() didn't seem to work at all. How can I have the program exit as soon as a key is pressed? Here is the code: expandcollapse popup#include <GuiConstants.au3> #Include <Misc.au3> HotKeySet("{Esc}","_End") GuiCreate("Exp Booster", 231, 287,3,307 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $I_XGuy = GuiCtrlCreateInput("320", 70, 180, 50, 20) $I_YGuy= GuiCtrlCreateInput("570", 20, 180, 50, 20) $I_XYes = GuiCtrlCreateInput("729", 20, 210, 50, 20) $I_YYes = GuiCtrlCreateInput("655", 70, 210, 50, 20) $G_Clicks = GuiCtrlCreateGroup("Click Settings", 10, 160, 210, 80) $I_WaitClickYes = GuiCtrlCreateInput("50", 20, 70, 50, 20) $I_WaitClickGuy = GuiCtrlCreateInput("250", 20, 100, 50, 20) $I_NumbClickYes = GuiCtrlCreateInput("1", 20, 130, 50, 20) $I_NumClickGuy = GuiCtrlCreateInput("500", 20, 40, 50, 20) $G_Coors = GuiCtrlCreateGroup("Coordinate Settings", 10, 20, 210, 140) $L_NumbClickGuy = GuiCtrlCreateLabel("# clicks GUY", 100, 40, 100, 20) $L_WaitClickGuy = GuiCtrlCreateLabel("Wait click GUY ", 100, 70, 90, 20) $L_WaitClickYes = GuiCtrlCreateLabel("Wait click YES", 100, 100, 80, 20) $L_NumClickYes = GuiCtrlCreateLabel("# clicks YES", 100, 130, 80, 20) $L_GuyCoor = GuiCtrlCreateLabel("X , Y GUY", 130, 180, 80, 20) $L_YesCoor = GuiCtrlCreateLabel("X , Y YES", 130, 210, 80, 20) $B_Start = GuiCtrlCreateButton("Start", 70, 250, 70, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $B_Start WinActivate("[Eudemons Online] Beta Test") WinMove("[Eudemons Online] Beta Test", "", 127,95) Sleep(500) $GuyX = GUICtrlRead($I_XGuy) $GuyY = GUICtrlRead($I_YGuy) $YesX = GUICtrlRead($I_XYes) $YesY = GUICtrlRead($I_YYes) $ClicksG = GUICtrlRead($I_NumClickGuy) $ClicksY = GUICtrlRead($I_NumbClickYes) $SleepY = GUICtrlRead($I_WaitClickYes) $SleepG = GUICtrlRead($I_WaitClickGuy) While 1 MouseClick("left",$GuyX,$GuyY,$ClicksG,1) Sleep($SleepY) MouseClick("left",$YesX,$YesY,$ClicksY,1) Sleep($SleepG) WEnd EndSelect WEnd Exit Func _End() Exit EndFunc
Generator Posted May 23, 2007 Posted May 23, 2007 (edited) I have this program that clicks 2 spots really fast. I tried a couple of things to try and exit this loop when a key is pressed using _Ispressed() and hotkeyset().With hotkeyset, i have to hold the key for a while before it exits, or press it many times before it exits. _Ipressed() didn't seem to work at all.How can I have the program exit as soon as a key is pressed?Here is the code: While 1 MouseClick("left",$GuyX,$GuyY,$ClicksG,1) Sleep($SleepY) MouseClick("left",$YesX,$YesY,$ClicksY,1) Sleep($SleepG) WEnd EndSelect WEndExitFunc _End() ExitEndFuncYour loop stucks there. Hotkey is a speical function that it's detected no matter what, if you want you should put the IsPressed() inside that while and make an if statement for it. Edited May 23, 2007 by Generator
acidfear Posted May 23, 2007 Author Posted May 23, 2007 (edited) I tried that but it didn't seem to work. With _ispressed() it doesn't exit at all. It just keeps looping, unline hotkeypress, where it exits after a while of pressing the same key. I've never had this problem before. I don't understand why it's not exitting Edited May 23, 2007 by acidfear
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now