Jump to content

Read from .ini --> _ArrayToString


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...