joseLB Posted January 9, 2008 Posted January 9, 2008 (edited) Probably this is a very simple question to answer (maybe a dumb question? ), but I'm really confused, even after lots of AU3 scripts done... On this application I'm not using any GUI. I just want to detect mouse position on screen (MouseGetPos is OK), sometimes set mouse position (mouseMove is OK), but, how to know when right or left or middle button are clicked? It can be done in a loop, or any kind of event. In a loop, maybe a function like MouseClicked(button) returning true or false? To be used like in "if mouseclicked(left) then...." Remember, I'm not using any guy in particular, I just want to know if mouse was clicked and where in screen...Thanks in advance.Jose Edited January 9, 2008 by joseLB
james3mg Posted January 9, 2008 Posted January 9, 2008 Probably this is a very simple question to answer (maybe a dumb question? ), but I'm really confused, even after lots of AU3 scripts done... On this application I'm not using any GUI. I just want to detect mouse position on screen (MouseGetPos is OK), sometimes set mouse position (mouseMove is OK), but, how to know when right or left or middle button are clicked? It can be done in a loop, or any kind of event. In a loop, maybe a function like MouseClicked(button) returning true or false? To be used like in "if mouseclicked(left) then...." Remember, I'm not using any guy in particular, I just want to know if mouse was clicked and where in screen...Thanks in advance.Jose_IsPressed() has, I believe, the ability to check for (for instance) a left mouse click, but I just noticed that in the helpfile, the chart showing the hex codes for each button (including mouse buttons) has been removed. So I don't know which hex code you need for this event. Maybe someone has a copy of the chart somewhere...? "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
joseLB Posted January 9, 2008 Author Posted January 9, 2008 (edited) _IsPressed() has, ... in the helpfile, the chart showing the hex codes for each button (including mouse buttons) has been removed. .....Thanks James, seems that this is the answer... in my helpfile existis all the codes... Folows the ones related with the mouse: 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 Jose I glued 2 examples on this small script, and it works, the problem is that it consumes about 15-20% of cpu time.... this is direclty conected with the sleep time, but if I increase it, I loosed some clicks. #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 10 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf If _IsPressed(01, $dll) Then $pos = MouseGetPos() MsgBox(0,"_IsPressed", "Mouse Left button" & @CRLF & "Mouse x,y:" & $pos[0] & "," & $pos[1]) EndIf WEnd DllClose($dll) Edited January 10, 2008 by joseLB
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now