Sign in to follow this  
Followers 0
Goblin

Mouseclick lags window

6 posts in this topic

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 ?


Share this post


Link to post
Share on other sites



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

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#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 !


Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by wolf9228

صرح السماء كان هنا

 

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