Sign in to follow this  
Followers 0
yucatan

iniread

7 posts in this topic

hi i need some code that i can fully read a .ini so all sections and all value's

i cant get it done somebody any ideas?

Share this post


Link to post
Share on other sites



Hi yucatan,

Please create descriptive topics.

Using one word topics makes it really difficult to use the search feature, and those that could probably answer your question will probably not even read your thread.

Doing it enough could cause your posting privileges to be taken away all together, and we don't want that :) .

Thanks.

Share this post


Link to post
Share on other sites

Damn people...I swear this question has been asked a billion times. Please search before you post! :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

hi i need some code...

C'mon now, you have been around here long enough to know that's not how it works. You need some help to code for yourself a script...

...that i can fully read a .ini so all sections and all value's

i cant get it done somebody any ideas?

Do IniReadSectionNames() to list all the sections, then you do IniReadSection() on each section in a For/Next loop to get all the keys/values.

You will have to decide how you want to use them: separate arrays, one big 3D array, a list of strings, etc.

Post what you've got to get more help with it.

:)

Edited by PsaltyDS

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

this is what i have now

$iniread = IniReadSectionNames("C:\Temp\"&$array[1]&".ini")
If @error Then 
ConsoleWrite("Error occurred, probably no INI file.")
else
    For $i = 1 To $iniread[0]
$iniread2 &= $iniread[$i]&"|"
       
    Next   
EndIf
;ConsoleWrite($iniread2)
$iniread22= StringSplit($iniread2, '|', 1)



$final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
If @error Then 
    ConsoleWrite("Error occurred, probably no INI file.")
Else
    For $i = 1 To $final[0][0]
      $final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
      _ArrayDisplay($final, "Class List of Active Window")
    Next
EndIf

Share this post


Link to post
Share on other sites

this is what i have now

$iniread = IniReadSectionNames("C:\Temp\"&$array[1]&".ini")
If @error Then 
ConsoleWrite("Error occurred, probably no INI file.")
else
    For $i = 1 To $iniread[0]
$iniread2 &= $iniread[$i]&"|"
       
    Next   
EndIf
;ConsoleWrite($iniread2)
$iniread22= StringSplit($iniread2, '|', 1)



$final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
If @error Then 
    ConsoleWrite("Error occurred, probably no INI file.")
Else
    For $i = 1 To $final[0][0]
      $final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
      _ArrayDisplay($final, "Class List of Active Window")
    Next
EndIf

hi guys i am still searching on the forums but i cant find a salution pleas help me

Share this post


Link to post
Share on other sites

this is what i have now

$iniread = IniReadSectionNames("C:\Temp\"&$array[1]&".ini")
If @error Then 
ConsoleWrite("Error occurred, probably no INI file.")
else
    For $i = 1 To $iniread[0]
$iniread2 &= $iniread[$i]&"|"
    Next   
EndIf
;ConsoleWrite($iniread2)
$iniread22= StringSplit($iniread2, '|', 1)

$final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
If @error Then 
    ConsoleWrite("Error occurred, probably no INI file.")
Else
    For $i = 1 To $final[0][0]
      $final = IniReadSection("C:\Temp\"&$array[1]&".ini", $iniread22[$i])
      _ArrayDisplay($final, "Class List of Active Window")
    Next
EndIf
Okay, joining the array of section names into a string, then string-splitting them back to an array is just silly.

Other than that, all you needed was to get everything in the same loop, a For/Next to use each section, and a For/Next loop nested inside that to do something with the key=value pairs in the $final array. Since the two loops wind up nested, you can't use $i for both. I added some @TABs so you will get an indented display of the contents:

ConsoleWrite("Working with ini file at: " & $array[1] & @LF)
$iniread = IniReadSectionNames("C:\Temp\" & $array[1] & ".ini")
If @error Then
    ConsoleWrite("Error occurred reading INI file." & @LF)
Else
    For $i = 1 To $iniread[0]
        ConsoleWrite(@TAB & "Reading section: " & $iniread[$i]
        $final = IniReadSection("C:\Temp\" & $array[1] & ".ini", $iniread[$i])
        If @error Then
            ConsoleWrite(@TAB & "Error occurred reading section.")
        Else
            For $n = 1 To $final[0][0]
                ConsoleWrite(@TAB & @TAB & $final[$n][0] & " = " & $final[$n][1] & @LF)
            Next
        EndIf
    Next
EndIf

Study that, and then you can modify it to what you really want to do with the data.

:)


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