Goblin Posted February 8, 2009 Share Posted February 8, 2009 Hey, Sometimes when i use mouse click in a loop(small loop), the window lagg. i don't want to use sleep and mouse clicking delay is 5. any ideas ? Link to comment Share on other sites More sharing options...
wolf9228 Posted February 8, 2009 Share Posted February 8, 2009 Hey, Sometimes when i use mouse click in a loop(small loop), the window lagg. i don't want to use sleep and mouse clicking delay is 5. any ideas ? #include <GUIConstantsEx.au3> GUICreate("My GUI Button") $Button_1 = GUICtrlCreateButton("Start MouseClick", 17, 30, 100) $Button_2 = GUICtrlCreateButton("Stop MouseClick", 280, 30, 100) GUISetState() Global $begin = 0 , $milliseconds = 0 , $Timer = False Do $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Global $milliseconds = 1000 , $Timer = True Case $msg = $Button_2 Global $Timer = False ToolTip("") EndSelect if TimerDiff($begin) >= $milliseconds And $Timer = True _ Then _MouseClick("left", 0, 500, 2 ) Until $msg = $GUI_EVENT_CLOSE Exit Func _MouseClick($button = Default , $x = Default, $y = Default, $clicks = Default, $speed = Default) ; MouseClick ($button , $x, $y , $clicks , $speed) ToolTip("MouseClick (" & $button & "," & $x & "," & $y & "," & $clicks & "," & $speed & ")" , 0, 0) $begin = TimerInit() EndFunc صرح السماء كان هنا Link to comment Share on other sites More sharing options...
Goblin Posted February 9, 2009 Author Share Posted February 9, 2009 #include <GUIConstantsEx.au3> GUICreate("My GUI Button") $Button_1 = GUICtrlCreateButton("Start MouseClick", 17, 30, 100) $Button_2 = GUICtrlCreateButton("Stop MouseClick", 280, 30, 100) GUISetState() Global $begin = 0 , $milliseconds = 0 , $Timer = False Do $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Global $milliseconds = 1000 , $Timer = True Case $msg = $Button_2 Global $Timer = False ToolTip("") EndSelect if TimerDiff($begin) >= $milliseconds And $Timer = True _ Then _MouseClick("left", 0, 500, 2 ) Until $msg = $GUI_EVENT_CLOSE Exit Func _MouseClick($button = Default , $x = Default, $y = Default, $clicks = Default, $speed = Default) ; MouseClick ($button , $x, $y , $clicks , $speed) ToolTip("MouseClick (" & $button & "," & $x & "," & $y & "," & $clicks & "," & $speed & ")" , 0, 0) $begin = TimerInit() EndFunc' you made 1000 millisecond delay ! Link to comment Share on other sites More sharing options...
BrettF Posted February 9, 2009 Share Posted February 9, 2009 How about you post your code then? 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...
Goblin Posted February 9, 2009 Author Share Posted February 9, 2009 How about you post your code then? here it is HotKeySet("{ESC}","EOP") $Jump_count = 0 While 1 $color = PixelSearch(425, 481, 556, 511, 0x990000) if not @error Then MouseClick("left",450, 466, 1, 5);450, 466 $jump_count = $jump_count + 1 TrayTip("Stat","Number of jumps = "&$jump_count,1) EndIf WEnd Func EOP() Exit EndFunc Link to comment Share on other sites More sharing options...
wolf9228 Posted February 9, 2009 Share Posted February 9, 2009 (edited) HotKeySet("{ESC}","EOP") $Jump_count = 0 $milliseconds = 5 ;Delay = 1 /milliseconds = 1 $TimerDiff = $milliseconds $begin = 0 While 1 $color = PixelSearch(425, 481, 556, 511, 0xFFFFFF) if not @error Then if $TimerDiff >= $milliseconds Then MouseClick("left",450, 466, 1, 5);450, 466 $jump_count = $jump_count + 1 TrayTip("Stat","Number of jumps = "&$jump_count,1) $begin = TimerInit() EndIf $TimerDiff = TimerDiff($begin) EndIf WEnd Func EOP() Exit EndFuncoÝ÷ Ù«¢+Ù!½Ñ-åMÐ ÅÕ½ÐííM ôÅÕ½Ðì°ÅÕ½Ðí=@ÅÕ½Ðì¤(((ÀÌØí)ÕµÁ}½Õ¹ÐôÀ(ÀÌØíÉɽÈô±Í)±¥¹± ÅÕ½Ðí}5½ÕÍ ±¥¬ÅÕ½Ðì°Ô¤()]¡¥±Ä(ÀÌØí½±½ÈôA¥á±MÉ ÐÈÔ°ÐàÄ°ÔÔØ°ÔÄÄ°Áá¤)¥¹½ÐÉɽÈQ¡¸)±½°ÀÌØíÉɽÈôQÉÕ)±Í)±½°ÀÌØíÉɽÈô±Í)¹%)]¹(()Õ¹=@ ¤(á¥Ð)¹Õ¹()Õ¹}5½ÕÍ ±¥¬ ¤)%ÀÌØíÉɽÈôQÉÕQ¡¸(5½ÕÍ ±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÔÀ°ÐØØ°Ä°Ô¤ìÐÔÀ°ÐØØ(ÀÌØí©ÕµÁ}½Õ¹ÐôÀÌØí©ÕµÁ}½Õ¹Ð¬Ä)QÉåQ¥À ÅÕ½ÐíMÑÐÅÕ½Ðì°ÅÕ½Ðí9յȽ©ÕµÁÌôÅÕ½ÐìµÀìÀÌØí©ÕµÁ}½Õ¹Ð°Ä¤)¹%)¹Õ¹ Edited February 9, 2009 by wolf9228 صرح السماء كان هنا 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