Jump to content
Sign in to follow this  

very new please help asap

Recommended Posts


im really new, and im trying to read a string between two delimeters such as >"string to read"<

for instance im trying to read the string 939 into an excel file <1C>Da939<1C>. i want to search based on the Da because there will be multiple lines of <1C>Da****<1C> but only one per line. and the numbers after the da is unknown.

Pleas help

Edited by urikorulzs2

Share this post

Link to post
Share on other sites

What you are trying to do is quite easy with AutoIt. Below is a basic example of how this could be done. You will need to change the filenames etc. Check the help file for details of the functions used and more advanced usage.

#Include <Excel.au3>
#Include <string.au3>

Local $sData = ""
Local $aExtracted = 0
Local $oExcel = 0

;Read the file to be processed
$sData = FileRead("C:\somefile.dat")
;Extract the dat we want into an array
$aExtracted = _StringBetween($sData,"<1C>Da","<1C>")
;check that some data was found
If Not @error Then
    ;Save the found values to a new excel spreadsheet
    $oExcel = _ExcelBookNew()
    _ExcelWriteArray($oExcel, 1, 1, $aExtracted)
    _ExcelBookSaveAs($oExcel, "C:\myexcelfile,xls")

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post

Link to post
Share on other sites

thanks so much that was very helpful.

i have another one though, what if i want to search that same txt file for the same string.

difference is an excel file will hold that 939 value and i want it to find it in the txt file.

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