darksoltan Posted January 17, 2012 Share Posted January 17, 2012 Hey guys, newbY here. Quick question which has me STOMPED. Basically, I want to put GUICtrlRead($Input1) into MouseClick("left", GUICtrlRead($Input1))I like getting mouse coordinates with GUI on the fly, and would like to use the x,y stored in the input box... as coordinates in a MouseClick function later, but I can't seem to get the MouseClick to work this way, unless I input seperate variables for (x, & y). Anyway around this?expandcollapse popupHotKeySet("{F1}" , "left") Func left() MouseClick("left", $Inp1) EndFunc #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\owner\Desktop\Backup\AutoIt\Koda\Forms\test.kxf $Example = GUICreate("Example", 281, 52, 207, 139) $Button1 = GUICtrlCreateButton("Record", 160, 8, 105, 33) $Input1 = GUICtrlCreateInput("Input1", 24, 16, 129, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $Inp1 = GUICtrlRead($Input1) While 1 Global $cd = 2 ;CountDown Time $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Do GUICtrlSetData( $Button1, $cd & "..") $cd = $cd-1 sleep(1000) Until $cd = 0 GUICtrlSetData( $Button1, "Record") $pos = MouseGetPos() GUICtrlSetData( $Input1, $pos[0] & ", " & $pos[1]) EndSwitch WEndtest.au3 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 17, 2012 Share Posted January 17, 2012 Something like this?expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form=C:UsersownerDesktopBackupAutoItKodaFormstest.kxf Global Const $Example = GUICreate("Example", 281, 52, 207, 139, -1, $WS_EX_TOPMOST) Global Const $Button1 = GUICtrlCreateButton("Record", 160, 8, 105, 33) Global Const $Input1 = GUICtrlCreateInput("Input1", 24, 16, 129, 21) show_mouse_coords() GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### HotKeySet("{F1}" , "left") Global $cd While 1 $cd = 2 ;CountDown Time Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 Do GUICtrlSetData($Button1, $cd & "..") $cd = $cd - 1 Sleep(1000) Until $cd = 0 GUICtrlSetData($Button1, "Record") EndSwitch show_mouse_coords() WEnd Func left() Local Const $coords = StringSplit(GUICtrlRead($Input1), ' ') BlockInput(1) MouseClick("left", $coords[1], $coords[2]) BlockInput(0) EndFunc ;==>left Func show_mouse_coords() GUICtrlSetData($Input1, MouseGetPos(0) & ", " & MouseGetPos(1)) EndFunc Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
darksoltan Posted January 17, 2012 Author Share Posted January 17, 2012 Hey Lacastiglione, Thx A Lot! Not exactly what I asked for, but it got me what I wanted. What I was looking for was the StringSplit(GUICtrlRead($Input1), ' ') command, which I didn't know existed till now. Also thx for cleaning up my code, I'm just copy&pasting what works with no code etiquete, but now im getting it. This is what I was looking for:#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:UsersownerDesktopBackupAutoItKodaFormstest.kxf Global Const $Example = GUICreate("Example", 281, 52, 207, 139, -1, $WS_EX_TOPMOST) Global Const $Button1 = GUICtrlCreateButton("Record", 160, 8, 105, 33) Global Const $Input1 = GUICtrlCreateInput("", 24, 16, 129, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet("{F1}" , "left") Global $cd While 1 $cd = 2 ;CountDown Time Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 Do GUICtrlSetData( $Button1, $cd & "..") $cd = $cd-1 sleep(1000) Until $cd = 0 GUICtrlSetData( $Button1, "Record") GUICtrlSetData( $Input1, MouseGetPos(0) & ", " & MouseGetPos(1)) EndSwitch WEnd Func left() Local Const $coords = StringSplit(GUICtrlRead($Input1), ' ') MouseClick("left", $coords[1], $coords[2]) EndFunc Link to comment Share on other sites More sharing options...
darksoltan Posted January 17, 2012 Author Share Posted January 17, 2012 also, how do you paste code in color? Newbdome... we meet again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2012 Moderators Share Posted January 17, 2012 darksoltan, Put [autoit] before and [/autoit] after your posted code and you get the coloured syntax. Newbdome... we meet againI am sure that you will get over it soon! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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