_GUICtrllistbox_ ???

  • Bei meinem Playlister in autoit habe ich das Problem, dass ich nicht auslesen kann, was gerade angeklickt ist.
    Ich habe schon fast alles ausprobiert. :(

    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <audio.au3>
    #include <array.au3>
    #include <file.au3>
    #include <string.au3>
    #include <GUIListBox.au3>
    #include <Misc.au3>

    [/autoit][autoit][/autoit][autoit]

    $CurrentSound = ""

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Playlister", 615, 219, 439, 284)
    $Gerade = GUICtrlCreateLabel("Geradewird gespielt:", 152, 24, 436, 17)
    $erstellen = GUICtrlCreateButton("Erstellen:", 32, 16, 99, 65)
    $Button2 = GUICtrlCreateButton("Play", 160, 104, 75, 25)
    $Button3 = GUICtrlCreateButton("Playlist start", 352, 72, 171, 25)
    $Pause = GUICtrlCreateButton("Pause", 40, 104, 75, 25)
    $Button5 = GUICtrlCreateButton("Nächster", 160, 152, 75, 25)
    $Button6 = GUICtrlCreateButton("Vorheriger", 40, 152, 75, 25)
    $List1 = _GUICtrlListBox_Create($Form1,"", 352, 104, 169, 97)
    GUISetState()
    $firstfile = FileFindFirstFile(@DesktopDir & "\playlister\*.*")

    [/autoit][autoit][/autoit][autoit]

    if FileExists(@DesktopDir&"\playlister\") = 0 Then DirCreate(@DesktopDir&"\playlister\")
    if FileExists(@DesktopDir&"\playlister\list2filename\") = 0 Then DirCreate(@DesktopDir&"\playlister\list2filename\")
    if FileExists(@DesktopDir&"\playlister\playednow\") = 0 Then DirCreate(@DesktopDir&"\playlister\playednow\")

    [/autoit][autoit][/autoit][autoit]

    Do
    $nextfile = FileFindNextFile($firstfile)
    $nextfilename = _StringBetween($nextfile, "namestart", "nameend")
    If $nextfilename = "" Then
    Sleep("10")
    Else
    _FileCreate(@DesktopDir & "\playlister\list2filename\"&$nextfilename[0]&".list2filename")
    FileWrite(@DesktopDir & "\playlister\list2filename\"&$nextfilename[0]&".list2filename",$nextfile)
    _GUICtrlListBox_AddString($List1, $nextfilename[0])
    EndIf
    Until $nextfile = ""

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    $selection = "-1"
    $while = ""

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    ProcessClose("Playlisterplayer.exe")
    Exit
    Case $erstellen
    $name = InputBox("", "wie soll es heissen? (a-z) ")
    $folder = FileSelectFolder("Ordner auswählen", "", 2)
    $firstfile = FileFindFirstFile($folder & "\*.mp3")
    $file = @DesktopDir & "\Playlister\" & "namestart" & $name & "nameend" & ".txt"
    _FileCreate($file)
    $count = "0"
    Do
    $nextfile = FileFindNextFile($firstfile)
    _FileWriteToLine($file, $count + 1, $folder & "\" & $nextfile, 1)
    $countadder = $count
    $count = $countadder + 1
    Until $nextfile = ""
    $lenght = _FileCountLines($file) - 1
    $pos = "0"
    FileMove($file, @DesktopDir & "\Playlister\" & "namestart" & $name & "nameend" & "countstart" & $lenght & "countend" & "posstart" & $pos & "posend" & ".playlist")
    Case $Button3
    _FileCreate(@DesktopDir&"\playlister\playednow\playednow.played")
    $currentsel = _guictrllistbox_getselected($List1)
    $data = FileRead(@DesktopDir&"\playlister\list2filename\"&$currentsel&".list2filename")
    ;MsgBox(0x0,"",$data)
    _FileWriteToLine(@DesktopDir&"\playlister\playednow\playednow.played",1,$data,1)
    Run("C:\Users\Jasper\Documents\Autoit\Scripts\Playlisterplayer.exe")
    Case $Button2

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func _guictrllistbox_getselected($hWnd)
    ; For $getselectedfor = 1 to _GUICtrlListBox_GetCount($hWnd)
    ; $getsel = _GUICtrlListBox_GetSel($hWnd,$getselectedfor)
    ; If $getsel = True Then
    ; Return $
    ; EndIf
    ; Next
    ; Return
    EndFunc

    [/autoit]

    Es soll die Datei

    [autoit]

    @desktopdir&"\playlister\playednow\playednow.played"

    [/autoit]

    erstellen und mit dem Pfad der .playlist datei beschrieben werden.

    Ich bin am verzweifeln.