Jump to content

Recommended Posts

Posted

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 ?

Posted

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.
Posted (edited)

$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
Posted

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

Posted

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

Posted

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

Posted (edited)

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
Posted

Replace the space by @CRLF...

how do i check if a var contains a | at the end of the var if | = at the end then delete the | how do i do that

Posted

If StringRight($string, 1) = "|" Then $string = StringTrimRight($string, 1)

i wanne read a $var out another func how i can do that ?

Posted

Everything you are asking here is in the helpfiles, maybe you could take to effort to try and search them for yourself before asking them here...

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
×
×
  • Create New...