joeyone Posted October 10, 2007 Share Posted October 10, 2007 if i want to record the mousecursor xy position by only left clicking with the mouse is this possible if its possible what code to use? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 10, 2007 Moderators Share Posted October 10, 2007 if i want to record the mousecursor xy position by only left clicking with the mouse is this possible if its possible what code to use?Loop (Or AdlibEnable) + _IsPressed() + MouseGetPos() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
joeyone Posted October 10, 2007 Author Share Posted October 10, 2007 Loop (Or AdlibEnable) + _IsPressed() + MouseGetPos()i think this will work but i have som problem with the loopi can only get it to click one time then the script shuts downi want it to track for mouseclicks more than ones how can i be able to do that?code #include <Misc.au3>$dll = DllOpen("user32.dll")While 1 If _IsPressed("01", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIfWEndDllClose($dll) Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 10, 2007 Share Posted October 10, 2007 i think this will work but i have som problem with the loop i can only get it to click one time then the script shuts down i want it to track for mouseclicks more than ones how can i be able to do that? code #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll) Didn't spend much time thinking about what the _IsPressed() example from the help file was doing...? Take out the ExitLoop, and get the mouse pos: #include <Misc.au3> HotKeySet("{END}", "_Quit") ; Hit "END" to quit $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $avMousePos = MouseGetPos() ToolTip("x = " & $avMousePos[0] & " y = " & $avMousePos[1]) EndIf WEnd Func _Quit() DllClose($dll) Exit EndFunc ;==>_Quit Diceyus 1 Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
joeyone Posted October 10, 2007 Author Share Posted October 10, 2007 (edited) Didn't spend much time thinking about what the _IsPressed() example from the help file was doing...? Take out the ExitLoop, and get the mouse pos: #include <Misc.au3> HotKeySet("{END}", "_Quit") ; Hit "END" to quit $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $avMousePos = MouseGetPos() ToolTip("x = " & $avMousePos[0] & " y = " & $avMousePos[1]) EndIf WEnd Func _Quit() DllClose($dll) Exit EndFunc ;==>_Quit it works well. the only problem is that it saves down the mouse position multiple times for each position click in my ini file i write the position information to is it possible to just write down just one record of each mouseclick and not multiple for each click? #include <Misc.au3> $idnumber = 0 $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $avMousePos = MouseGetPos() $posx = $avMousePos[0] $posy = $avMousePos[1] $idnumber += 1 IniWrite("C:\Documents and Settings\Skrivbord\position.ini",";" & $idnumber ,"pos " , "MouseClick("&"left , "& $posx & ", " & $posy &", 1, 1)") sleep(100) EndIf WEnd Func _Quit() DllClose($dll) Exit EndFunc;==>_Quit Edited October 10, 2007 by joeyone Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 10, 2007 Share Posted October 10, 2007 it works well. the only problem is that it saves down the mouse position multiple times for each position click in my ini file i write the position information to is it possible to just write down just one record of each mouseclick and not multiple for each click? Yeah, the script loops many times before you can get your finger off the button. Try it this way: #include <Misc.au3> HotKeySet("{END}", "_Quit") ; Hit "END" to quit $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $avMousePos = MouseGetPos() ToolTip("x = " & $avMousePos[0] & " y = " & $avMousePos[1]) Do Until Not _IsPressed("01", $dll) EndIf WEnd Func _Quit() DllClose($dll) Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PilotPen Posted August 16, 2019 Share Posted August 16, 2019 Quote On 10/10/2007 at 10:59 PM, PsaltyDS said: #include <Misc.au3> HotKeySet("{END}", "_Quit") ; Hit "END" to quit $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $avMousePos = MouseGetPos() ToolTip("x = " & $avMousePos[0] & " y = " & $avMousePos[1]) Do Until Not _IsPressed("01", $dll) EndIf WEnd Func _Quit() DllClose($dll) Exit EndFunc ;==>_Quit Thankyou but this didnt work, still stuck in loop. Link to comment Share on other sites More sharing options...
jchd Posted August 16, 2019 Share Posted August 16, 2019 Record 12-y necropost. FrancescoDiMuro and Xandy 1 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Werty Posted August 17, 2019 Share Posted August 17, 2019 1 hour ago, jchd said: Record 12-y necropost. Yea, "Wow, PSaltyDS is back....!!!!" ohh, no his not :/ Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
junkew Posted August 18, 2019 Share Posted August 18, 2019 (edited) joey back then😀https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_SetWindowsHookEx.htm Hook the mouse Edited August 18, 2019 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
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