millisys Posted October 3, 2014 Share Posted October 3, 2014 (edited) Hi all, I am trying to create an array from the contents of an Edit control. Using the code below, it creates the array just fine, but each of the items returned from the array contains an LF line feed after the value (except for the last one). I have tried using _GUICtrlEdit_GetText as well as different delimiters such as @CRLF and @CR but they add additional line returns either before or after as well. Thank you for your help In the code below, the MsgBox will display "word is found" instead of the desired "word is found" Local $aFindReplace $aFindReplace = StringSplit(GUICtrlRead($findreplacelist), @LF) _ArrayDisplay($aFindReplace) For $x = 1 To UBound($aFindReplace) - 1 MsgBox($MB_SYSTEMMODAL, "", $aFindReplace[$x] & " is found") Next Edited October 3, 2014 by millisys Link to comment Share on other sites More sharing options...
mikell Posted October 3, 2014 Share Posted October 3, 2014 (edited) ? #include <GUIConstantsEx.au3> #Include <Array.au3> GUICreate("My GUI edit") Local $idMyedit = GUICtrlCreateEdit("", 176, 32, 121, 97) GUISetState() GUICtrlSetData($idMyedit, "First line" & @CRLF & "Second line" & @CRLF & "Third line" & @CRLF, 1) Local $aFindReplace $aFindReplace = StringRegExp(GUICtrlRead($idMyedit), '.+', 3) _ArrayDisplay($aFindReplace) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Edited October 3, 2014 by mikell Link to comment Share on other sites More sharing options...
Zedna Posted October 3, 2014 Share Posted October 3, 2014 $aFindReplace = StringSplit(GUICtrlRead($findreplacelist), @LF) _ArrayDisplay($aFindReplace) Try this $aFindReplace = StringSplit(GUICtrlRead($findreplacelist), @CRLF, 1) or this $aFindReplace = StringSplit(StrinReplace(GUICtrlRead($findreplacelist),@CRLF,@LF), @LF) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
millisys Posted October 3, 2014 Author Share Posted October 3, 2014 Thank you so much mikell and Zedna, both of those techniques work great. Have a great weekend! 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