Wath Posted March 23, 2011 Share Posted March 23, 2011 Hi all! I need your helps! I would like to post on a GUI surface the mouse coordinates to input fields and i want them to change when I move the cursor. Could someone help me? $pos = MouseGetPos() GUICtrlCreateLabel("Mouse coord.:", 300, 5) GUICtrlCreateLabel("X:", 300, 20) GUICtrlCreateLabel("Y:", 350, 20) GUICtrlCreateInput($pos[0],275,35, 40, 20) GUICtrlCreateInput($pos[1],335,35, 40, 20) It isn't working well because it is just show the position of the mouse at one time. Thx! Wath Link to comment Share on other sites More sharing options...
JohnOne Posted March 23, 2011 Share Posted March 23, 2011 GUICtrlCreateLabel("Mouse coord.:", 300, 5) GUICtrlCreateLabel("X:", 300, 20) GUICtrlCreateLabel("Y:", 350, 20) $X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20) $y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20) While 1 $pos = MouseGetPos() GUICtrlSetData($X, $pos[0]) GUICtrlSetData($y, $pos[0]) Sleep(10) WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Wath Posted March 23, 2011 Author Share Posted March 23, 2011 GUICtrlCreateLabel("Mouse coord.:", 300, 5) GUICtrlCreateLabel("X:", 300, 20) GUICtrlCreateLabel("Y:", 350, 20) $X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20) $y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20) While 1 $pos = MouseGetPos() GUICtrlSetData($X, $pos[0]) GUICtrlSetData($y, $pos[0]) Sleep(10) WEnd Hi! I got the folowing error. $X = GUICtrlCreateInput($pos[0],275,35,40,20) $X = GUICtrlCreateInput($pos^ERROR Error: Subscript used with non-Array variable. I tried to put the while statement before the input fields but it was made unfinished loop. Link to comment Share on other sites More sharing options...
AoRaToS Posted March 23, 2011 Share Posted March 23, 2011 (edited) Try declaring $pos[2] before the whole script EDIT: Local $pos[2] $test = GUICreate("test") GUICtrlCreateLabel("Mouse coord.:", 300, 5) GUICtrlCreateLabel("X:", 300, 20) GUICtrlCreateLabel("Y:", 350, 20) $X = GUICtrlCreateInput($pos[0], 275, 35, 40, 20) $y = GUICtrlCreateInput($pos[1], 335, 35, 40, 20) GUISetState(@SW_SHOW, $test) While 1 $pos = MouseGetPos() GUICtrlSetData($X, $pos[0]) GUICtrlSetData($y, $pos[1]) Sleep(10) WEnd This works fine for me Edited March 23, 2011 by AoRaToS vicsar 1 s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
JohnOne Posted March 23, 2011 Share Posted March 23, 2011 Just change them both to $X = GUICtrlCreateInput("", 275, 35, 40, 20) and similar AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Wath Posted March 23, 2011 Author Share Posted March 23, 2011 Hi! I got the folowing error. $X = GUICtrlCreateInput($pos[0],275,35,40,20) $X = GUICtrlCreateInput($pos^ERROR Error: Subscript used with non-Array variable. I tried to put the while statement before the input fields but it was made unfinished loop. Ahh yeah now it's working well. Thx for the fast help! Link to comment Share on other sites More sharing options...
AoRaToS Posted March 23, 2011 Share Posted March 23, 2011 JohnOne you have a mistake in your previous post, you're showing same array element $pos[0] twice s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
JohnOne Posted March 23, 2011 Share Posted March 23, 2011 JohnOne you have a mistake in your previous post, you're showing same array element $pos[0] twice Indeed, I dont think thats the part the OP was having trouble with, but still.. bedtime for me AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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