Jump to content

iniread


Recommended Posts

hi i have a .ini file it look like this

[user]

yucatan=matrix

henk=omfg

i wanne make a func that when the func read it like this

[user]

yucatan=matrix

henk=omfg

becomes

yucatan

henk

and i wanne put it in a array

that $array[1] = yucatan

and $array[2] = henk

how i can do that ?

Link to comment
Share on other sites

hi i have a .ini file it look like this

[user]

yucatan=matrix

henk=omfg

i wanne make a func that when the func read it like this

[user]

yucatan=matrix

henk=omfg

becomes

yucatan

henk

and i wanne put it in a array

that $array[1] = yucatan

and $array[2] = henk

how i can do that ?

You can use Ini functions and StringInStr to know where is char "=" and than StringLeft.

When the words fail... music speaks.

Link to comment
Share on other sites

$var = IniReadSection("C:\Temp\users.ini", "user")

If @error Then

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

Else

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

MsgBox(4096, "", "Key: " & $var[$i][0])

Next

EndIf

this code i have now but i cant figure it out.

i needs to read all keys how i do that ?

Edited by yucatan
Link to comment
Share on other sites

Could you please clarify? I don't understand what you're trying to do. The example given should help you.

$var = IniReadSection("C:\Temp\users.ini", "user")

If @error Then

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

Else

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

MsgBox(4096, "", "Key: " & $var[$i][0])

Next

EndIf

this code i have now i get 2 times a msgbox with my users

but i want one $var that = both usernames

Link to comment
Share on other sites

This will place all the usernames in the string $data, seperating them by a space. I'm a little puzzled about you not figuring this out.

$data = ""

$var = IniReadSection("C:\Temp\users.ini", "user")

If @error Then

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

Else

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

$data &= $var[$i][0] & " "

Next

EndIf

Link to comment
Share on other sites

This will place all the usernames in the string $data, seperating them by a space. I'm a little puzzled about you not figuring this out.

$data = ""

$var = IniReadSection("C:\Temp\users.ini", "user")

If @error Then

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

Else

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

$data &= $var[$i][0] & " "

Next

EndIf

$data = now yucatan admin

i want that $data = yucatan

admin

below eatchother

i got it

$data = ""

$var = IniReadSection("C:\Temp\users.ini", "user")

If @error Then

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

Else

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

$data &= $var[$i][0]&@CRLF & ""

Next

EndIf

MsgBox(4096, "", $data)

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