mike1234 Posted October 7, 2009 Posted October 7, 2009 I have tried to do my due diligance but can not find a way to use the mouse click as a qualifier for logic in code. Can anyone give me an example of using right and/or left mouse click as an intilizer of a function. Similar to a hot key can I say if the user right clicks at anywhere in these coordinates do function A, if they left click in any of these coordinates do function B? Thanks
Zedna Posted October 7, 2009 Posted October 7, 2009 Look at _IsPressed() in the helpfile. Resources UDF ResourcesEx UDF AutoIt Forum Search
mike1234 Posted October 7, 2009 Author Posted October 7, 2009 But doesnt _IsPressed only monitor for clicks. The right click still registers on the system so for instance in the app I am trying to interface with the right click menu still launches.
JRowe Posted October 7, 2009 Posted October 7, 2009 Check out this UDF: http://www.autoitscript.com/forum/index.php?showtopic=64738 It allows you to handle mouse events. It's very easy, I recommend playing with the examples first to see how they work. Good luck. Disabling a program's context menu might not be the best idea in the world, because you're tearing a chunk of intended functionality out of it. A hotkey launched menu might be a better route. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
Zedna Posted October 7, 2009 Posted October 7, 2009 (edited) Also look at hook#733299 Edited October 7, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Malkey Posted October 8, 2009 Posted October 8, 2009 I have tried to do my due diligance but can not find a way to use the mouse click as a qualifier for logic in code. Can anyone give me an example of using right and/or left mouse click as an intilizer of a function. Similar to a hot key can I say if the user right clicks at anywhere in these coordinates do function A, if they left click in any of these coordinates do function B? Thanks This is a method. expandcollapse popup; #include <Misc.au3> Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client Do $aMP = MouseGetPos() ; For ToolTip use Select Case _IsPressed("1B"); Esc to exit Exit Case _WinAPI_PtInRectEx($aMP[0], $aMP[1], 0, 0, 200, 200); Top left corner of Screen ToolTip("Target Area") Select Case _IsPressed("01") Do Sleep(10) Until Not _IsPressed("01") ToolTip("") MsgBox(0, "", "Left mouse button pressed within target area", 3, WinGetHandle("")) Case _IsPressed("02") Do Sleep(10) Until Not _IsPressed("02") MsgBox(0, "", "Right mouse button pressed within target area", 3, WinGetHandle("")) EndSelect Case Not _WinAPI_PtInRectEx($aMP[0], $aMP[1], 0, 0, 200, 200) ToolTip("") EndSelect Sleep(10) Until 0 Func _WinAPI_PtInRectEx($iX, $iY, $iLeft, $iTop, $iWidth, $iHeight) Local $aResult, $tagREC = "int Left;int Top;int Right;int Bottom" Local $tRect = DllStructCreate($tagREC) DllStructSetData($tRect, "Left", $iLeft) DllStructSetData($tRect, "Top", $iTop) DllStructSetData($tRect, "Right", $iLeft + $iWidth) DllStructSetData($tRect, "Bottom", $iTop + $iHeight) $aResult = DllCall("User32.dll", "int", "PtInRect", "ptr", DllStructGetPtr($tRect), "int", $iX, "int", $iY) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinAPI_PtInRectEx ;
mike1234 Posted October 8, 2009 Author Posted October 8, 2009 Excelent should be all the info I need. Thanks
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