Jump to content

Programming a mouse


Recommended Posts

I have the Logitech MX400 laser mouse, but can't program it with application specific settings. Yes I have UberOptions installed in SetPoint, but because SetPoint is so badly bugged, UberOptions doesn't work.

I figured I would script my own utility to provide the functionality I want, so I started looking throught the AutoIt help file to get me started. The problem is there doesn't seem to be any support for capturing mouse clicks, only simulating them to automate things. Even then, there doesn't seem to be support for more than 5 buttons. My mouse has tilt wheel, plus back/forward thumb buttons.

So can AutoIt do what I need?

Link to comment
Share on other sites

Well, since no one has replied to this post, I'll give a shot at giving you ideas. Your obviously not going to be using a GUI (i'm guessing), but if you are, simply use GUIGetCursorInfo(). Other than that, I cannot think of a way to capture mouse clicks, but there is a way to capture movement of the mouse. I use this for a program I created, it repeatedly sounds a ringing until the mouse position has moved.

$pos2= MouseGetPos()
$pos = MouseGetPos();Retrieve position of mouse
While CheckPos($pos[0], $pos2[0], $pos[1], $pos2[1]) = -1 ;CheckPos is used to see if the mouse moved
    SoundPlay(@WindowsDir & "\Media\RINGOUT.wav")
    Sleep(650) ;Play a sound every 650 milliseconds if the mouse hasn't moved since it's original position
    $pos2 = MouseGetPos()
WEnd

Func CheckPos($1, $2, $3, $4)
    If $1 = $2 AND $3 = $4 Then
        Return -1
    Else
        Return 1
    EndIf
EndFunc

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

Thanks for the replys. Looks like MouseHook is what I need. I'll try it and see.

I'd like to build a GUI eventually to make programming the mouse easier and to save different profiles, plus I don't want to have to hardcode mouse settings and edit the code for different games/keystroke assignments. I can do a GUI rather easily I'm sure, but I'll need to get the mousehooks working first.

Edited by SyntaxError
Link to comment
Share on other sites

Is there an app out there than can catch the codes sent when a mouse button is pressed. Google isn't showing anything. If I could find out the codes, I'm sure I could do what I need. I've looked for the following in the AutoIt help file:

$WM_AUTOITLBUTTONDOWN
$WM_AUTOITRBUTTONDOWN
$WM_AUTOITMBUTTONDOWN
$WM_AUTOITXBUTTONDOWN1
$WM_AUTOITXBUTTONDOWN2
$WM_AUTOITLBUTTONUP
$WM_AUTOITRBUTTONUP
$WM_AUTOITMBUTTONUP
$WM_AUTOITXBUTTONUP1
$WM_AUTOITXBUTTONUP2
$WM_AUTOITLDBLCLK
$WM_AUTOITRDBLCLK
$WM_AUTOITMDBLCLK
$WM_AUTOITXDBLCLK1
$WM_AUTOITXDBLCLK2
$WM_AUTOITMOUSEWHEELUP
$WM_AUTOITMOUSEWHEELDOWN

but couldn't find anything. Where does this info and the hex numbers after that come from? And why does the EDIT button keep vanishing from my posts? I hate posting like this, when I could otherwise edit an existing post.

Edited by SyntaxError
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...