Jump to content

Recommended Posts

Posted

ok, what i am trying to do, is find the location in a file where there is 17 unknown numbers, a space, and 17 other unknown numbers.

I thought that StringRegExp could be used for it but I dont know how to use it.

Can someone PLEASE HELP

THANKS

Check out ConsultingJoe.com
Posted

maybe...

#include <file.au3>

Dim $aRecords

If Not _FileReadToArray("error.log",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

For $x = 1 to $aRecords[0]
    $split = StringSplit($aRecords[$x], " ")
    for $t = 1 to $split[0]
        If StringLen($split[$t]) = 17 Then
            If StringLen($split[$t-1]) = 17 Then
                Msgbox(0,'Record:' & $x, $aRecords[$x] & @CRLF & $split[$t] & @CRLF & $split[$t-1])
                ExitLoop
            EndIf
        EndIf
    Next
Next

8)

NEWHeader1.png

Posted

Sorry Valuater, I didn't see the link to the file. I just figured the file was too big to fit into an array. I assumed he was trying to work with a game file.

Posted

the code i gave above just worked for me... it found that same series of numbers three times

did you change this????

If Not _FileReadToArray("error.log",$aRecords) Then

Ok, yes it does work thanks, but why does it have to be in the same directory?
Check out ConsultingJoe.com
Posted

Ok, yes it does work thanks, but why does it have to be in the same directory?

It doesn't *have* to be. You just have to add code to locate the file otherwise.

Posted

geeze... want me to come over and give personal instructions...... lol

@DesktopDir & "\Server.dbs"

works if it is on your desktop... you can use any folder you want

8)

LOL, I know how to do it, thanks. I must have just done something wrong. it works great

thanks a bunch

Check out ConsultingJoe.com
  • Moderators
Posted

ok, what i am trying to do, is find the location in a file where there is 17 unknown numbers, a space, and 17 other unknown numbers.

I thought that StringRegExp could be used for it but I dont know how to use it.

Can someone PLEASE HELP

THANKS

$sString = 'adkfjow 11111111122222233 44444444445555566 aldfoi'
$aSRE = StringRegExp($sString, '([0-9]{17} [0-9]{17})', 3)
If @extended Then
    For $iCC = 0 To UBound($aSRE) - 1
        MsgBox(64, 'Info', $aSRE[$iCC])
    Next
EndIf

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.

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
×
×
  • Create New...