Sign in to follow this  
Followers 0
nnm

auto mouse clicks

5 posts in this topic

I need auto click left mouse button ON when left mouse button pressed, and OFF when released

i try to do it, it starts clicking, but dont sets OFF...

;AutoItSetOption("MustDeclareVars", 1)
;AutoItSetOption("MouseCoordMode", 0)
;AutoItSetOption("PixelCoordMode", 0)
;AutoItSetOption("RunErrorsFatal", 0)
;AutoItSetOption("TrayIconDebug", 0)
AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("MouseClickDelay", 3)


While 1
  If _IsPressed('01') = 1 Then 
    $i = 0
    While $i <= 10
    MouseClick("left")
    wend
  Else
        If _IsPressed('01') = 0 Then
        while 1
        sleep (10000)
        wend
     EndIf
  EndIf
  If _IsPressed('4e') = 1 Then MsgBox(0, '', 'Wow');4e is the N
  Sleep(10)
Wend

Exit
Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
  
  Local $aR, $bRv;$hexKey
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
;If $aR[0] = -32767 Then
  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  
  Return $bRv
EndFunc ;==>_IsPressed

which i write wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

the API call in _IsPressed returns differently for different key (or mouse) states. You need a more robust function.

Lar

<{POST_SNAPBACK}>

How can i do it? mb whith

MouseDown("left") ?

i try to do it but it not work

can any1 help me?

Edited by nnm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

oh, but I see your problem... you cannot send mouseclicks, when you are holding down the mouse button... perhaps you should use another button (middle) or a key to trigger auto clicking... I cannot figure a way to do your original request...

Lar.

edit: see, sending mouseclicks is the same as clicking the mouse button, so the button IS released, by the function call to MouseClick("left")... it is like saying, you want to press the mouse button down and automatically have it release the mouse button until you release the mouse button... isn't that absurd?

<{POST_SNAPBACK}>

no. its have statement which calls mouse button down or not. its dont depends on clicking of mouse button...

hmm... can it call ingame procedure which will do same as uto clicks?

for example in CS +attack...???

hmm. no. Im wrong. winAPI have instanse which changes when mouse button down.

and another statement which changes when mouse button up...

so script must set ON as below and OFF when HARDWARE mouse button released

Edited by nnm

Share this post


Link to post
Share on other sites

as i think u can do

mousedown("left")

mouseclick("left", , 100)

mouseup("left")

Share this post


Link to post
Share on other sites

1st can i do this:

When I press MOUSE1 AutoIt will click mouse3 repeatly

When I release MOUSE1 AutoIt stop clicking mouse3?

2nd:

mb any1 can help me with this?http://www.mentalis.org/apilist/mouse_event.shtml

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