Jump to content

Carriage Return doesn't work in GUICtrlCreateInput?


 Share

Recommended Posts

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)

Exit

EndIf

For $x = 1 to $aRecords[0]

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

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

;msgbox(0,"11",$CHECK_SRC_1,1)

; grab the desired header lines

if $CHECK_SRC_1 <> 0 Then

$READ_SRC_1 = $aRecords[$x]

$gettext=$gettext& @LF &$READ_SRC_1

$lineNo=$x

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

EndIf

Next

; MsgBox(0,"",$gettext)

$file = FileOpen($runfile, 0)

If $file = -1 Then

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

Exit

EndIf

; Read in lines of text until the EOF is reached

$lineNo=$lineNo-1

$gettext=""

While 1

$lineNo=$lineNo+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

Wend

FileClose($file)

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

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

#cs

Rem=line1

lin222

lin3

lineee44

[Rec11]

#ce

Link to comment
Share on other sites

  • Moderators

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

Edit:

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

Edited by SmOke_N

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...