Sign in to follow this  
Followers 0

Carriage Return doesn't work in GUICtrlCreateInput?

5 posts in this topic

I am trying to do a search and display function but somehow GUICtrlCreateInput doesn't display any

Carriage Return even though Carriage Return is correct when display on a msgbox.

I have attach my code here. Can anyone help me on my code? Copy the code and save as "search for line.au3". When you run the file it will search the source code for the lines at the last rows within the comment section.

#include <GUIConstants.au3>

#include <file.au3>

Dim $aRecords, $gettext, $lineNo

GUICreate(" My GUI input acceptfile",500,400)

GUICtrlCreateInput ("12121212", 10, 35, 300, 20)

GUISetState ()

$runfile="search for line.au3"

If Not _FileReadToArray($runfile,$aRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)



For $x = 1 to $aRecords[0]

;$chktext1=msgbox(0,'8', $aRecords[$x],1)

$CHECK_SRC_1 = StringInStr($aRecords[$x], "Rem=lin")


; grab the desired header lines

if $CHECK_SRC_1 <> 0 Then

$READ_SRC_1 = $aRecords[$x]

$gettext=$gettext& @LF &$READ_SRC_1


; MsgBox(0,"17",$gettext& @LF &$lineNo)



; MsgBox(0,"",$gettext)

$file = FileOpen($runfile, 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")



; Read in lines of text until the EOF is reached



While 1


$line = FileReadLine($file,$lineNo)

$result = StringLeft($line, 4)

; MsgBox(0, "check line","")

if $result="[Rec" then exitloop

$gettext=$gettext&$line& Chr(13) &""

; MsgBox(1, $lineNo, $gettext)

If @error = -1 Then ExitLoop



GUICtrlCreateInput ( $gettext, 100,100,200,200,$ES_MULTILINE)

MsgBox(0, "Line read:", $gettext)








Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

Can you use code tags? [ code] before code and [ /code] after code without spaces.


Try @CRLF instead of Chr(13) (@CR), what does that do for you?

Edited by SmOke_N

[center]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.[/center]

Share this post

Link to post
Share on other sites

GUICtrlCreateInput must include style $ES_MULTILINE

$ES_MULTILINE is there. Read my code. :D

Share this post

Link to post
Share on other sites

SmOke_N I tried your idea and it work! Thanks for helping! :D

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0