eleria Posted May 24, 2008 Share Posted May 24, 2008 Hi guys I would like to know the fastest way to use MouseGetPos everytime the user moves a bit (I know WM_MouseMove the problem is that it just sucks CPU cycles like no tomorrow and sleeps make the whole script hog at times... ) You know in drawing softwares they display Mouse X Y coords without using any ressource... is it possible with AU3 ? Link to comment Share on other sites More sharing options...
rawrr Posted May 24, 2008 Share Posted May 24, 2008 (edited) HotKeySet("{INS}","Pos") Func Pos() $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) EndFunc While 1 WEnd For some reason I'm blanking out and can't think of how to make it work without the While 1 but this works fine.. Btw, just press Insert and a message box will come up telling you your mouse's cords.. Edited May 24, 2008 by rawrr Link to comment Share on other sites More sharing options...
ProgAndy Posted May 24, 2008 Share Posted May 24, 2008 (edited) I think, you mean this way: A sleep of 10ms is so less you can't feel it, when you use the Script. $savepos = MouseGetPos() $SaveColor = PixelGetColor($savepos[0],$savepos[1]) While 1 Sleep(10) $pos = MouseGetPos() $color = PixelGetColor($pos[0],$pos[1]) If $savepos[0] <> $pos[0] Or $savepos[1] <> $pos[1] Or $color <> $SaveColor Then ToolTip("X: " & $pos[0] & @CRLF & "Y: " & $pos[1] & @CRLF & "Color: 0x" &Hex($color)) $savepos = $pos $SaveColor = $color EndIf WEnd Edited May 24, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
LongBowNZ Posted May 25, 2008 Share Posted May 25, 2008 (edited) This works for me but I haven't tried the other ones which are probably better #include <GUIConstantsEx.au3> AutoItSetOption("MouseCoordMode", 2) GUICreate("TEST", 500, 500, -1, -1) $label = GUICtrlCreateLabel("", 50, 50, 100, 20) GUISetState() AdlibEnable("MousePos", 10) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE AdlibDisable() Exit EndSelect WEnd Func MousePos() $pos = MouseGetPos() GUICtrlSetData($label, $pos[0] & "," & $pos[1]) EndFunc Edited May 25, 2008 by LongBowNZ Link to comment Share on other sites More sharing options...
eleria Posted May 27, 2008 Author Share Posted May 27, 2008 (edited) Well I think the best conditional statement is an addition of both x and ySwitch ($savepos[0] + $savepos[1]) <> ($pos[0] + $pos[1])) Edited May 27, 2008 by eleria 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