Jump to content
Sign in to follow this  
viper8907

Getting large amounts of text from a txt file

Recommended Posts

viper8907

i have a proble here i have a text file, which is already opened, that i need to get into a variable ,$text , i cant use Wingettext because that is limited to 64Kb i tried using FileRead("filename", Filegetsize("filename") but it seems that it only returns 64KB also. Are there any other ways to get the job done?

Thanks

Viper8907

Share this post


Link to post
Share on other sites
buzz44
FileRead("filename.txt", FileGetSize("filename.txt")) should work, what version of AutoIt are you using, do you have a copy of the file to post?

qq

Share this post


Link to post
Share on other sites
viper8907

I am using version 3.1.1 heres the text i am trying to read(attached). what i am trying to do is i play poker on pokerstars, and i like to keep track of my play money stats and real money however with the program i use it doesnt let me import play money hand histories. so i made a script that adds the dollars signs an such to make it look like a real money have and then i import it into the statistics manager(obviously into a separate database) but when i get a file that is over 64kb it cuts it off when i read it. i dont know if im doing some thing wrong or what

$text = Fileread($sfile, Filegetsize($sfile));reads the file selected in a different part of the script
$n = 0; from here down is the editing part
For $n = 1 To 9 Step 1
    $search = "(" & $n
    $replace = "($" & $n
    $text = StringReplace($text, $search, $replace)
Next
$text = StringReplace($text, "($5/10)", "($5/$10)")
$text = StringReplace($text, "($100/200)", "($100/$200)")
$text = StringReplace($text, "posts small blind ", "posts small blind $") 
$text = StringReplace($text, "posts big blind ", "posts big blind $") 
$text = StringReplace($text, "posts small & big blinds ", "posts small & big blinds $") 
$text = StringReplace($text, "bets ", "bets $")
$text = StringReplace($text, "calls ", "calls $")
$text = StringReplace($text, "raises ", "raises $")
$text = StringReplace($text, "Total pot ", "Total pot $")    
$text = StringReplace($text, "Main pot ", "Main pot $", 0, 1)
$text = StringReplace($text, "Side pot ", "Side pot $", 0, 1)
$text = StringReplace($text, "Rake ", "Rake $")
$sid = 0
For $sid = 1 To 8 Step 1
    $search = "Side pot-" & $sid & " "
    $replace = $search & "$"
    $text = StringReplace($text, $search, $replace, 0, 1) 
Next
$col = 0
For $col = 1 To 9 Step 1
    $search = "collected " & $col
    $replace = "collected $" & $col
    $text = StringReplace($text, $search, $replace)
Next    
$to = 0
For $to = 0 To 9 Step 1
    $search = $to & " to "
    $replace = $search & "$"
    $text = StringReplace($text, $search, $replace)
Next
$text = StringReplace($text, " (Play Money)", "");editing ends here
ControlSetText("HH", "", 59648, $text); takes the string that was edited and puts it back in the text file maybe this is my problem???
Send("!fs"); saves the file(opens file menu and chooses save)
WinClose("HH")
SoundPlay("C:\Windows\Media\Tada.wav")

Edited: ok i think i found my problem...it is the controlsettext, i believe, what other way could i do that?

HH20050706_Subra_III___100_200_Play_Money___No_Limit_Omaha_H_L.txt

Edited by viper8907

Share this post


Link to post
Share on other sites
Rex

@Viper

With the help from Lasycat i did this for one of my scripts.

#include <file.au3>
Func Readline()
    
    $i = 0
    $Lines = _FileCountLines(@ScriptDir & "\" & @UserName & ".txt")
    
    If Not $lines = 0 Then
    ReDim $ahsLines[$Lines][2]
    
    $file = FileOpen(@ScriptDir & "\" & @UserName &".txt", 0)
        
    Do
        $i = $i + 1
    $line = FileReadLine($file, $i)
    $ahsLines[$i-1][0] = $line
    $ahsLines[$i-1][1] = GuiCtrlCreateTreeViewItem($line, $treeview)
    
Until $i = $lines

FileClose($file)

This reads all the lines of a file, and adds them into a treeview.

Maby you can rewrite this simpel func. to be used in your script.

Share this post


Link to post
Share on other sites
viper8907

ill see what i can do thats for your help :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.