Jump to content

Error reading 200,000 characters from txt file


Recommended Posts

;Hey guys ...

;I'm having a issue ...

;I'm trying to read a long string from a .txt file ... about 200,000 chars or more using iniread

;but i only get the LAST 23,688 characters and everything else is just lost ...

;seems to be a 23,688 character limit on something im doing...or something wild

;if you have any idea why this is happening please let me know

;and if you have any information on a possible work around

;it would be most helpful

;I have also included the file im reading ... not that it should make a difference

;Oh yeah and what i'm making is a Macro Recorder/Player

;to record Mouse Movement and Delays and Keys and All then save them to Replay whenever

;Email: Blessed_size@yahoo.com

;yahoo messenger: Blessed_size@yahoo.com

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Thanx in Advance for your time;

;;;;;;;;;;;Evan Hush;;;;;;;;;;;;

;;;;;;;;;;;;Example Script Start;;;;;;;;;;;;

;;;the macro we are selecting

$macroname = "testmacro1"

;;;;;;;;;;;;;;;;read the string from the file

$Macro_Commands_ = IniRead(@ScriptDir & "\Macros\" & $macroname & ".txt", "Macroconfig", "Macro_", "")

;;;;;;;;split the sting from the file delimeter is §

$_Command_Array_ = StringSplit($Macro_Commands_,"§")

;;;this is to tell me how many substrings are in the array

MsgBox(0, "DEBUG", "number of functions: " & $_Command_Array_[0])

;;;;;;;;;;;;do this for every substring

For $i = 1 to $_Command_Array_[0] Step 1

MsgBox(0, "DEBUG", "substring: " & $_Command_Array_[$i])

next

;;;;;;;;;;;;Example Script End;;;;;;;;;;;;

yahoo.txt

Edited by Blessedone
Link to comment
Share on other sites

Frequently Asked Questions (FAQs)

READ ME BEFORE POSTING!

I think you might have missed that post, it will be good for us all if you read it.

Edited by JRowe
Link to comment
Share on other sites

Frequently Asked Questions (FAQs)

READ ME BEFORE POSTING!

I think you might have missed that post, it will be good for us all if you read it.

lol i dont even know why i had that line in all caps ... it took me a min to figure out what you where talking about ...

but anyways got any ideas on why this is happening or even a possible workaround?

Link to comment
Share on other sites

Maximum Valid Size for REG.DAT and .INI Files...

http://support.microsoft.com/kb/78346

poop ok thanx very much ...

i have verified that max inifile size can only be 64 kb

i tried same thing with a 61kb file and it worked fine ...

any suggestions? or workarounds?

thanx again for your help

Link to comment
Share on other sites

Script it. This is usually the point where people have to decide to learn how to actually program something or to move on. Learning to write AutoIt programs will be more valuable for you.

So here's your 3 routes, choose wisely:

1.) Learn. Check out the Search box, and spend an hour or so searching these forums for answers to your various questions. Type your question into the box and click "Search" and it will pull up lots of posts and threads, most likely with your answer in the top 20. Learn to use the helpfiles (there are 2. You'll need the AutoIt helpfile, not the UDFs helpfile, at this point.)

2.) Use the built in macro generator with Scite for AutoIt, use the macro recorders in the example scripts section of the forum, or head to Rentacoder and pay for one.

3.) Decide not to invest your time and energy on this.

If you choose 1, then here's a starting off point: Treating the file as a .ini restricts you in ways that are unnecessary. You can load the file using FileOpen() and read from that file using FileRead. That doesn't impose any overhead or limitations on the type of file you're wanting to use, and you can still use your script to utilize the data in the file.

Good luck!

Link to comment
Share on other sites

Script it. This is usually the point where people have to decide to learn how to actually program something or to move on. Learning to write AutoIt programs will be more valuable for you.

So here's your 3 routes, choose wisely:

1.) Learn. Check out the Search box, and spend an hour or so searching these forums for answers to your various questions. Type your question into the box and click "Search" and it will pull up lots of posts and threads, most likely with your answer in the top 20. Learn to use the helpfiles (there are 2. You'll need the AutoIt helpfile, not the UDFs helpfile, at this point.)

2.) Use the built in macro generator with Scite for AutoIt, use the macro recorders in the example scripts section of the forum, or head to Rentacoder and pay for one.

3.) Decide not to invest your time and energy on this.

If you choose 1, then here's a starting off point: Treating the file as a .ini restricts you in ways that are unnecessary. You can load the file using FileOpen() and read from that file using FileRead. That doesn't impose any overhead or limitations on the type of file you're wanting to use, and you can still use your script to utilize the data in the file.

Good luck!

lol well thanx for your advice ... but for your information ... i do use helpfiles and i do use search and i do know autoit lol ... i just was not aware of this restriction ... this is the biggest textfile i have read from yet ... and i though i post on here for help does not mean i have stopped trying myself

and yes fileread()

is what i am currently changing it to now that i found out about the restriction ...

though i have yet to try it... the helpfile seems to suggest this is better for bigger files

... maybe i myself can leave you a bit of advice... dont assume that everyone is a noob...

as at times everyone finds them selves asking ... or just give up

... I'm not the giving up type :)

Link to comment
Share on other sites

You are a newb, though not necessarily a noob. (The difference being relative levels of experience.)

I always assume people are idiots until they prove otherwise. It makes most people a pleasant surprise.

Link to comment
Share on other sites

My suggestions:

1. As stated earlier, instead of ini, use .txt for large data sets... manipulate it using FileOpen(), FileRead() and other file-related functions.

2. If you insist on using ini, create a function to check if the ini size exceeds 60k. If true than create new ini.

3. Use mysql to store data. You can store as much data that fits on your hard disk. You could use this msql UDF

Hope this helps

Edited by Mison

Hi ;)

Link to comment
Share on other sites

You are a newb, though not necessarily a noob. (The difference being relative levels of experience.)

I always assume people are idiots until they prove otherwise. It makes most people a pleasant surprise.

lol ok and what makes you more experienced than me ... excuse me for not reading from a 200kb ini file until now lol

there is no user documentation indication this ... the restriction was not for autoit but with API calls

... lol ... you didnt even know this ... lol another user was kind enough to point me in the correct direction ...

without making himself like like a noob/newb lolololololololol

Link to comment
Share on other sites

My suggestions:

1. As stated earlier, avoid ini for large data sets.. use txt. manipulate it using FileOpen(), FileRead() and other file-related functions.

2. If you insist on using ini, create a function to check if the ini size exceeds 60k. If true than create new ini.

3. Use mysql to store data. You can store as much data that fits on your hard disk. You could use this msql UDF

Hope this helps

thank you very much for your help ...

i have already solved it without creating a new ini file

... i still write everything in using iniwrite however i call everything with this func

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;Example Start;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$file = FileOpen(@ScriptDir & "\Macros\" & $macroname & ".txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

$Macro_Commands_ = FileRead($file)

FileClose($file)

$Macro_Commands_ = StringTrimLeft($Macro_Commands_, 22)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;ClipPut(StringTrimLeft($Macro_Commands_, 22)) ;;;test for new fileread ... instead if iniread ...cause of 64kb limit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;Example End;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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...