Nezoic Posted August 16, 2005 Share Posted August 16, 2005 (edited) Alright, I'm trying to learn a few things, so I figured Id try to mimic a program I like to use called Mouse Machine, which basically shows your X, Y mouse coordinanse in 2 small boxes in realtime and allows you to copy those locations and have the mouse click there ect.... I can get it to constantly update via making new GUI Labels over and over in a loop, but I cannot seem to find a way to just update those values without having to use the GUICtrlCreate function. #include <GUIConstants.au3> GUICreate("Mouse Coord test", 400, 200) GUICtrlCreateButton("OK", 230, 165, 160) GUISetState(@SW_SHOW) while 1 $pos = MouseGetPos() $xPos = GUICtrlCreateInput ( $pos[0], 10, 15, 40, 20) $yPos = GUICtrlCreateInput ( $pos[1], 50, 15, 40, 20) sleep(1) Wend Also the dats seems a bit fuzzy in the input boxes, maybe just from making new boxes over and over Edited August 16, 2005 by Nezoic Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 16, 2005 Share Posted August 16, 2005 Have you checked into ToolTips? While 1 $mPos = MouseGetPos() ToolTip("x: " & $mPos[0] & @CRLF & "y: " & $mPos[1]) WEnd I tested the above code and it looks very nice. You can use the x, y parameters of ToolTip() to place the box in a corner of a screen if you would like. Otherwise it will follow the mouse. Use HotKeySet() to setup a button press to use to copy the mouse coordinates as needed. I hope this helps, 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) Link to comment Share on other sites More sharing options...
Josbe Posted August 16, 2005 Share Posted August 16, 2005 My suggestion is: Read about GUICtrlSetData() function and how that function works.Check the code and look the changes:NOTE: GUIGetMsg() was added for 'close' the window only.#include <GUIConstants.au3> GUICreate("Mouse Coord test", 400, 200) $btnOK = GUICtrlCreateButton("OK", 230, 165, 160) $xPos = GUICtrlCreateInput ( 0, 10, 15, 40, 20); creation of control for X pos (once) $yPos = GUICtrlCreateInput ( 0, 50, 15, 40, 20); creation of control for Y pos (once) GUISetState() while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop;for close the window $pos = MouseGetPos() GUICtrlSetData($xPos, $pos[0]); set the data(xPos) to this input GUICtrlSetData($yPos, $pos[1]); set the data(yPos) to this input sleep(10) Wend Exit AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Nezoic Posted August 16, 2005 Author Share Posted August 16, 2005 My suggestion is: Read about GUICtrlSetData() function and how that function works.Check the code and look the changes:NOTE: GUIGetMsg() was added for 'close' the window only.#include <GUIConstants.au3> GUICreate("Mouse Coord test", 400, 200) $btnOK = GUICtrlCreateButton("OK", 230, 165, 160) $xPos = GUICtrlCreateInput ( 0, 10, 15, 40, 20); creation of control for X pos (once) $yPos = GUICtrlCreateInput ( 0, 50, 15, 40, 20); creation of control for Y pos (once) GUISetState() while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop;for close the window $pos = MouseGetPos() GUICtrlSetData($xPos, $pos[0]); set the data(xPos) to this input GUICtrlSetData($yPos, $pos[1]); set the data(yPos) to this input sleep(10) Wend Exit<{POST_SNAPBACK}>Yeah I was just playing with GUICtrlSetData, couldn't get it to update right tho. Thanks a ton. Link to comment Share on other sites More sharing options...
rmorrow Posted August 16, 2005 Share Posted August 16, 2005 While 1 $mPos = MouseGetPos() ToolTip("x: " & $mPos[0] & @CRLF & "y: " & $mPos[1]) Sleep(10) WEnd Without a Sleep call it eats the CPU. 10 ms is enough to calm it down to under 1% CPU while seeming almost as fluid as without it. Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 17, 2005 Share Posted August 17, 2005 While 1 $mPos = MouseGetPos() ToolTip("x: " & $mPos[0] & @CRLF & "y: " & $mPos[1]) Sleep(10) WEndWithout a Sleep call it eats the CPU. 10 ms is enough to calm it down to under 1% CPU while seeming almost as fluid as without it.<{POST_SNAPBACK}>Aye that you are correct in... I didnt think about that at the time I wrote the script. I was in too much of a hurry to think that far into it 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) 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