yucatan Posted July 6, 2008 Share Posted July 6, 2008 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 More sharing options...
Andreik Posted July 6, 2008 Share Posted July 6, 2008 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 More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 Autoit has a function to do what you want, look into IniReadSection. Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 (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 July 6, 2008 by yucatan Link to comment Share on other sites More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 Could you please clarify? I don't understand what you're trying to do. The example given should help you. Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 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 More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 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 More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 (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 July 6, 2008 by yucatan Link to comment Share on other sites More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 Replace the space by @CRLF... Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 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 Link to comment Share on other sites More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 If StringRight($string, 1) = "|" Then $string = StringTrimRight($string, 1) Link to comment Share on other sites More sharing options...
yucatan Posted July 7, 2008 Author Share Posted July 7, 2008 If StringRight($string, 1) = "|" Then $string = StringTrimRight($string, 1)i wanne read a $var out another func how i can do that ? Link to comment Share on other sites More sharing options...
TomZ Posted July 7, 2008 Share Posted July 7, 2008 (edited) Could you be more specific? What function, what variable? Edited July 7, 2008 by TomZ Link to comment Share on other sites More sharing options...
inet Posted July 14, 2008 Share Posted July 14, 2008 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... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now