Assault Posted January 12, 2008 Share Posted January 12, 2008 I want to have the script click in a certain spot over and over(not at a very fast speed so they can use the mouse) until a button on the GUI is pressed, I dont know how I would go about doing this but what I have tried hasn't worked. : / Soooo... here is what I last tried. $Slots = GUICreate("Moo", 134, 74, 193, 125, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) $Label1 = GUICtrlCreateLabel("Click Delay", 16, 4, 57, 17) $start = GUICtrlCreateButton("Start", 18, 46, 36, 20, 0) $Input1 = GUICtrlCreateInput("In seconds", 15, 22, 97, 21) $stop = GUICtrlCreateButton("Stop", 65, 46, 39, 20, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start do mouseclick("left",511,422,1) sleep(1000) $count += 1 if $count = 5 Then WinActivate("") sleep(100) WinMove("","",1,1) $count = 0 EndIf until case $stop ;;;;;;;this right here cant work... case $stop EndSwitch WEnd Link to comment Share on other sites More sharing options...
BrettF Posted January 12, 2008 Share Posted January 12, 2008 $Slots = GUICreate("Moo", 134, 74, 193, 125, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) $Label1 = GUICtrlCreateLabel("Click Delay", 16, 4, 57, 17) $start = GUICtrlCreateButton("Start", 18, 46, 36, 20, 0) $Input1 = GUICtrlCreateInput("In seconds", 15, 22, 97, 21) $stop = GUICtrlCreateButton("Stop", 65, 46, 39, 20, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start do mouseclick("left",511,422,1) sleep(1000) $count += 1 if $count = 5 Then WinActivate("") sleep(100) WinMove("","",1,1) $count = 0 EndIf Until $nMsg = $stop ; Maybe? EndSwitch WEnd Try the code now... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Assault Posted January 12, 2008 Author Share Posted January 12, 2008 It still doesn't stop when the stop button is hit. Link to comment Share on other sites More sharing options...
BrettF Posted January 12, 2008 Share Posted January 12, 2008 (edited) $Slots = GUICreate("Moo", 134, 74, 193, 125, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) $Label1 = GUICtrlCreateLabel("Click Delay", 16, 4, 57, 17) $start = GUICtrlCreateButton("Start", 18, 46, 36, 20, 0) $Input1 = GUICtrlCreateInput("In seconds", 15, 22, 97, 21) $stop = GUICtrlCreateButton("Stop", 65, 46, 39, 20, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start Do $msg = GUIGetMsg () mouseclick("left",511,422,1) sleep(1000) $count += 1 if $count = 5 Then WinActivate("") sleep(100) WinMove("","",1,1) $count = 0 EndIf Until $msg = $stop; Maybe? EndSwitch WEnd Edited January 12, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Assault Posted January 12, 2008 Author Share Posted January 12, 2008 The switch uses $nmsg because thats whats declared if you change what you changed to just $msg, $msg is undeclared. Link to comment Share on other sites More sharing options...
GEOSoft Posted January 12, 2008 Share Posted January 12, 2008 (edited) $Slots = GUICreate("Moo", 134, 74, 193, 125, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) $Label1 = GUICtrlCreateLabel("Click Delay", 16, 4, 57, 17) $start = GUICtrlCreateButton("Start", 18, 46, 36, 20, 0) $Input1 = GUICtrlCreateInput("In seconds", 15, 22, 97, 21) $stop = GUICtrlCreateButton("Stop", 65, 46, 39, 20, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start Do $msg = GUIGetMsg () mouseclick("left",511,422,1) sleep(1000) $count += 1 if $count = 5 Then WinActivate("") sleep(100) WinMove("","",1,1) $count = 0 EndIf Until $msg = $stop; Maybe? EndSwitch WEndOhhh !!!!!!!!! You fast. I was just going to post that. Edit It st should have worked just by changing the Until line too. Until GUIGetMsg() = $Stop And actually all of this might not work as expected because of the sleep in the loop. AutoIt wont read the GUI message while it's in the Sleep() Edited January 12, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Assault Posted January 12, 2008 Author Share Posted January 12, 2008 I just noticed he did declare it, I missed it before but yeah now I see it and it works. Link to comment Share on other sites More sharing options...
BrettF Posted January 12, 2008 Share Posted January 12, 2008 Ohhh !!!!!!!!! You fast. I was just going to post that. Fraid all aussies are fast like this... But not in the bedroom. Nahh mate. We take a veryyy long time. I just noticed he did declare it, I missed it before but yeah now I see it and it works.lol.11th Commandment: Read before thy posts. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
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