topten Posted February 10, 2015 Share Posted February 10, 2015 I read a text from file $readfile = FileRead("mytext.txt") $aOutPut1 = StringRegExp($readfile, '>(.*?)<', 3) Global $messageproj = $aOutPut1[0] Global $messageproj2 = $aOutPut1[2] As a result I have this text in var: "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3" Then later I am trying to display the information on the gui $label = GUICtrlCreateLabel($aOutPut1[2], 25, 30, 480, 140) My idea is display it this way Line1 Line2 Line3 But instead I am still getting this "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3" Can it work this way? Line1 Line2 Line3 Link to comment Share on other sites More sharing options...
orbs Posted February 10, 2015 Share Posted February 10, 2015 you can have either a multiline label (search the forum for examples), or an Edit control - possibly with customized background color and borders, and with $ES_READONLY style. personally i find the latter easier. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
kylomas Posted February 10, 2015 Share Posted February 10, 2015 topten, Verify the content of your variables. For more help post a runnable reproducer. This works for me... #include <GUIConstantsEx.au3> local $var = "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3" local $gui010 = guicreate('',200,200) local $lbl010 = guictrlcreatelabel($var,0,0,200,200) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch WEnd kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
topten Posted February 10, 2015 Author Share Posted February 10, 2015 (edited) Thank you, kylomas, I understand what you mean, but if you do it this way: #include <GUIConstantsEx.au3> $var = FileRead ("save1.txt"); in the file I have record "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3" local $gui010 = guicreate('',200,200) local $lbl010 = guictrlcreatelabel($var,0,0,200,200) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch WEnd Then it won't work. May be I should use some different way of data reading? Edited February 10, 2015 by topten Link to comment Share on other sites More sharing options...
MikahS Posted February 10, 2015 Share Posted February 10, 2015 worked for me as shown. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
topten Posted February 10, 2015 Author Share Posted February 10, 2015 Heh, Fantastic! Thanks a lot MikahS. Just in case if you know, How did it consider the line break from the txt file and ignored @CRLF to be used then as a part of the code after having been read from the file? Link to comment Share on other sites More sharing options...
MikahS Posted February 10, 2015 Share Posted February 10, 2015 (edited) I did nothing out of the ordinary. here is the code I used to show you that example. #include <GUIConstantsEx.au3> Local $var = FileRead("C:\Users\STAT001\Desktop\body.txt") Local $gui010 = GUICreate('', 200, 200) Local $lbl010 = GUICtrlCreateLabel($var, 0, 0, 200, 200) GUISetState() While 1 Switch GUIGetMsg() Case $gui_event_close Exit EndSwitch WEnd So, I would think it would work with your file. If it still doesn't, any chance you could reproduce a similar file that shows this behavior? Edited February 10, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
topten Posted February 10, 2015 Author Share Posted February 10, 2015 Yes, it works for me too! Thanx! Link to comment Share on other sites More sharing options...
MikahS Posted February 10, 2015 Share Posted February 10, 2015 Glad it works. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ 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