Frit Posted March 30, 2006 Share Posted March 30, 2006 Hi all! I want to know a simple code that isn't working here. It's about getting the mouse coordinates (mousegetpos), put them into a variable and show in a label. Global $pos HotKeySet( "{ESC}", "Exit" ) HotKeySet( "{F1}", "Getpos" ) GUICreate( 210, 100) GUICtrlCreateLabel( $pos[0] & "," & $pos[1]), 10, 10) While 1 GuiSetstate() Wend Func Getpos() $pos = MouseGetPos ( ) EndFunc While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Func Exit() Exit EndFunc Everything goes well, without any error, but the pos isn't shown in the label. Thank you. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 30, 2006 Moderators Share Posted March 30, 2006 There was actually another issue with your 'Exit' function:#include <guiconstants.au3> Global $pos HotKeySet( "{ESC}", "ExitNow" ) HotKeySet( "{F1}", "MouseSetPos" ) GUICreate( 210, 100) Global $label = GUICtrlCreateLabel('', 10, 10, 100, 20) GuiSetstate() Func MouseSetPos() Local $pos = MouseGetPos() GUICtrlSetData($label, $pos[0] & ',' & $pos[1]) EndFunc While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func ExitNow() Exit EndFunc 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...
Frit Posted March 31, 2006 Author Share Posted March 31, 2006 Hmm, thanks, works well. To do not need to make a new thread, I'll ask for something more. The following code was made to send "item1 activated" each 5 sec if It's selected in the combo. If somebody wants to help... Global $combo $combo = GUICtrlCreateCombo ("Item1", 10, 60, 100, 20) While 1 If $combo = "Item1" Then Sleep (5000) Send ("Item1 activated + {ENTER}") EndIf WEnd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 31, 2006 Moderators Share Posted March 31, 2006 If GUICtrlRead($combo) = 'Item1' Then 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...
Frit Posted March 31, 2006 Author Share Posted March 31, 2006 Ok Thank you again. 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