Jump to content

Liste View items


BoogY
 Share

Recommended Posts

Hello to everyone :

I have tis funtion :

;---------------------------------------------------------
;Add the files to the .ini file
;---------------------------------------------------------
func addFilesList()
    $configFile = @ScriptDir & "\config.ini"

    ;$listCount = _GUICtrlListView_GetItemCount($listeCibles); count the files
    $aItem = _GUICtrlListView_GetItemTextString($listeCibles, 1)
    
    For $i = 1 To $aItem -1
        $sText &= $aItem[$i] & @LF
        IniWriteSection($configFile,"FilesToCopy",$sText)
    Next    
EndFunc

I don't know how to put all the items text in the .ini file.

and how to delete a selected item in the list view ?

Thank a lot.

Link to comment
Share on other sites

Try this:

;---------------------------------------------------------
;Add the files to the .ini file
;---------------------------------------------------------
func addFilesList()
    $configFile = @ScriptDir & "\config.ini"
    $sText = ""

    $lviewSelected = _GUICtrlListView_GetSelectedIndices($listeCibles, 1)
    For $x = 1 To $lviewSelected[0]
        $sText &= _GUICtrlListView_GetItemText($listeCibles, $lviewSelected[$x]) & @LF
    Next
    
    IniWriteSection($configFile,"FilesToCopy",$sText)
EndFunc

**Edit - After looking at it a little closer, I don't think you're using IniWriteSection correctly, the helpfile gives this as an example for how your $sText should be formatted:

; Demonstrate creating a new section using a string as input.
$sData = "Key1=Value1" & @LF & "Key2=Value2" & @LF & "Key3=Value3"
IniWriteSection($sIni, "Section1", $sData)

You're getting the value and you're getting the delimiting @LF in there, but based off your example you don't specify any "Key#="-type of reference.

Edited by exodius
Link to comment
Share on other sites

I need it to write juste the value and not the Key = value. this work for me.

And i tryed like this and it works :

func addFilesList()
    $configFile = @ScriptDir & "\config.ini"
    $nbrItems = _GUICtrlListView_GetItemCount($listeCibles)
    For $i = 0 To $nbrItems -1
        $aItem = _GUICtrlListView_GetItemTextString($listeCibles, $i)
        IniWriteSection($configFile,"FilesToCopy",$aItem)
    Next
EndFunc

Cause i want it to add all the items texts in the ini file.

It works now. Thanks for your help

Edited by BoogY
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...