Sign in to follow this  
Followers 0
Arclite86

cant figure out why my list isn't saving

5 posts in this topic

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <String.au3>

#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <FF V0.6.0.1b-14.au3>

#include <staticConstants.au3>
#include <IE.au3>
#include <String.au3>
#include <Excel.au3>
#include <Array.au3>
#include <FileConstants.au3>


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("program", 1161, 578, 239, 113)
$List2 = GUICtrlCreateList("", 664, 24, 225, 487)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;list2
Global $iIndex = 0, $sListData12 = "C:\Users\user\Desktop\autoit\lijsten\list2.txt"
Global $sListFile12 = "C:\Users\user\Desktop\autoit\lijsten\list2.txt"

If FileExists($sListFile12) Then
    $sListData12 = StringReplace(FileRead($sListFile12), @CRLF, "|")
EndIf
GUICtrlSetData($List2, $sListData12)
_GUICtrlListBox_SetCurSel($List2, $iIndex)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
             $iListCount2 = _GUICtrlListBox_GetCount($List2)

            ; Loop through the entries
            For $i = 0 To $iListCount2 - 1
                ; And add the text
               $sListData12 &= _GUICtrlListBox_GetText($List2, $i) & "|"
            Next
            ; Strip the final "|"
            $sListData1 = StringTrimRight($sListData12, 1)
            ; And save the result
            $hFile = FileOpen($sListData12, $FO_OVERWRITE)
            FileWrite($hFile, $sListData12)
            FileClose($hFile)
            Exit
            
                    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



it does open the   "C:\Users\user\Desktop\autoit\lijsten\list2.txt" and puts al the names in the list but i also have a function dat add a new string ( a new name to the list)  and every time i close(and save) it doesn open the new strings that i added before

so there is something worng with the save fucntion

$iListCount2 = _GUICtrlListBox_GetCount($List2)

            ; Loop through the entries
            For $i = 0 To $iListCount2 - 1
                ; And add the text
               $sListData12 &= _GUICtrlListBox_GetText($List2, $i) & "|"
            Next
            ; Strip the final "|"
            $sListData1 = StringTrimRight($sListData12, 1)
            ; And save the result
            $hFile = FileOpen($sListData12, $FO_OVERWRITE)
            FileWrite($hFile, $sListData12)
            FileClose($hFile)

 

Share this post


Link to post
Share on other sites

thank you jos your a freaking hero! :-)

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