Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Finding Line number of string in txt file

$
0
0

Hi guys, 

 

I have been trying to sort out this issue for a while.  I've tried a bunch of different examples but none have worked.  I have a rather large script at the moment so I will attempt to post the part I'm having issue with.  I have an xml file I need to read from and get the line number of a certain string so I can use the stringmid function to get the account number on that line.  So I need to find the line number of "<RogCustomerAcctNum>".  Once I have that I can use Stringmid to get the 9 digit account number on that line.  Any help would be greatly appreciated.  There will be other line numbers I will need to get as well and hopefully with a little help on this one line will help me get the line number to the other numbers I need.   Also, the "<RogCustomerAcctNum>" isn't always on the same line on that file.  I need to set $accountline to the line number.

 

 

Thanks in advance.

 

Local $sFilePath3 = $SUITEFOLDER & $FOLDERCOUNT & "\RecordData.xml"
 
Local $hFileOpen1 = FileOpen($sFilePath3, $FO_READ)
$sFileRead1 = FileReadLine($hFileOpen1, 2)
$WORKORDER = StringMid($sFileRead1, 16, 13)
$sFileRead2 = FileReadLine($hFileOpen1, 39)
$AREA = StringMid($sFileRead2, 24, 3)
$accountline = ""
$sFileRead3 = FileReadLine($hFileOpen1, $accountline)
$ACCOUNT = StringMid($sFileRead3, 29, 9)
 
 

Viewing all articles
Browse latest Browse all 12506

Trending Articles