simsalabim Posted February 25, 2008 Share Posted February 25, 2008 Hey, I'm reading the content of an ini-File into an array using: $button1_arr = IniReadSection("settings.ini", "button1") the settings.ini looks like this: [button1] text=Text of Button 1 tip=This will start File 1 link=.\Tools\start.exe ".\Files\Filexy.ppt" [button2] text=Text of Button 2 tip=This will start File 2 link=.\Tools\start.exe ".\Files\Fileabc.ppt" [button3] text= tip= link= This way I receive an indexed array like $button1_arr[0] $button1_arr[1] $button1_arr[2] and so on ... How can I "switch" this to an accociative array, so I'd receive somthing like this: $button1_arr['text'] $button1_arr['tip'] ... and so on ... I hope you understand what I'm talking about ... and thanks in advance ... :-) Link to comment Share on other sites More sharing options...
Oldschool Posted February 25, 2008 Share Posted February 25, 2008 did u read the help file? IniReadSection Success: Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value. http://www.autoitscript.com/autoit3/docs/f...ReadSection.htm Link to comment Share on other sites More sharing options...
simsalabim Posted February 25, 2008 Author Share Posted February 25, 2008 yes, I did read and experiment with the help-file ... but I still can't see an automated way to create an associative array ... (The ini-File will be edited manually, so I cannot rely on $button1_arr[1] will always have "text" as $button1_arr[1][0] ... I'd rather like to have $button_arr[1]['text'] ... ) Link to comment Share on other sites More sharing options...
Oldschool Posted February 25, 2008 Share Posted February 25, 2008 yes, I did read and experiment with the help-file ... but I still can't see an automated way to create an associative array ... (The ini-File will be edited manually, so I cannot rely on $button1_arr[1] will always have "text" as $button1_arr[1][0] ... I'd rather like to have $button_arr[1]['text'] ... ) Then it looks like you will have to translate the array you iniread to a different array with the desired format. $button1_arr[1][0] = $myArray[1] Link to comment Share on other sites More sharing options...
randallc Posted February 25, 2008 Share Posted February 25, 2008 Hi, Try help file for "associative"; not the exact syntax you want, but close, from Nutster's thread, say.. Or other "hash" funcs? Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW 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