Jump to content
Sign in to follow this  
litlmike

Read from .ini --> _ArrayToString

Recommended Posts

litlmike

I want to read the values in an .ini file, then make them available to put into a GUI Edit Box. My thought was to store the values into an array, then put them into a string delimited by @CRLF so that the GUI edit box could accept the values. I am stuck getting the values into an array. I used _ArrayToString(), but it seems to only use the 1st dimension I believe. How can I arrive at the solution?

;Make .ini file
Global $iniPath = @ScriptDir & "\SaveData.ini"
If NOT FileExists($iniPath) Then
    _FileCreate ( $iniPath )
    IniWriteSection ($iniPath, "Destinations", "")
    IniWrite ( $iniPath, "Destinations", "key", "value" )
    IniWriteSection ($iniPath, "Categories", "")
    IniWrite ( $iniPath, "Categories", "key", "value" )
EndIf

$Edit1_Text_Array = IniReadSection ( $iniPath, "Destinations")
$Edit1_Text =_ArrayToString($Edit1_Text_Array, @CRLF)
MsgBox (0, "", $Edit1_Text)

$Edit1_Text_Array = IniReadSection ( $iniPath, "Categories")
$Edit2_Text = _ArrayToString($Edit1_Text_Array, @CRLF)
MsgBox (0, "", $Edit2_Text)
;end Ini file

Share this post


Link to post
Share on other sites
PsaltyDS

Dude, Babushka, litlmike... you've been around here long enough not to need this, but:

Global $iniPath = @ScriptDir & "\SaveData.ini"
Global $sString, $Edit1_Text_Array

$Edit1_Text_Array = IniReadSection($iniPath, "Destinations")
For $n = 1 To $Edit1_Text_Array[0][0]
    $sString &= $Edit1_Text_Array[$n][0] & " = " & $Edit1_Text_Array[$n][1] & @CRLF
Next
MsgBox(64, "Result", $sString)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.