Sign in to follow this  
Followers 0
ihenvyr

Mouse Left Click

11 posts in this topic

is it possible to set a hotkey for mouse left click? :(

for example:

pushing mouse left click sending letter A

is it possible? :think:

or any recommendations?

THANKS!!


Umbrella Member

Share this post


Link to post
Share on other sites



thanks ..but i'm can't run it

Const $WH_MOUSE = 7

Const $WM_AUTOITLBUTTONDOWN = 0x1400 + 0x0A30
Const $WM_AUTOITRBUTTONDOWN = 0x1400 + 0x0A31
Const $WM_AUTOITMBUTTONDOWN = 0x1400 + 0x0A32
Const $WM_AUTOITXBUTTONDOWN = 0x1400 + 0x0A33
Const $WM_AUTOITLBUTTONUP = 0x1400 + 0x0A34
Const $WM_AUTOITRBUTTONUP = 0x1400 + 0x0A35
Const $WM_AUTOITMBUTTONUP = 0x1400 + 0x0A36
Const $WM_AUTOITXBUTTONUP = 0x1400 + 0x0A37
Const $WM_AUTOITLDBLCLK = 0x1400 + 0x0A38
Const $WM_AUTOITRDBLCLK = 0x1400 + 0x0A39
Const $WM_AUTOITMDBLCLK = 0x1400 + 0x0A3A
Const $WM_AUTOITXDBLCLK = 0x1400 + 0x0A3B
Const $WM_AUTOITMOUSEWHEELUP = 0x1400 + 0x0A3C
Const $WM_AUTOITMOUSEWHEELDOWN = 0x1400 + 0x0A3D

Global $n,$msg,$buffer = ""

HotKeySet("{ESC}","GoAway")

$gui = GUICreate("test")

Global $DLLinst = DLLCall("kernel32.dll","hwnd","LoadLibrary","str",".\hook.dll")
Global $mouseHOOKproc = DLLCall("kernel32.dll","hwnd","GetProcAddress","hwnd",$DLLInst[0],"str","MouseProc")

Global $hhMouse = DLLCall("user32.dll","hwnd","SetWindowsHookEx","int",$WH_MOUSE, _
        "hwnd",$mouseHOOKproc[0],"hwnd",$DLLinst[0],"int",0)

DLLCall(".\hook.dll","int","SetValuesMouse","hwnd",$gui,"hwnd",$hhMouse[0])

($WM_AUTOITLDBLCLK,"LEFTCLICK")
;GUIRegisterMsg($WM_AUTOITRDBLCLK,"myfunc")
;GUIRegisterMsg($WM_AUTOITMDBLCLK,"myfunc")
;GUIRegisterMsg($WM_AUTOITLBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITRBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITLBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITRBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITMBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMOUSEWHEELUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMOUSEWHEELDOWN,"myfunc")

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
WEnd

Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)
    $n += 1
    If $n > 25 Then
        $n = 25
        $buffer = StringTrimLeft($buffer,StringInStr($buffer,@LF))
    EndIf
    $buffer &= $MsgID & "," &  $WParam & "," &  $LParam & @LF
    ToolTip($buffer)
EndFunc

Func LEFTCLICK()
    Send("a")
EndFunc

Func GoAway()
    Exit
EndFunc

Func OnAutoItExit()
    DLLCall("user32.dll","int","UnhookWindowsHookEx","hwnd",$hhMouse[0])
    DLLCall("kernel32.dll","int","FreeLibrary","hwnd",$DLLinst[0])
EndFunc

ive got some error.. pls help me m8s :think:


Umbrella Member

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Get the beta: http://www.autoitscript.com/autoit3/files/beta/autoit/

Also very useful is Scite: http://www.autoitscript.com/autoit3/scite/downloads.php

Also, I'm pretty sure this won't do anything:

($WM_AUTOITLDBLCLK,"LEFTCLICK")
;GUIRegisterMsg($WM_AUTOITRDBLCLK,"myfunc")
;GUIRegisterMsg($WM_AUTOITMDBLCLK,"myfunc")
;GUIRegisterMsg($WM_AUTOITLBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITRBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITLBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITRBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMBUTTONDOWN,"myfunc")
;GUIRegisterMsg($WM_AUTOITMBUTTONUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMOUSEWHEELUP,"myfunc")
;GUIRegisterMsg($WM_AUTOITMOUSEWHEELDOWN,"myfunc")

You commented out all the useful messages (you have to register them...) and replaced them with nothing.

Edited by greenmachine

Share this post


Link to post
Share on other sites

I suppose you might be able to use _IsPressed()


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

I suppose you might be able to use _IsPressed()

how to use _IsPressed()?

sorry i'm just a noob specially with that _IsPressed() code..

:think:


Umbrella Member

Share this post


Link to post
Share on other sites

Fresh squeezed straight from the help-file. (NEEDS BETA)

Function Reference

_IsPressed

--------------------------------------------------------------------------------

Check if key has been pressed

#Include <Misc.au3>

_IsPressed($s_hexKey[, $v_dll = 'user32.dll'])

Parameters

$s_hexKey key to check for

$v_dll Optional: Handle to dll or default to user32.dll

Return Value

Success: Returns 1 if true.

Failure: Returns 0 if false.

Remarks

01 Left mouse button

02 Right mouse button

04 Middle mouse button (three-button mouse)

05 Windows 2000/XP: X1 mouse button

06 Windows 2000/XP: X2 mouse button

08 BACKSPACE key

09 TAB key

0C CLEAR key

0D ENTER key

10 SHIFT key

11 CTRL key

12 ALT key

13 PAUSE key

14 CAPS LOCK key

1B ESC key

20 SPACEBAR

21 PAGE UP key

22 PAGE DOWN key

23 END key

24 HOME key

25 LEFT ARROW key

26 UP ARROW key

27 RIGHT ARROW key

28 DOWN ARROW key

29 SELECT key

2A PRINT key

2B EXECUTE key

2C PRINT SCREEN key

2D INS key

2E DEL key

30 0 key

31 1 key

32 2 key

33 3 key

34 4 key

35 5 key

36 6 key

37 7 key

38 8 key

39 9 key

41 A key

42 B key

43 C key

44 D key

45 E key

46 F key

47 G key

48 H key

49 I key

4A J key

4B K key

4C L key

4D M key

4E N key

4F O key

50 P key

51 Q key

52 R key

53 S key

54 T key

55 U key

56 V key

57 W key

58 X key

59 Y key

5A Z key

5B Left Windows key

5C Right Windows key

60 Numeric keypad 0 key

61 Numeric keypad 1 key

62 Numeric keypad 2 key

63 Numeric keypad 3 key

64 Numeric keypad 4 key

65 Numeric keypad 5 key

66 Numeric keypad 6 key

67 Numeric keypad 7 key

68 Numeric keypad 8 key

69 Numeric keypad 9 key

6A Multiply key

6B Add key

6C Separator key

6D Subtract key

6E Decimal key

6F Divide key

70 F1 key

71 F2 key

72 F3 key

73 F4 key

74 F5 key

75 F6 key

76 F7 key

77 F8 key

78 F9 key

79 F10 key

7A F11 key

7B F12 key

7C-7F F13 key - F16 key

80H-87H F17 key - F24 key

90 NUM LOCK key

91 SCROLL LOCK key

A0 Left SHIFT key

A1 Right SHIFT key

A2 Left CONTROL key

A3 Right CONTROL key

A4 Left MENU key

A5 Right MENU key

Related

None.

Example

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("23", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

ExitLoop

EndIf

WEnd

DllClose($dll)


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

This should do it.

#include <Misc.au3>
While 1
    If _IsPressed("01") Then
sleep(250)      
Send("A")
    EndIf
    WEnd
Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

thank you very much Infinitex0!! :think:

but.. one more.. :(

is there a way to disable mouse movement?

or to disable only the left click?

thanks


Umbrella Member

Share this post


Link to post
Share on other sites

thank you very much Infinitex0!! :think:

but.. one more.. :(

is there a way to disable mouse movement?

or to disable only the left click?

thanks

You can use the _mousetrap function:

#include <Misc.au3>

_MouseTrap()

This is all, the mouse keep static.

Share this post


Link to post
Share on other sites

thanks i'm using it now!! hehe :D

MORE POWER TO ALL

AUTOit RULE

:):(;):think: !!


Umbrella Member

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