Psychobird25 Posted July 10, 2018 Share Posted July 10, 2018 Here's my code so far: Global $getEditGui = GUICtrlSetData(-1, "test") This initializes the GUI and sets the "test" string. Later on in the script, I use this code to record my mouse position. My goal is to print out the contents of $getCoords into the GUI without it executing it. Also, I want to make sure I can do this as many times as I want without it erasing the previous edits. My current code just prints "1" in the GUI and executes the contents of $getCoords Func getCords() Opt("MouseCoordMode", 2) WinActivate("Calculator") sleep(3000) $MousePos = MouseGetPos() $MousePos[0] ; Mouse X position $MousePos[1] ; Mouse Y position $getCoords = MouseClick("Left", $MousePos[0], $MousePos[1]) $getEditGui = GUICtrlSetData(-1, $getCoords) EndFunc Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 11, 2018 Share Posted July 11, 2018 (edited) How about something like this. $Edit = GUICtrlCreateEdit("", 176, 32, 121, 97, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) ; some code here.. $getEditGui = GUICtrlSetData($Edit, $getCoords) BTW, can you post the working code so we can see what went wrong. Edited July 11, 2018 by KickStarter15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
Subz Posted July 11, 2018 Share Posted July 11, 2018 @KickStarter15 GuictrlSetData, will overwrite the contents of the edit control, @Psychobird25 look at the _GuiCtrlEdit functions for example: https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlEdit_AppendText.htm Skeletor 1 Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 11, 2018 Share Posted July 11, 2018 Yahhh... missed that... Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 11, 2018 Share Posted July 11, 2018 (edited) @Subz@KickStarter15 Not if you set the last parameter of GUICtrlSetData() to "non-empty"... From the Help file: default [optional] Combo, List: The default value. Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret). And, this thing is showed in the GUICtrlCreateEdit() in the Help file: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered Local $idMyedit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState(@SW_SHOW) Send("{END}") ; will be append dont' forget 3rd parameter GUICtrlSetData($idMyedit, "Second line", 1) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example Best Regards. Edited July 11, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Subz Posted July 11, 2018 Share Posted July 11, 2018 The problem with this method is that it depends where the caret is, to me the GuiCtrlEdit_AppendText is more reliable. 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