Sign in to follow this  
Followers 0
Frozenyam

Array INI files

1 post in this topic

#1 ·  Posted (edited)

This will display .ini files in the form of an array. UDF, please download file and don't just copy and paste. If you're worried about what the file COULD do, please right click on it after download and go to edit. There is nothing hidden in the file.

#Include-Once

Func _ArrayINI (ByRef $File)
   Global $CountFile = 0
   $Information = @CR
   $Header = 0
   $ArrayQuery = ""

   FileOpen ($File, 0)

   Do
      $CountFile = $CountFile + 1
      $CountLine = FileReadLine ($File, $CountFile)
   Until @Error = -1

   For $Count1 = 1 To ($CountFile - 1)
      $Read = FileReadLine ($File, $Count1)
      $Information = $Information & $Read & @CR 
   Next

   $StripSpace = StringStripWS ($Information, 7)
   $Info = StringSplit ($StripSpace, "=" & @CR)


   For $Count = 0 To UBound ($Info) - 1
   $ArrayQuery = $ArrayQuery & "[" & $Count & "] = " & _
   $Info[$Count] & @CR
   Next
   
   If IsArray ($Info) = 0 Then
      MsgBox (4096, "Error", "Array = Not Valid")
   Else
      MsgBox (4096, "", $ArrayQuery)
   EndIf
EndFunc

How to use the UDF:

#Include <_ArrayINI.au3>

$File = "Path\Name.Extention"
_ArrayINI ($File)

:whistle:

_ArrayINI.au3

Edited by Frozenyam

"... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."

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  
Followers 0