Jump to content

Recommended Posts

Posted

hi,

does anyone know how to set the left mouseclick as a hotkey trigger??

i need this to make a mouseclick catcher script...

or at least, there's another way to do it??

thank's

Posted

just used Ezzetabi's _IsPressed Func...

Func _IsPressed($hexKey)

  
  Local $aR, $bRv
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
 
  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  
  Return $bRv
EndFunc

there was an updated one somewhere, i can't find it..

example:

Func _IsPressed($hexKey)

  
  Local $aR, $bRv
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
 
  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  
  Return $bRv
EndFunc
While 1
If _IsPressed ('01') then;if the left mouse button is clicked
MyFunc ()
EndIf
Wend

Func MyFunc ()
MsgBox (0, "You", "You clicked the left mouse button! Now add a function!")
EndFunc

:idiot:

FootbaG
Posted (edited)

Yes, it's possible... Try downloading http://www.autoitscript.com/fileman/users/public/CyberSlug/autowriter.zip which requires the latest AutoIt beta.

Basically, my script creates an invisible window (using the the GUI functions in the latest AutoIt beta) which has support for detecting mouse clicks.

I can elaborate more tomorrow.

P.S. GetAsyncKeyState doesn't always work well with Windows 98, but it's great for Windows XP :idiot:

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

i've never used AutoItX(beta)

i downloaded its .chm and .dll from download page,

but still don't know how to integrate it with AutoIt(in short, i don't know how to start AutoItX)

Posted (edited)

I tried the script u gave, it worx, but there's a problem, take a look on the codes:

Hotkeyset("{PGDN}","ExitSC")

HotKeyset("{PAUSE}","StartSC")

Global $routefile

Global $mousepos

Global $delaynum

Global $timers

Global $sleep

Global $mouseclick

Global $script

$routefile = FileOpen("route.au3",1)

While 1

WEnd

Func _IsPressed($hexKey)

 

  Local $aR, $bRv

  $hexKey = '0x' & $hexKey

  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

  If $aR[0]<> 0 Then

     $bRv = 1

  Else

     $bRv = 0

  EndIf

 

  Return $bRv

EndFunc

Func MyFunc ()

$mousepos = MouseGetPos()

$delaynum = TimerDiff($timers)

$sleep = "Sleep(" & $delaynum & ")" ; Will be returned as *sleep(delay)*

$mouseclick = 'MouseClick("left",' & $mousepos[0] & ',' & $mousepos[1] & ',1,0)' ; Will be returned as *MouseClick(function parameters)*

FileWriteLine($routefile,$sleep)

FileWriteLine($routefile,$mouseclick)

$timers = TimerInit() ; Reset timer and start counting time delay for the next click

While _IsPressed('01') ; This is supposed to hold the script execute this function more than twice if left mouse button still in "hold".

WEnd ; When left mouse button is released, the function is prepared to go for the next execution

EndFunc

Func StartSC()

$timers = TimerInit() ; Start counting time delay from start to the first click

$script = NOT $script

While $script AND _IsPressed('01') ;

MyFunc ()

Wend

EndFunc

Func ExitSC()

Exit

EndFunc

The route.au3 that the main script generated:

Sleep(0.19471748504349)

MouseClick("left",352,586,1,0)

Sleep(0.254501619619253)

MouseClick("left",308,573,1,0)

ok, the problem is on the Sleep(blablabla)

it supposed to be more than 3000 ms, coz i start to clicking after 3 seconds, and the second problem is, it should return more than 4 mouseclicking(not just2).

the main purpose of the script is, to capture mouseclicks and count it delays between single-mouseclicks(instant click, won't capture more than twice if the left mouse is hold) and then put those into a file as route.au3. and the script would only start to capture mouseclicks after pressing "PAUSE" key.

could anyone tell me what's wrong?

thank you

Edited by soulhealer

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
×
×
  • Create New...