Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Getting Last Section From .ini

$
0
0
[ autoit ]         
; Write version.ini on ScriptDir for testing purposes FileDelete(@ScriptDir & "\version.ini") IniWrite(@ScriptDir & "\version.ini", "1.0", "URL", "http://www.update.com/1.0") ; __________________________________________________________________ IniWrite(@ScriptDir & "\version.ini", "1.1", "URL", "http://www.update.com/1.1") ; __________________________________________________________________ IniWrite(@ScriptDir & "\version.ini", "1.2", "URL", "http://www.update.com/1.2") ; __________________________________________________________________ ; Declare the current version of the Application Local $client_version = "1.0" ; In my actual script, I use FileRead with StringRegExp ; Read the section names Local $SectionNames = IniReadSectionNames(@ScriptDir & "\version.ini") For $a = 1 To $SectionNames[0] ; Creating a loop to get all section names     ; Now we read the keys of each Section     Local $keys = IniReadSection(@ScriptDir & "\version.ini", $SectionNames[$a])     ; If an error occurred when trying to Read     If @error Then         MsgBox(4096, "", "Error occurred, probably no INI file.")     ; If no error     Else         ; Creates a loop to get all keys within each section         For $i = 1 To $keys[0][0]             ; Now show us each section, key and their values             MsgBox(4096, "", "Section: " & $SectionNames[$a] & @CRLF _ ; Break line             & "Key: " & $keys[$i][0] & @CRLF & "Value: " & $keys[$i][1])         Next     EndIf Next

So, I'm using "IniReadSectionNames" as you can see to get the sections but how can I get the last section? (Without actually have to set it manually?)
I've tried some method already I've been reading, but the more I read, the more confused I get...



Any help?

Viewing all articles
Browse latest Browse all 12506

Trending Articles