Jump to content

best way to parse through or datamine files


Recommended Posts

Ok, I've promised myself yesterday that I won't continue on this thread just to find myself breaking that promise.

I don't have time to work on your text file and your script. The best I could do is to build you a demo script.

It adds a random number of lines to a text files and reads the new added lines everytime the function Test() is called.

It is your job to do the text processing and whatever else it takes to get it working.

Here is the demo:

edit: Code removed: waste of my time.

Good luck,

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

thank you enaiman. will try to understand the relation between that and my code and problem. >_<

does anyone else know if i should replace $txtread that was left in there with $asArray? because it would be great if someone could help me with the problem im having in my code rather than posting irrelevant code which starts me from square one again....

Edited by Hypertrophy
Link to comment
Share on other sites

wow.

i modified his code to the below and what do i get? the same problem. this is bullshit how i cant do something so simple thats so many programs are doing and im having trouble because its throwing up a msgbox() a billion times. if im doing it wrong can someone please slap the fuck out of me show me the correct way and tell me this: How do I read a file and compare it to my INI. If keys in INI match words in hand history file then go throw up a msgbox() once for that specific key.

His modified code:

#include <File.au3>
#include <Array.au3>

Global $txtfile = "c:\test.txt"
Global $dat = "c:\indicators.dat"
Global $count = 1
$file = FileOpen($txtfile, 0)
FileClose($file)
;===================================
Global $begin = 0

Test()

Func Test()
    Dim $NewText[1000], $asArray
    _FileReadToArray($txtfile,$asArray)         ;read whole file
    Local $NewTextCounter = 1                   ;initialize the counter for $NewText array
    For $i = $begin + 1 To $asArray[0]          ;from the "last line" +1 (+1 gives the begining of the new block) to the end of file
        $NewText[$NewTextCounter]=$asArray[$i]  ;put the next lines into the new array
        $NewTextCounter += 1                    ;increment the counter
        $section = IniReadSection($dat, "Player Indicators")
        If IsArray($section) Then
            For $y=1 To $section[0][0]
                If StringInStr($asArray[$i], $section[$y][0]) Then
                    MsgBox(0,"Throwing up...", $section[$y][1])
                EndIf
            Next
        EndIf
    Next
    ReDim $NewText[$NewTextCounter]
    _ArrayDisplay($NewText, "New text in the file")
    $begin = $asArray[0]                        ;"LAST line" number
EndFunc
Edited by Hypertrophy
Link to comment
Share on other sites

Look at my code because it really does what you need. Try to understand it.

When you don't know why a script is not doing what you want - just messageboxes everywhere and you'll end up isolating the error.

edit: Code removed: waste of my time.

and about

posting irrelevant code which starts me from square one again....

you might want to think again about that statement because nothing was irrelevant. I will never do somebody else's work but helping them to understand how to do it. >_<

By the way: this is the content I've used for indicators.dat

[Player Indicators]

player1=bill

player2=bob

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Damn. I know I've explained myself well everytime out of the 20 posts I've made and I guess I'm the only one that understands. It is going to find a players name MULTIPLE TIMES at the table because as long as he's AT THE TABLE he will be written to in the hand history file. this is a problem i suppose because then it will want to throw up 3 msgbox()'s like it did in your example. Which is totally a script-breaker for me because I may want it to throw up a picture! And then I'm screwed because it'll throw up 3 of the same pictures....

Obviously there's a way around this because little shitty programs are doing this with ease.

Edit: And yeah, I saw your code.

Edited by Hypertrophy
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...