Arclite86 Posted October 7, 2015 Posted October 7, 2015 expandcollapse popup#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
JohnOne Posted October 7, 2015 Posted October 7, 2015 Works great for me with list2.txt. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Arclite86 Posted October 7, 2015 Author Posted October 7, 2015 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 beforeso 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)
Developers Jos Posted October 7, 2015 Developers Posted October 7, 2015 Shouldn't that be:$hFile = FileOpen($sListFile12, $FO_OVERWRITE)Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Arclite86 Posted October 7, 2015 Author Posted October 7, 2015 thank you jos your a freaking hero! :-)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now