Jump to content
Sign in to follow this  

Ini read

Recommended Posts

How i can get idea how many lines in specific section?

How i can get what is written in line?

here is my ini That pi planned for my next script

How to get how many things are under install? and how to get their names?

I need return like

Howmany = 2

Names= firefox ;thunderbird

and if i remove 1 of them then at howmany return will be 1






Share this post

Link to post
Share on other sites

It returns an array.



Reads all key/value pairs from a section in a standard format .ini file.

IniReadSection ( "filename", "section" )


filename The filename of the .ini file.

section The section name in the .ini file.

Return Value

Success: Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value.

Failure: Sets @error=1 if unable to read the section (The INI file may not exist or the section may not exist)


A standard ini file looks like:



The number of elements returned will be in $result[0][0]. If an @error occurs, no array is created.

Only the first 32767 chars are taken in account in an section due to Win9x compatibility.


IniDelete, IniWrite, FileReadLine, IniRead, IniReadSectionNames, IniRenameSection, IniWriteSection


$var = IniReadSection("C:\Temp\myfile.ini", "section2")

If @error Then

MsgBox(4096, "", "Error occurred, probably no INI file.")


For $i = 1 To $var[0][0]

MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])



Share this post

Link to post
Share on other sites

I cant get this example work.

It returns

Error occurred, probably no INI file.


my modified version returns

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\My Documents\installbot\install.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>00:35:05 Starting AutoIt3Wrapper v. Environment(Language:0409 Keyboard:00000425 OS:WIN_XP/Service Pack 2 CPU:X86)

>Running AU3Check ( from:C:\Program Files\AutoIt3

+>00:35:06 AU3Check ended.rc:0

>Running:(\Program Files\AutoIt3\autoit3.exe "Z:\My Documents\installbot\install.au3"

Z:\My Documents\installbot\install.au3 (8) : ==> Subscript used with non-Array variable.:

For $i = 1 To $var[0][0]

For $i = 1 To $var^ ERROR

->00:35:06 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 2.344


msgbox (1,"",fileexists ("install.ini"))

returns 1

Share this post

Link to post
Share on other sites

Code please ... and ini file structure

You get that error there because there is no such array$var[0][0] : IniReadSection failed and no array was created.

Without code I can't see how somebody could help.

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 :)

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  

  • Create New...