Enter in Listbox

  • Spoiler anzeigen
    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <Constants.au3>

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

    Global Const $VK_RETURN = 0x0D

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

    $hGUI = GUICreate("", 200, 200)
    $hListView = _GUICtrlListView_Create($hGUI, "Spalte 1", 10, 10)
    For $i = 1 To 10
    _GUICtrlListView_AddItem($hListView, Random(1,1000,1))
    Next
    GUISetState(@SW_SHOW)

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

    $wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
    $wProcOld = _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))

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

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    case $GUI_EVENT_CLOSE
    _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, $wProcOld)
    DllCallbackFree($wProcHandle)
    Exit
    EndSwitch
    Wend

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

    Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
    Switch $hWnd
    Case $hListView
    Switch $Msg
    Case $WM_GETDLGCODE
    Switch $wParam
    Case $VK_RETURN
    MsgBox(0,0, _GUICtrlListView_GetItemText($hListview,_GUICtrlListView_GetSelectedIndices($hListview)))
    Return 0
    EndSwitch
    EndSwitch
    EndSwitch

    Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
    EndFunc

    [/autoit]
  • Das würde mich auch interessieren.

    Aber generell auch für Inputfelder, Editfelder, etc...

    Es gibt da noch die Funktion HotKeySet, aber die prüft den Tastendruck auch nicht im aktiven Control.


  • Danke, funktioniert soweit.

  • poste bitte dein script, dann kann ich dir bestimmt besser helfen.

    In Kürze, was das Script bis jetzt tut:
    Auruf der Youtube Search Api
    Holen Liste aller Videos für einen Nicknamen/Schlagwort
    Ein/Auslesen der Daten in eine temp. Datei
    Datei in Listview


    Listbox will ich zum auswählen der einzelnen Reportseiten verwenden.

    Danke im voraus. Code ist z. T. unübersichtlich, ich weiß das selbst

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    #Include <GuiListView.au3>
    #include <GuiStatusBar.au3>
    #Include <GuiListBox.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Include <GuiEdit.au3>
    #include <GuiImageList.au3>
    #include <Constants.au3>
    #include <GDIPlus.au3>
    #include "_GUIImageList_AddBitmapEx.au3"
    #Include <Misc.au3>

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

    #Region ### START Koda GUI section ### Form=

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

    Local $aParts[3] = [250, 550, -1]

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

    $Form1 = GUICreate("Youtube Video Suche", 733, 547, 192, 124)
    $hStatus = _GUICtrlStatusBar_Create ($Form1, $aParts)

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

    $rc = ping("www.youtube.de")
    If $rc = 0 Then
    $lb_MsgText1 = GUICtrlCreateLabel("Keine aktive Internetverbindung vorhanden!", 40, 124, 540, 100)
    GUICtrlSetFont(-1, 22, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFF0000)
    Else

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

    $lV_Searchresults = GUICtrlCreateListView("", 40, 72, 661, 450)
    GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0x0000A0)
    GUICtrlSetBkColor(-1, 0xBBCCEE)

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

    $ListView1context = GUICtrlCreateContextMenu($lV_Searchresults)
    $MenuItem1 = GUICtrlCreateMenuItem("Del", $ListView1context)

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

    ; Add columns
    ;_GUICtrlListView_AddColumn($lV_Searchresults, "", 25)
    _GUICtrlListView_AddColumn($lV_Searchresults, "Nr", 95, 1)
    _GUICtrlListView_AddColumn($lV_Searchresults, "Titel", 200)
    _GUICtrlListView_AddColumn($lV_Searchresults, "Dauer", 50, 1)
    _GUICtrlListView_AddColumn($lV_Searchresults, "Schlüsselwörter", 350)
    _GUICtrlListView_AddColumn($lV_Searchresults, "YTID", 0)

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

    ; Create an image list with images
    $hImage = _GUIImageList_Create(65, 55, 5, 1)
    _GUIImageList_AddBitmapEx($hImage, @ScriptDir & "\Icons\default.jpg")
    _GUICtrlListView_SetImageList($lV_Searchresults, $hImage, 1)
    EndIf

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

    $lb_Author = GUICtrlCreateLabel("Name/Nickname des Authors", 40, 24, 140, 17)
    $ef_Author = GUICtrlCreateInput("7600Celsius", 40, 45, 140, 20)

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

    $lb_Keyword = GUICtrlCreateLabel("Schlüsselwort", 185, 24, 140, 17)
    $ef_Keyword = GUICtrlCreateInput("", 185, 45, 140, 20)

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

    $btn = GUICtrlCreateButton("Suche starten", 330, 45, 90, 20)

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

    $lb_MsgText = GUICtrlCreateLabel("Hole Seite 1", 572, 24, 60, 17)
    GUICtrlSetState($lb_MsgText, $GUI_HIDE)
    $hListBox = GUICtrlCreateList("", 658, 22, 40, 55)
    GUICtrlSetState($hListBox, $GUI_HIDE)
    ControlSend($Form1, "", $ef_Author, "{END}")
    ControlFocus($Form1, "", $ef_Author)
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    Dim $aRecords, $lV_Searchresults_values[50][7]

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    ExitLoop
    Case $btn
    if ControlGetText($Form1, "", $ef_Author) = "" AND _
    ControlGetText($Form1, "", $ef_Keyword) = "" then
    MsgBox(64, "Youtube Video Suche - Fehler", "Suchkriterium fehlt: " & @CRLF & @CRLF & _
    "Entweder Nickname oder 1 Schlüsselwort" & @CRLF & "muß vorhanden sein")
    ControlFocus($Form1, "", $ef_Author)
    ContinueCase
    ElseIf ControlGetText($Form1, "", $ef_Author) <> "" AND _
    ControlGetText($Form1, "", $ef_Keyword) <> "" then
    $YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=" & ControlGetText($Form1, "", $ef_Keyword)& "&author=" & ControlGetText($Form1, "", $ef_Author)
    ElseIf ControlGetText($Form1, "", $ef_Author) <> "" Then
    $YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&author=" & ControlGetText($Form1, "", $ef_Author)
    Else
    $YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=" & ControlGetText($Form1, "", $ef_Keyword)
    endif
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $YTQuery = ' & $YTQuery & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    GUICtrlSetState($hListBox, BitOR($GUI_enable, $GUI_HIDE))
    GUICtrlSetState($lb_MsgText, BitOR($GUI_enable, $GUI_HIDE))
    GUICtrlSetState($btn, $GUI_disable)
    ControlSetText($Form1, "", $btn, "Hole Daten ...")
    ; MsgBox(64, "Info", "Autkor: " & ControlGetText($Form1, "", $ef_Author))
    ;Sleep(5000)
    fnc_GetYTData($YTQuery)
    ControlSetText($Form1, "", $btn, "Suche")
    GUICtrlSetState($btn, $GUI_enable)
    GUICtrlSetState($hListBox, BitOR($GUI_enable, $GUI_SHOW))
    GUICtrlSetState($lb_MsgText, BitOR($GUI_enable, $GUI_SHOW))
    case $hListBox
    if _IsPressed("0D") then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Enter in Listbox')
    EndSwitch
    WEnd
    GUIDelete($Form1)

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

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word

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

    Switch $hWndFrom
    Case $hListBox, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
    _DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    $rc = _GUICtrlListBox_GetCount($hListBox)
    _DebugPrint("Einträge: " & @TAB & $rc)
    $aglbitems = _GUICtrlListBox_GetCurSel($hListBox)
    _DebugPrint("Ausgewählt: " & @TAB & $aglbitems)
    ; no return value
    Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request
    _DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus
    _DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box
    _DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed
    _DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    Return _ListDblClick()
    ; no return value
    Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus
    _DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    EndSwitch
    EndSwitch
    ; Proceed the default Autoit3 internal message commands.
    ; You also can complete let the line out.
    ; !!! But only 'Return' (without any value) will not proceed
    ; the default Autoit3-message in the future !!!
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

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

    Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-->")
    ConsoleWrite("!===========================================================" & @LF & _
    "+===========================================================" & @LF & _
    "-->" & $s_text & @LF & _
    "+===========================================================" & @LF)
    EndFunc ;==>_DebugPrint

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

    Func _ListDblClick()
    Local $indx = _GUICtrlListBox_GetCurSel($hListBox)
    ControlSetText($Form1, "", $lb_MsgText, "Hole Seite " & _GUICtrlListBox_GetText($hListBox, $indx))
    EndFunc

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

    Func fnc_GetYTData($SearchArg)

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

    $rc = FileDelete(@ScriptDir & "\update.dat")
    _GUICtrlStatusBar_SetText ($hStatus, "Hole Kataloginformationen", 1)
    ; Local $hDownload = InetGet("http://gdata.youtube.com/feeds/api/users/7600celsius/uploads?max-results=50&start-index=1&lr=de", @ScriptDir & "\update.dat", 1, 1)
    ; Local $hDownload = InetGet("http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=relax&author=7600CELSIUS", @ScriptDir & "\update.dat", 1, 1)

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

    Local $hDownload = InetGet($SearchArg, @ScriptDir & "\update.dat", 1, 1)
    Do
    Sleep(250)
    Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
    Local $nBytes = InetGetInfo($hDownload, 0)
    InetClose($hDownload) ; Close the handle to release resourcs.
    ;MsgBox(0, "", "Bytes read: " & $nBytes)

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

    _GUICtrlStatusBar_SetText ($hStatus, "Bereite auf ...", 1)

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

    $rcfo = FileOpen(@ScriptDir & "\update.dat")
    $fileline = FileReadLine($rcfo, 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fileline = ' & $fileline & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $newchars = StringReplace($fileline, "><", ">|<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $chars = ' & $newchars & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    $rc = FileClose($rcfo)
    _GUICtrlStatusBar_SetText ($hStatus, "Lade...", 1)

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

    $aRecords = StringSplit($newchars, "|")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aRecords = ' & UBound($aRecords) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    $chars = ""
    $newchars = ""

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

    _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($lV_Searchresults))
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($lV_Searchresults))
    _GUICtrlListView_EndUpdate(GUICtrlGetHandle($lV_Searchresults))

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

    Local $astartiResult = _ArrayFindAll($aRecords, "<entry", 0, 0, 0, 1)

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

    ;_ArrayDisplay($astartiResult, "Results of searching for 0 in $avArray")

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

    Local $aendiResult = _ArrayFindAll($aRecords, "</entry", 0, 0, 0, 1)

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

    ;_ArrayDisplay($aendiResult, "Results of searching for 0 in $avArray")
    if UBound($astartiResult) > UBound($aendiResult) then Exit
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : UBound($aendiResult) = ' & UBound($aendiResult) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : UBound($astartiResult) = ' & UBound($astartiResult) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    for $lv = 0 to UBound($astartiResult) - 1
    if StringInStr($aRecords[$lv],"<openSearch:totalResults>") > 0 Then
    $dataArea = StringReplace($aRecords[$lv],">",">|")
    $dataArea = StringReplace($dataArea,"<","|<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Katinfo gefunden ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = StringSplit($dataArea,"|")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Anzahl Einträge ' & $dataArea[3] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $AnzSeiten = Int($dataArea[3] / 50)
    ;_GUICtrlStatusBar_SetText ($hStatus, "Anzahl Seiten: " & $AnzSeiten & ", Aktuelle Seite: " & $dataArea[2], 0)

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

    EndIf

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

    if StringInStr($aRecords[$lv],"<openSearch:startIndex>") > 0 Then
    $dataArea = StringReplace($aRecords[$lv],">",">|")
    $dataArea = StringReplace($dataArea,"<","|<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Katinfo gefunden ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = StringSplit($dataArea,"|")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Anzahl Einträge ' & $dataArea[3] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $AktSeite = Int($dataArea[3] / 50)
    if $AktSeite < 1 then $AktSeite = 1
    _GUICtrlStatusBar_SetText ($hStatus, "Anzahl Seiten: " & $AnzSeiten & ", Aktuelle Seite: " & $AktSeite, 0)
    EndIf

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

    ;ConsoleWrite('@@ Debug ' & $lv &' =========================================================' & @CRLF)
    for $mediagroup = $astartiResult[$lv] + 1 to $aendiResult[$lv] - 1
    ; ConsoleWrite('@@ Debug ' & $aRecords[$mediagroup] & @CRLF)
    if StringInStr($aRecords[$mediagroup],"<media:keywords>") > 0 Then
    $dataArea = StringStripWS($aRecords[$mediagroup], 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = _StringBetween($dataArea,">","<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $lV_Searchresults_values[$lv][0] = $dataArea[0]

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

    EndIf

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

    if StringInStr($aRecords[$mediagroup],"<id>") > 0 Then
    $dataArea = StringStripWS($aRecords[$mediagroup], 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = _StringBetween($dataArea,">","<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $lV_Searchresults_values[$lv][1] = StringReplace($dataArea[0], "http://gdata.youtube.com/feeds/api/videos/", "")

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

    EndIf

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

    if StringInStr($aRecords[$mediagroup],"<media:title") > 0 Then
    $dataArea = StringStripWS($aRecords[$mediagroup], 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = _StringBetween($dataArea,">","<")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $lV_Searchresults_values[$lv][2] = $dataArea[0]

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

    EndIf

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

    if StringInStr($aRecords[$mediagroup],"<published>") > 0 Then
    $dataArea = StringStripWS($aRecords[$mediagroup], 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = _StringBetween($dataArea,">","<")
    $dataArea = _StringBetween($dataArea[0], "", "T")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = StringSplit($dataArea[0], "-")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & UBound($dataArea) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $lV_Searchresults_values[$lv][3] = $dataArea[3] & "." & $dataArea[2] & "." & $dataArea[1]

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

    EndIf

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

    if StringInStr($aRecords[$mediagroup],"<yt:duration") > 0 Then
    $dataArea = StringStripWS($aRecords[$mediagroup], 1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $dataArea = _StringBetween($dataArea,"'","'")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $tempMinuten = Int($dataArea[0] / 60)
    $lV_Searchresults_values[$lv][4] = Int($dataArea[0] / 60) & ":" & StringFormat("%02d",$dataArea[0] - ($tempMinuten * 60))
    $lV_Searchresults_values[$lv][5] = $dataArea[0]
    $lV_Searchresults_values[$lv][6] = $dataArea[0] * 192 * 1000 ;/ (1024 * 1024 * 8)

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

    EndIf
    Next
    $NewItem = _GUICtrlListView_AddItem($lV_Searchresults, $lv+1)
    _GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][2], 1, 1)
    _GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][4], 2, 1)
    _GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][0], 3, 1)
    _GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][1], 4, 1)

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

    Next
    ; _ArrayDisplay($lV_Searchresults_values, "Results of searching for 0 in $avArray")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $lV_Searchresults_values) = ' & UBound($lV_Searchresults_values) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    for $i = 0 to _GUICtrlListBox_GetCount(GUICtrlGetHandle($hListBox)) + 1
    _GUICtrlListBox_DeleteString(GUICtrlGetHandle($hListBox), $i)
    Next

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

    for $i = 1 to $AnzSeiten
    _GUICtrlListBox_AddString(GUICtrlGetHandle($hListBox), $i)
    Next

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

    _GUICtrlListBox_SetCurSel(GUICtrlGetHandle($hListBox), 0)
    _GUICtrlStatusBar_SetText ($hStatus, "Fertig", 1)
    GUICtrlSetState($lb_MsgText, $GUI_SHOW)
    GUICtrlsetState(GUICtrlGetHandle($hListBox), $GUI_SHOW)
    ControlFocus($Form1, "", GUICtrlGetHandle($hListBox))
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : GUICtrlgetState($hListBox, $GUI_SHOW) = ' & GUICtrlgetState($hListBox) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Das würde mich auch interessieren.

    Aber generell auch für Inputfelder, Editfelder, etc...

    Es gibt da noch die Funktion HotKeySet, aber die prüft den Tastendruck auch nicht im aktiven Control.

    Spoiler anzeigen
    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <Constants.au3>

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

    Global Const $VK_RETURN = 0x0D

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

    $hGUI = GUICreate("", 200, 200)
    $input =GUICtrlCreateInput("bla",5,5)
    $hInput = GUICtrlGetHandle($input)
    GUISetState(@SW_SHOW)

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

    $wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
    $wProcOld = _WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))

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

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    case $GUI_EVENT_CLOSE
    _WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, $wProcOld)
    DllCallbackFree($wProcHandle)
    Exit
    EndSwitch
    Wend

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

    Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
    Switch $hWnd
    Case $hInput
    Switch $Msg
    Case $WM_GETDLGCODE
    Switch $wParam
    Case $VK_RETURN
    MsgBox(0,0, GUICtrlRead($input))
    Return 0
    EndSwitch
    EndSwitch
    EndSwitch

    Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
    EndFunc

    [/autoit]