Jump to content
Sign in to follow this  
Keltset

Please help, storing array data into INI and retrieving it back

Recommended Posts

Keltset

I really need help, I cannot seem to figure this out...

I wrote code that takes a 1d array data and stores it as a string into an ini under a key. And the ini looks like this:

[MessageBoxes]

FreeGifts_Size=6

FreeGifts_Color=0x6D84B4, 0x6D84B4, 0x6D84B4, 0x6D84B4, 0x6D84B4, 0x6D84B4

FreeGifts_Variance=3, 3, 3, 3, 3, 3

Im trying to turn these into two arrays:

$section = "MessageBoxes"
$name = "FreeGifts"
$test1[IniRead("fv.ini", $section, $name&"_Size", "fail")] = [IniRead("fv.ini", $section, $name&"_Color", "fail")]
$test2[IniRead("fv.ini", $section, $name&"_Size", "fail")] = [IniRead("fv.ini", $section, $name&"_Variance", "fail")]

I run this and I keep getting syntax errors...

: ERROR: syntax error

$test1[iniRead("fv.ini", $section, $name&"_Size", "fail")] = [

I thought you could declare an array by doing $array[$size] = [stuff,to,match,size]?? *Confused*

Can someone please tell me what the heck I'm doing wrong?


-K

Share this post


Link to post
Share on other sites
Achilles

Here's a simpler way of doing it:

#include <Array.au3>

$colors = IniRead(@ScriptDir & '\temp.ini', 'MessageBoxes', 'FreeGifts_color', '-1')

If $colors <> '-1' then
    $colors = StringSplit($colors, ',')
EndIf

$variance = IniRead(@ScriptDir & '\temp.ini', 'MessageBoxes', 'FreeGifts_Variance', '-1')

If $variance <> '-1' then
    $variance = StringSplit($variance, ',')
EndIf

_ArrayDisplay($colors, '$colors')
_ArrayDisplay($variance, '$variance')
You will have to change the position of the .ini file. Ask if you don't understand how any of this works.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Keltset

Thank you, this resolves my problem!!! :)


-K

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  

×