Jump to content

IniReadSectionNames


Recommended Posts

Hi

Can devs clarify any limits if any using INI files. under WinXP/SP2 ?

Reason i ask, a buddy of mine has given me a Notes text file from an online poker site and asked if i can extract Names from it. No problem i thought, The structure is similar to an inifile. Here an example f a record in it:

[username=Maverick]

notes here

blah blah

I only need the Section names/players the key notes etc i dont need.

running this code in Beta 3.1.80

$var = IniReadSectionNames("c:\Notes.txt")
If @error Then 
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    _arraytoclip($var)
EndIf

It extracts 1850 Sections/Player Names . the $index[0] confirms this count of Sections/Player Names .

trouble is there is considerably more names in the file than this, at least 11000 more names..

Have i hit a ceiling?

***edit *** file is 1.5meg in size plain ascii***

Regards

HardCopy

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Link to comment
Share on other sites

This doesn't answer your question but if you're in dire need of a solution, can you manipulate it as a plain text file, using some regular expressions to pull out the lines starting with [ and parsing the necessary information out of those lines?

Link to comment
Share on other sites

15. What are the current technical limits of AutoIt v3?

Here are details of the current technical limits of AutoIt. Please note that some of the limits are theoretical and you may run into performance or memory related problems before you reach the actual limit.

Maximum length of a single script line: 4,095

Maximum string length: 2,147,483,647 characters

Number range (floating point): 1.7E308 to 1.7E+308 with 15-digit precision

Number range (integers): 64-bit signed integer

Hexadecimal numbers: 32-bit signed integer (0x80000000 to 0x7FFFFFFF)

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Maximum depth of recursive function calls: 384 levels

Simultaneous open files: 64

Simultaneous active HotKeys: 64

Maximum number of variables in use at one time: No limit

Maximum number of user defined functions: No limit

Maximum number of GUI windows: 1024

Maximum number of GUI controls per window: 4096

???

LxP just wrote this.... i changed 1 line

local $path = "c:\file.ini"
local $tempPath = @tempDir & "\tempFile.ini"

local $file = fileOpen($path, 0)
local $temp = fileOpen($tempPath, 2)

while 1

local $data = fileReadLine($file)
if @error then exitLoop

if StringLeft($data, 1) = "[" then fileWriteLine($tempPath, $data) 

wEnd

fileClose($file)
fileClose($temp)

fileDelete($path)
fileMove($tempPath, $path)

dont know why he didn't do that

you can remove other non-revelant parts also before writing to the new file

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Hehe -- I'm just lazy I guess. ;)

Here's what I describe in my other post. It'll (attempt to) parse the usernames out into an array. (May need tweaking.)

local $path = "c:\file.ini"

local $file = fileOpen($path, 0)

local $names[2000]

$names[0] = 0

while 1

local $data = fileReadLine($file)

if @error then exitLoop

if stringRegExp($data, "^\[username=(.*)\]$") then

local $name = stringRegExp($data, "^\[username=(.*)\]$", 1)

$names[0] += 1

$names[$names[0]] = $name[0]

endIf

wEnd

fileClose($file)

The StringRegExp() calls could probably be combined into a single call but it may not work for you as it is anyway.
Link to comment
Share on other sites

HardCopy, yes, there are limits although the exact numbers escape me at the moment. Whatever the limits are on Windows 95 (We enforce those limits to maintain compatibility). I don't think there is a specific limit on number of sections but there is a limit on the size of an INI file and that limit is probably around 65,536 bytes (64 KB). Are you dealing with an INI file that big?

Link to comment
Share on other sites

HardCopy, yes, there are limits although the exact numbers escape me at the moment. Whatever the limits are on Windows 95 (We enforce those limits to maintain compatibility). I don't think there is a specific limit on number of sections but there is a limit on the size of an INI file and that limit is probably around 65,536 bytes (64 KB). Are you dealing with an INI file that big?

thx guys, I did the task anyhow, just simpy parsed the file with filereadline,saving to new file, only lines that contained text encased in []

Contained = 14780 names total.

@Valik / yes ini file a grand total of 1.5 megs.

Could this limitation be included in the help section related to the IniReadSectionNames.

It was only due to the file size & format I was vigilante in looking for possible errors

in the result in the first place.

Im Just thinking of future users who may get just outside this limit in their ini files and may

not pick up that entries are not read etc.

No error condition is returned, and will assume every thing appears good.

No critic intended whatsoever, just want to help Autoit Documentation maintain its high standards.

Regards

HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

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