Jump to content

InI Problems.


 Share

Recommended Posts

Hello everyone. I have 1 problem..

I want to make script that read ini file and read all ini Selection Names in it.

After that my script should read this selection names and set all key's in this selection names into ListView Control.

Thats what i have :

Func _Check()
    InetGet($Server, $InI)
    If @error Then GUICtrlSetData($Information, "Error!")
    $Var = IniReadSectionNames($InI)
    For $i = 1 To $Var[0]
        $Var2 = IniReadSection($Var, $Var[$i])
        For $a = 1 To $Var2[0][0]
            Local $link = IniRead($Var, $Var2, "onlinelink", "")
            Local $name = IniRead($Var, $Var2, "onlinename", "")
            Local $status = IniRead($Var, $Var2, "status", "")
            GUICtrlSetData($UpdateList_0, $name & "|" & $link & "|" & $status)
        Next
    Next
EndFunc

ListView code :

$UpdateList = GUICtrlCreateListView("File|Link|Status", 8, 32, 410, 142, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_HEADERDRAGDROP))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 240)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 86)
$UpdateList_0 = GUICtrlCreateListViewItem("File.txt|localhost/file.txt|New Version", $UpdateList)
$UpdateList_1 = GUICtrlCreateListViewItem("About.txt|localhost/about.txt|New Version", $UpdateList)

$InI = @Tempdir & "\test.ini"

But it dont work. Hope for fast answer. (Sry for bad English)

Link to comment
Share on other sites

Hello everyone. I have 1 problem..

I want to make script that read ini file and read all ini Selection Names in it.

After that my script should read this selection names and set all key's in this selection names into ListView Control.

Thats what i have :

Func _Check()
    InetGet($Server, $InI)
    If @error Then GUICtrlSetData($Information, "Error!")
    $Var = IniReadSectionNames($InI)
    For $i = 1 To $Var[0]
        $Var2 = IniReadSection($Var, $Var[$i])
        For $a = 1 To $Var2[0][0]
            Local $link = IniRead($Var, $Var2, "onlinelink", "")
            Local $name = IniRead($Var, $Var2, "onlinename", "")
            Local $status = IniRead($Var, $Var2, "status", "")
....
I dont really know much about arrays, but shouldnt $var and $var2 in...

Local $link = IniRead($Var, $Var2, "onlinelink", "")
            Local $name = IniRead($Var, $Var2, "onlinename", "")
            Local $status = IniRead($Var, $Var2, "status", "")

be arrays, such as $var[n][1] or what not....

...also, the first part of iniread() is the filename --> iniread("filename",.....)

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

**** NOT TESTED

Func _Check()
    InetGet($Server, $InI)
    If @error Then Return GUICtrlSetData($Information, "Error!")
    $Var = IniReadSectionNames($InI)
    For $i = 1 To $Var[0]
        Local $link = IniRead($InI, $Var[$i], "onlinelink", "")
        Local $name = IniRead($InI, $Var[$i], "onlinename", "")
        Local $status = IniRead($InI, $Var[$i], "status", "")
        GUICtrlSetData($UpdateList_0, $name & "|" & $link & "|" & $status)
        ConsoleWrite($name & "|" & $link & "|" & $status & @CRLF) ; for testing
    Next
EndFunc   ;==>_Check

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I still have 1 prob =(

I have ini file. This ini file has 2 Selections with Key's. Exp :

[selection1]
Key1 = "value"
Key2 = "value"
Key3 = "value"
[selection2]
Key1 = "value"
Key2 = "value"
Key3 = "value"

So now if i add new Selection with Keys, my script should read it and show it in ListView..

Valuater your example works but it read only 1 Selection from InI File..And it shows only 1 in ListView

Any way how i can show all Selections and keys in ListView ?

Thanks =)

Edited by Demon777
Link to comment
Share on other sites

Try this ( listview )

Func _Check()
    InetGet($Server, $InI)
    If @error Then Return GUICtrlSetData($Information, "Error!")
    $Var = IniReadSectionNames($InI)
    For $i = 1 To $Var[0]
        Local $link = IniRead($InI, $Var[$i], "onlinelink", "")
        Local $name = IniRead($InI, $Var[$i], "onlinename", "")
        Local $status = IniRead($InI, $Var[$i], "status", "")
        GUICtrlCreateListViewItem($name & "|" & $link & "|" & $status, $UpdateList)
        ConsoleWrite($name & "|" & $link & "|" & $status & @CRLF) ; for testing
    Next
EndFunc   ;==>_Check

8)

Edited by Valuater

NEWHeader1.png

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...