William Wise Posted December 25, 2005 Posted December 25, 2005 Hi Folks, I'm a newbie so please be kind! :-) I need to prompt the user to click the left mouse button and then grab the mouse coordinates of where they clicked. Any help? (I need to do this twice to get the start and stop locations for a drag and drop operation.) Kind Regards, Will
JSThePatriot Posted December 25, 2005 Posted December 25, 2005 Take a peek in the helpfile at the following functions. MsgBox() MouseGetPos() MouseClickDrag() Something along those lines. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
herewasplato Posted December 26, 2005 Posted December 26, 2005 (edited) Welcome to the forums.You might try this code. (Change it as you need.)expandcollapse popup;see the help file (desktop / app window?) AutoItSetOption("MouseCoordMode", 1) ;this loop repeats until a left mouse click occurs Do $pos1 = MouseGetPos() ToolTip("Click on first position." & @CR & _ "Desktop X: " & $pos1[0] & ", " & "Y: " & $pos1[1]) Sleep(10) Until _IsPressed('01') $pos1 = MouseGetPos() ;this loop repeats unitl the left mouse click is released Do Sleep(10) Until Not _IsPressed('01') ;this loop repeats until a left mouse click occurs again Do $pos2 = MouseGetPos() ToolTip("Click on second position." & @CR & _ "Desktop X: " & $pos2[0] & ", " & "Y: " & $pos2[1]) Sleep(10) Until _IsPressed('01') $pos2 = MouseGetPos() ToolTip("") MsgBox(0, "1st", "Desktop X: " & $pos1[0] & ", " & "Y: " & $pos1[1]) MsgBox(0, "2nd", "Desktop X: " & $pos2[0] & ", " & "Y: " & $pos2[1]) ;UDF by ezzetabi Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;==>_IsPressedYou can read more about ezzetabi's "IsPressed" UDF here:http://www.autoitscript.com/forum/index.php?showtopic=5760 Edited December 26, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
William Wise Posted December 26, 2005 Author Posted December 26, 2005 Thanks much. Works great! Is there a GUI builder for AutoIT ala VB6? This would be a fantastic addition! Will
herewasplato Posted December 26, 2005 Posted December 26, 2005 Thanks much. Works great!Is there a GUI builder for AutoIT ala VB6? This would be a fantastic addition!WillCheckout the SciTE4AutoIt3 editor:http://www.autoitscript.com/autoit3/scite/Then look thru the tools in the menu bar for "GuiBuilder". [size="1"][font="Arial"].[u].[/u][/font][/size]
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