Jump to content

how do i get from a list and write from it


 Share

Recommended Posts

#include <GUIConstants.au3>
#Include <GuiListBox.au3>

#region - GUI Create
GUICreate('TEST',200,200)
$LISTBOX = GUICtrlCreateList("",0,0,200,150)
GUICtrlSetData($LISTBOX,"1|2|3|4|5|6|7|8|9")
$SAVE = GUICtrlCreateButton("SAVE",80,165,40,20)
GUISetState()
#endregion

#region - GUI SelectLoop
While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $GUI_EVENT_CLOSE
            Exit
        Case $MSG = $SAVE
            $DATA = ""
            $NUM = _GUICtrlListBox_GetCount($LISTBOX)-1
            For $INDEX = 0 To $NUM
                $DATA &= _GUICtrlListBox_GetText($LISTBOX,$INDEX) & @CRLF
            Next
            $FILE= FileOpen(@ScriptDir & "\MYFILE.TXT",2)
            FileWrite($FILE,$DATA)
            FileClose($FILE)
    EndSelect
WEnd
#endregion

When the words fail... music speaks.

Link to comment
Share on other sites

thanks a lot ya'll, one more thing would be great, it writes the txt file as a list one under the other.. how could i make it write the list as each list data seperated by a comma?

Replace @CRLF with a comma or other delimiter char.

When the words fail... music speaks.

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