Benötige Hilfe Einweißung in Treeview

  • Hi,

    Ich möchte ein Programm schreiben in dem am ende eine INI datei mit den einstellungen ausgeworfen wird. Der benutzer bekommt eine GUI in der nur eine Treeview und 2 Bilder drinne sind. Mehr nicht. Der Benutzer soll nun den Treeview gestalten, er legt sozusagen Folder an und in die Folder dann, über Kontextmenüe -> Dropdown Items.
    Die Items kommen aus einer Vorlage. zb

    Sessions.txt Inhalt (Jede Zeile ist ein Item):

    https://autoit.de/www.google.de
    c:/Documentationen\
    Hostname1
    Hostname2
    FTP-Session1
    "Mein Gott was weiß ich"


    So. Das zum Ablauf des Programms.
    Aus der Suche über Google und AutoIT suche kommt nicht grade viel bei raus.

    Treeview mit Checkbox nett aber hilft mir nicht.

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

    #include<GUIConstantsEx.au3>
    #include<GuiTreeView.au3>
    #include<TreeViewConstants.au3>
    #include<WindowsConstants.au3>

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

    Global $hGui = GUICreate('TreeView-(Un)Checked-Example', 400, 600)
    Global $hTreeView = GUICtrlCreateTreeView(5, 5, 390, 590, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE)
    Global $hRoot = GUICtrlCreateTreeViewItem('Root', $hTreeView)
    _GUICtrlTreeView_SetBold($hTreeView, $hRoot)
    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 1 To 3
    $hItem1 = _GUICtrlTreeView_AddChild($hTreeView, GUICtrlGetHandle($hRoot), StringFormat('[d] Child 1st Gen.', $x))
    For $y = 1 To 3
    $hItem2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, StringFormat('[d] Child 2nd Gen.', $y))
    For $z = 1 To 2
    $hItem3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem2, StringFormat('[d] Child 3rd Gen.', $z))
    Next
    Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)
    _GUICtrlTreeView_Expand($hTreeView)
    GUISetState()

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_PRIMARYDOWN ; (*)
    $aInfo = GUIGetCursorInfo($hGui) ; (*)
    If $aInfo[4] = $hTreeView Then ; (*)
    $aAdjust = ControlGetPos($hGui, '', $hTreeView) ; (*)
    If BitAND(_GUICtrlTreeView_HitTest($hTreeView, $aInfo[0]-$aAdjust[0]-2, $aInfo[1]-$aAdjust[1]-2), 64) Then ; (*)
    $hSelect = _GUICtrlTreeView_GetSelection($hTreeView)
    $checked = _GUICtrlTreeView_GetChecked($hTreeView, $hSelect)
    $hItem = _GUICtrlTreeView_GetFirstChild($hTreeView, $hSelect)
    If $hItem Then _SetChildItemsChecked($hTreeView, $hItem, $checked)
    If $checked Then
    _VerifySiblingItems($hTreeView, $hSelect)
    Else
    _SetParentItemsUnchecked($hTreeView, $hSelect)
    EndIf
    EndIf
    EndIf
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd
    ; (*) = diese Konstruktion ist notwendig, weil man sonst nicht zwischen einem Mausklick
    ; auf den Item-Text und der Checkbox unterscheiden kann

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

    ; Überprüft (rekursiv) ob alle Sibling-Items angehakt sind und setzt, wenn zutreffend, den Haken beim Parent-Item
    Func _VerifySiblingItems($hTreeView, $hItem)
    Local $hTmp, $hSave = $hItem, $iCount = _GUICtrlTreeView_GetSiblingCount($hTreeView, $hItem)
    While True
    $hTmp = _GUICtrlTreeView_GetNextSibling($hTreeView, $hItem)
    If Not $hTmp Then ExitLoop
    $hItem = $hTmp
    WEnd
    Do
    If _GUICtrlTreeView_GetChecked($hTreeView, $hItem) Then $iCount -= 1
    $hItem = _GUICtrlTreeView_GetPrevSibling($hTreeView, $hItem)
    Until Not $hItem
    If Not $iCount Then
    Local $hParent = _GUICtrlTreeView_GetParentHandle($hTreeView, $hSave)
    If $hParent Then
    _GUICtrlTreeView_SetChecked($hTreeView, $hParent)
    _VerifySiblingItems($hTreeView, $hParent)
    EndIf
    EndIf
    EndFunc

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

    ; Setzt (rekursiv) den Haken bei allen Child-Items, wenn der Haken bei einem Item gesetzt wurde
    Func _SetChildItemsChecked($hTreeView, $hItem, $checked)
    Do
    Local $hNewItem = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
    If $hNewItem Then _SetChildItemsChecked($hTreeView, $hNewItem, $checked)
    _GUICtrlTreeView_SetChecked($hTreeView, $hItem, $checked)
    $hItem = _GUICtrlTreeView_GetNextChild($hTreeView, $hItem)
    Until Not $hItem
    EndFunc

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

    ; Entfernt (rekursiv) den Haken bei allen Parents, wenn der Haken von einem Item entfernt wurde
    Func _SetParentItemsUnchecked($hTreeView, $hItem)
    Local $hParent = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem)
    If $hParent Then _SetParentItemsUnchecked($hTreeView, $hParent)
    _GUICtrlTreeView_SetChecked($hTreeView, $hItem, False)
    EndFunc

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

    Treeview das mit ein Explorer darstellt. Nett hilft mir leider auch nicht.

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <GuiImageList.au3>
    #include <GuiTreeView.au3>
    #include <StructureConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    Opt('MustDeclareVars', 1)

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

    Global $hGui = GUICreate('FileExplorer', 400, 400)

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

    Global Const $Delim = '\', $Delim1 = '|'

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

    Global $hTreeview = GUICtrlCreateTreeView(10, 10, 380, 360)
    Global $hWndTreeview = GUICtrlGetHandle($hTreeview)
    Global $hOk = GUICtrlCreateButton('Ok', 240, 375, 60, 22)
    Global $hCancel = GUICtrlCreateButton('Cancel', 320, 375, 60, 22)

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

    Global $hImage = _GUIImageList_Create(16, 16, 5, 1)
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 3) ; Verzeichnis-Icon
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 110) ; Verzeichnis-Icon mit Haken
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 1) ; Datei-Icon
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 5) ; Diskette
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 7) ; Wechseldatenträger
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 8) ; Festplatte
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 11) ; CDROM
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 12) ; Netzwerklaufwerk
    _GUIImageList_AddIcon($hImage, 'shell32.dll', 53) ; Unbekannt
    _GUICtrlTreeView_SetNormalImageList($hTreeview, $hImage)

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

    GUISetState()
    GUICtrlSetStyle($hTreeview, Default, BitOR($WS_EX_COMPOSITED, $WS_EX_CLIENTEDGE))

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

    If ToolTip('Please wait...', Default, Default, 'Read Directory', 1) Then Local $aDrives = DriveGetDrive('ALL'), $iLWindex, $hRoot
    For $i = 1 To $aDrives[0]
    $iLWindex = 0
    Switch DriveGetType($aDrives[$i])
    Case 'Fixed'
    $iLWindex = 5
    Case 'CDROM'
    $iLWindex = 6
    Case 'RAMDisk'
    $iLWindex = 7
    Case 'Removable'
    $iLWindex = 4
    If StringLeft($aDrives[$i], 2) = 'a:' Or StringLeft($aDrives[$i], 2) = 'b:' Then $iLWindex = 3
    Case Else
    $iLWindex = 8
    EndSwitch
    $hRoot = _GUICtrlTreeView_Add($hTreeview, $hTreeview, StringUpper($aDrives[$i]), $iLWindex, $iLWindex)
    If DriveStatus($aDrives[$i]) <> 'READY' Then ContinueLoop
    If _GUICtrlTreeView_BeginUpdate($hTreeview) And _GUICtrlTreeView_FileExplorer($hTreeview, $hRoot, $aDrives[$i]) Then _GUICtrlTreeView_EndUpdate($hTreeview)
    Next
    ToolTip('')

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

    GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $hCancel
    Exit
    Case $hOk
    MsgBox(0, 'Selected Path/File', StringReplace(_GUICtrlTreeView_GetTree($hTreeview, _GUICtrlTreeView_GetSelection($hTreeview)), $Delim1, $Delim))
    EndSwitch
    WEnd

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

    Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hChild, $hITEM, $tNMTREEVIEW = DllStructCreate($tagNMTREEVIEW, $ilParam)
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = $hWndTreeview Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
    Switch DllStructGetData($tNMTREEVIEW, 'Action')
    Case $TVE_EXPAND
    If ToolTip('Please wait...', Default, Default, 'Read Directory', 1) Then $hITEM = DllStructGetData($tNMTREEVIEW, 'NewhItem')
    If _GUICtrlTreeView_GetExpanded($hTreeview, $hITEM) Then Return $GUI_RUNDEFMSG
    $hChild = _GUICtrlTreeView_GetFirstChild($hTreeview, $hITEM)
    If Not $hChild Then Return $GUI_RUNDEFMSG
    If _GUICtrlTreeView_BeginUpdate($hTreeview) Then _GUICtrlTreeView_DeleteChildren($hTreeview, $hChild)
    _GUICtrlTreeView_FileExplorer($hTreeview, $hChild, StringReplace(_GUICtrlTreeView_GetTree($hTreeview, $hChild), $Delim1, $Delim))
    Do
    $hChild = _GUICtrlTreeView_GetNextChild($hTreeview, $hChild)
    If Not $hChild Then ExitLoop
    _GUICtrlTreeView_DeleteChildren($hTreeview, $hChild)
    _GUICtrlTreeView_FileExplorer($hTreeview, $hChild, StringReplace(_GUICtrlTreeView_GetTree($hTreeview, $hChild), $Delim1, $Delim))
    Until False
    If _GUICtrlTreeView_EndUpdate($hTreeview) Then ToolTip('')
    EndSwitch
    EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

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

    Func _GUICtrlTreeView_FileExplorer($hTreeview, $hITEM, $sPath)
    Local $sFileList, $sFolderList, $aDirList, $hSearch, $sFile
    Local $iHidden = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'Hidden') - 1
    Local $iSuperHidden = Not RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden')
    $hSearch = FileFindFirstFile($sPath & $Delim & '*')
    If $hSearch = -1 Then Return True
    Do
    $sFile = FileFindNextFile($hSearch)
    If @error Then ExitLoop
    Switch @extended
    Case False
    If $iHidden And StringInStr(FileGetAttrib($sPath & $Delim & $sFile), 'H') Then ContinueLoop
    If $iSuperHidden And StringInStr(FileGetAttrib($sPath & $Delim & $sFile), 'S') Then ContinueLoop
    $sFileList &= $sFile & $Delim1
    Case True
    If _IsReparsePoint($sPath & $Delim & $sFile) Then ContinueLoop
    $sFolderList &= $sFile & $Delim1
    EndSwitch
    Until False
    FileClose($hSearch)
    If $sFolderList & $sFileList = '' Then Return True
    $aDirList = StringSplit(StringTrimRight($sFolderList & $sFileList, 1), $Delim1, 2)
    For $sFile In $aDirList
    If StringInStr(FileGetAttrib($sPath & $Delim & $sFile), 'D') Then
    _GUICtrlTreeView_AddChild($hTreeview, $hITEM, $sFile, 0, 1)
    Else
    _GUICtrlTreeView_AddChild($hTreeview, $hITEM, $sFile, 2, 2)
    EndIf
    Next
    Return True
    EndFunc ;==>_GUICtrlTreeView_FileExplorer

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

    Func _IsReparsePoint($FLS) ; progandy
    Dim Static $K32 = DllOpen('kernel32.dll')
    Dim $DA = DllCall($K32, 'dword', 'GetFileAttributesW', 'wstr', $FLS)
    If @error Then Return SetError(1, @error, False)
    Return BitAND($DA[0], 1024) = 1024
    EndFunc ;==>_IsReparsePoint

    [/autoit]

    Könnt ihr mir Helfen? Ich brauch Eine Treeview in der man Folder und Items anlegen kann. Items werden aus einem Dropdown (vordefiniert) oder extra zusätzlich eingetragen über ein Inputfeld. Das man über ein Kontextmenüe erreichen kann. Wie bau ich da pro Term ein Kontextmenü drann? Jede änderung soll gleich in die InI geschrieben werden. Wie programire ich das so? Ich habe bisher immer nur mit Button "Speichern" gearbeitet. Wo man zum Schluss alles Speichert. Habe also Keine erfahrung mit so einem Luxus ^^

    Normal ließt er die Ini wenn vorhanden ein beim Starten. Dann stellt er was dar. Wenn ich da was ändere soll es mit geändert werden. Finde das ist schwer. Normal hab ich die alte datei einfach gelöscht und neu erstellt. Breuchte also ne art wegweißer dazu.

    Mal sehen was zusammen kommt. Danke
    :)

    Einmal editiert, zuletzt von Skar (13. Mai 2014 um 16:46)

  • Achso hier ist das Skript das ich schon habe.
    Hier ist die GUI mit Treeview + Kontextmenüe (allerdings grade nur für den ersten eintrag. der Import für die Vorlagen geht auch.

    Ein Probelem passiert, wenn ich ein neues Item hinzufüge, es kommt zu einer ungewollten wiederholung. Normal sollte er einmal abfragen. Was hab cih da für einen fehler? Wie bekomme ich den behoben?
    Massenimport kommt später drann.

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>

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

    #include<GuiTreeView.au3>
    #include <GuiListView.au3>

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

    #Region ### START Koda GUI section ###
    $Form1_1 = GUICreate("MobaXterm Create INI", 1265, 879, 266, 124)
    ;$MenuItem1 = GUICtrlCreateMenu("&Import Vorlagen")

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

    $TreeView1 = GUICtrlCreateTreeView(8, 8, 265, 825)

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

    $TreeView1_0 = GUICtrlCreateTreeViewItem("Sessions", $TreeView1)
    $buttoncontext = GUICtrlCreateContextMenu($TreeView1_0)
    $buttonitemGA = GUICtrlCreateMenuitem("Gruppe Anlegen", $buttoncontext)
    $buttonitemIA = GUICtrlCreateMenuitem("Item Anlegen", $buttoncontext)
    $buttonitemIP = GUICtrlCreateMenuitem("Import Vorlagen aus Textdatei", $buttoncontext)

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

    $Tab1 = GUICtrlCreateTab(288, 8, 969, 825)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    $TabSheet1 = GUICtrlCreateTabItem("Folder Icons List for chose Icon Number")
    $Pic3 = GUICtrlCreatePic(".\My Documents\My Pictures\Folder Icon.JPG", 304, 51, 692, 268)
    $TabSheet2 = GUICtrlCreateTabItem("Session Icons List for chose Icon Number")
    $Pic1 = GUICtrlCreatePic(".\My Documents\My Pictures\Session Icon.JPG", 307, 52, 932, 556)
    GUICtrlCreateTabItem("")
    _GUICtrlTreeView_Expand($TreeView1)
    GUISetState(@SW_SHOW)

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

    $Form22 = GUICreate("Session Select", 490, 164, 313, 208)
    $Label21 = GUICtrlCreateLabel("Wähle die Session aus:", 24, 24, 152, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    $Combo21 = GUICtrlCreateCombo("Session Vorlagen", 24, 48, 441, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    $Label22 = GUICtrlCreateLabel("oder", 24, 72, 31, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    $Input21 = GUICtrlCreateInput("", 24, 96, 441, 21)
    $Button21 = GUICtrlCreateButton("OK", 160, 128, 139, 25)

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

    #EndRegion ### END Koda GUI section ###
    $counterGruppe = 0
    $counterItem = 0
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $TreeView1

    Case $buttonitemGA
    $value = InputBox("Gruppe Anlegen", "Bitte geben Sie den Namen der Gruppe an.", "", " M20")
    _GUICtrlTreeView_BeginUpdate($TreeView1)
    $counterGruppe = $counterGruppe + 1
    $TreeView1_GA = _GUICtrlTreeView_AddChild($TreeView1, 0, StringFormat($value, $counterGruppe))
    ;$TreeView1_0 = GUICtrlCreateTreeViewItem("Sessions", $TreeView1)
    $buttoncontext = GUICtrlCreateContextMenu($TreeView1_0)
    $buttonitemGA = GUICtrlCreateMenuitem("Gruppe Anlegen", $buttoncontext)
    $buttonitemIA = GUICtrlCreateMenuitem("Item Anlegen", $buttoncontext)
    _GUICtrlTreeView_EndUpdate($TreeView1)
    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)

    Case $buttonitemIA
    GUISetState(@SW_SHOW, $Form22)

    Case $Button21

    $combotext = GUICtrlRead($Combo21)
    $inputtext = GUICtrlRead($Input21)
    _GUICtrlTreeView_BeginUpdate($TreeView1)
    $counterItem = $counterItem + 1
    $TreeView1_GA = _GUICtrlTreeView_AddChild($TreeView1, 0, StringFormat($combotext & $inputtext, $counterGruppe))
    ;$TreeView1_0 = GUICtrlCreateTreeViewItem("Sessions", $TreeView1)
    $buttoncontext = GUICtrlCreateContextMenu($TreeView1_0)
    $buttonitemGA = GUICtrlCreateMenuitem("Gruppe Anlegen", $buttoncontext)
    $buttonitemIA = GUICtrlCreateMenuitem("Item Anlegen", $buttoncontext)
    _GUICtrlTreeView_EndUpdate($TreeView1)
    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)
    GUISetState(@SW_HIDE, $Form22)


    Case $buttonitemIP ;, $MenuItem1
    $error = 0
    $filetoreadselect = FileOpenDialog("Computerliste öffnen", @scriptdir & "", "Textdatei (*.txt)|All (*.*)")
    $filetoread = FileOpen($filetoreadselect, 0)
    ConsoleWrite ( " Open List....$filetoread"& $filetoread&@CRLF)
    If $filetoread = -1 Then
    MsgBox($MB_SYSTEMMODAL, "", "Unable to open file.")
    $error = 1
    EndIf

    If $error = 0 Then
    $lineComplete = ""
    ; Read in lines of text until the EOF is reached
    While 1
    Local $line = FileReadLine($filetoread)
    If @error = -1 Then ExitLoop
    $lineComplete = $lineComplete & "|" & $line
    Wend
    EndIf
    FileClose($filetoread)
    GUICtrlSetData($Combo21, $lineComplete )
    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)

    EndSwitch
    WEnd

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


    Noch eine Frage wie ist move von Items möglich per drag and drop?

    Einmal editiert, zuletzt von Skar (14. Mai 2014 um 13:20)

  • Warum hast du vor hunderte von Contextmenü's zu erstellen? Eines reicht doch.
    Noch dazu überschreibst du immer die $buttoncontext, $buttonitemGA und $buttonitemIA
    Leg das Menü auf die Komplette Treeview

    [autoit]

    $buttoncontext = GUICtrlCreateContextMenu($TreeView1)

    [/autoit]


    Und lass deine zeilen 63-65 und 80-82 raus.

  • Was das dauerhafte überschreiben der ini angeht wäre es ja vermutlich am besten, wenn du alles einträgst und dann mit

    [autoit]

    IniWrite()

    [/autoit]

    die Werte änderst.
    Wenn du eine unterschiedliche Anzahl an Einträgen hast würde ich einen Count-Eintrag mit der Anzahl der Einträge anlegen und dann hochzählen.
    Bsp: (eintrag steht für die Funktion der Einträge)

    Spoiler anzeigen


    eintrag=3
    eintrag1=irgendwas
    eintrag2=irgendwas
    eintrag3=irgendwas


    Dann kannst du bequem mit einer For-Schleife die Einträge auslesen.

    Nun zum ändern, wenn einzelne Einträge geändert werden. Dazu solltest du dich näher mit WM_Command und WM_Notify auseinandersetzen.
    In dem Spoiler hier findest du nen Beispiel einer WM_Command und WM_Notify Funktion. Die Variablen sind Handle zu den jeweiligen controls (im Namen steht, welche).
    Desweiteren findet sich noch eine Funktion, mit der Drag and Drop verarbeitet werden kann.

    Spoiler anzeigen
    [autoit]

    GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUISetOnEvent($GUI_EVENT_DROPPED,"_Event_DragAndDrop",$FTPGui)

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

    Func _Event_DragAndDrop()
    if @GUI_DragId=$FTPGui_ListView1 then
    if @GUI_DropId=$FTPGui_ListView2 then
    ;_FTP_FilePut
    $p1=getPathFromTreeView($FTPGui_ListTree1,_GUICtrlTreeView_GetSelection($FTPGui_ListTree1))
    $p2=_GUICtrlListView_GetItemText($FTPGui_ListView1,int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView1)))
    $localPath=$p1&""&$p2
    $p1=getFTPPathFromTreeView($FTPGui_ListTree2,_GUICtrlTreeView_GetSelection($FTPGui_ListTree2))
    ;$p2=_GUICtrlListView_GetItemText($FTPGui_ListView2,int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView2)))
    $remotePath=$p1&"/"&$p2
    if $remotePath="root" then
    $remotePath=StringReplace($remotePath,"root","/",1)
    endif
    $remotePath=StringReplace($remotePath,"root","",1)
    GUICtrlSetData($FTPGui_Label1,"Uploading "&$localPath&" to "&$remotePath)
    GUICtrlSetState($FTPGui_Button1,@SW_SHOW)
    _FTP_ProgressUpload($FTPhConn,$localPath,$remotePath,"show_Upload")
    GUICtrlSetState($FTPGui_Button1,@SW_HIDE)
    GUICtrlSetData($FTPGui_Label1,"Upload completed")
    endif
    elseif @GUI_DragId=$FTPGui_ListView2 then
    if @GUI_DropId=$FTPGui_ListView1 then
    msgbox(48,"","Zu LW1")
    endif
    endif
    EndFunc

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

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    If Not IsHWnd($FTPGui_Combo) Then $hWndCombo = GUICtrlGetHandle($FTPGui_Combo)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $FTPGui_Combo, GUICtrlGetHandle($FTPGui_Combo)
    Switch $iCode
    Case $CBN_SELCHANGE ; Sent when the user double-clicks a string in a list box
    _selChangeCombo()
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo")
    EndSwitch
    Case $FTPGui_ListView1
    Switch $iCode
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo LW1")
    EndSwitch
    Case $FTPGui_ListView2
    Switch $iCode
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo LW2")
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

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

    Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hChild, $hITEM, $tNMTREEVIEW = DllStructCreate($tagNMTREEVIEW, $ilParam)
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListTree1) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
    Switch DllStructGetData($tNMTREEVIEW, 'Action')
    Case $TVE_EXPAND
    $hITEM = DllStructGetData($tNMTREEVIEW, 'NewhItem')
    DirInTree("",$FTPGui_ListTree1,$hITEM,true,true)
    ;msgbox(48,"",$hITEM)
    EndSwitch
    Case $TVN_SELCHANGEDW
    $sel=_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1))
    if $sel<>0 then
    Content(getPathFromTreeView(GUICtrlGetHandle($FTPGui_ListTree1),$sel)&"",$FTPGui_ListView1)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListView1) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $NM_DBLCLK
    $selIndex=int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView1))
    if $selIndex>0 and $selIndex<$FoldersCount+1 then
    $selText=_GUICtrlListView_GetItemText($FTPGui_ListView1,$selIndex,0)
    openTreePath($selText,$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)))
    DirInTree("C:",$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true,true)
    elseif $selIndex=0 then
    $path=getPathFromTreeView($FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)))
    $ar=StringSplit($path,"")
    $string=""
    for $i=1 to UBound($ar)-2 step 1
    $string&=$ar[$i]&""
    next
    openTreePath($string,$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true)
    DirInTree("C:",$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true,true)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListTree2) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
    Switch DllStructGetData($tNMTREEVIEW, 'Action')
    Case $TVE_EXPAND
    $hITEM = DllStructGetData($tNMTREEVIEW, 'NewhItem')
    FTPDirInTree2("",$FTPGui_ListTree2,$hITEM,true,true)
    ;msgbox(48,"",$hITEM)
    EndSwitch
    Case $TVN_SELCHANGEDW
    $sel=_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2))
    if $sel<>0 then
    FTPContent(getFTPPathFromTreeView(GUICtrlGetHandle($FTPGui_ListTree2),$sel),$FTPGui_ListView2)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListView2) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $NM_DBLCLK
    $selIndex=int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView2))
    if $selIndex>0 and $selIndex<$FtpFoldersCount+1 then
    $selText=_GUICtrlListView_GetItemText($FTPGui_ListView2,$selIndex,0)
    openFTPTreePath($selText,$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)))
    FTPDirInTree2("/",$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)),true,true)
    elseif $selIndex=0 then
    $path=getFTPPathFromTreeView($FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)))
    $ar=StringSplit($path,"/")
    $string=""
    for $i=1 to UBound($ar)-2 step 1
    $string&=$ar[$i]&"/"
    next
    openFTPTreePath($string,$FTPGui_ListTree2,0,true)
    FTPDirInTree2("",$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)),true,true)
    endif
    EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

    [/autoit]

    Ich denke, du wirst erstmal damit zu tun haben, das ganze durchzuarbeiten :). (ich hab nicht unbedingt den besten Programmierstil :D)
    (Das Script, aus dem ich den Quelltext habe ist für einen FTP-Clienten, an dem ich gerade arbeite. Deshalb ist bei den Variablen überall ein FTP drin :))

  • Vielen Dank für die Tips.

    @ Schnitzel
    Hab es umgesetzt und nur auf die Treeview beschränkt.

    [autoit]

    Local $buttoncontext = GUICtrlCreateContextMenu($TreeView1)

    [/autoit]

    @ Kanashius
    Ich bin Froh das ich das mit einer InI mach. Sehr vorteilhaft. Er schreibt gleich alles so auf ichs baue.
    Mein Großes Problem wurde wirklich behoben mit
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    und die While inhalte sind nun in einer Funktion.
    Zum Thema Drag and Drop hab ich auch was gefunden, konnte aber es noch nicht umsetzen. Komme später dazu. So ich hab noch ein paar Fehler drinnen, die ich jetzt erstmal ausmerzen muss.

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GuiTreeView.au3>
    #include <Array.au3>

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

    If FileExists(@ScriptDir &"\Folder Icon.JPG") Then
    FileInstall(@ScriptDir &"\Folder Icon.JPG", @ScriptDir &"\Folder Icon.JPG")
    EndIf

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

    If FileExists(@ScriptDir &"\Session Icon.JPG") Then
    FileInstall(@ScriptDir &"\Session Icon.JPG", @ScriptDir &"\Session Icon.JPG")
    EndIf
    Opt("GUIDataSeparatorChar", "")

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

    #Region ### START Koda GUI section ### Form=c:\hans busch\daimler\programme (anwendungen)\portableapps\autoit3\app\autoit\skripte\pergon cfg\koda_1.7.3.0\forms\mobaxtermcreateinigui.kxf
    $Form1_1 = GUICreate("MobaXterm Create INI", 1265, 879, 266, 124)
    $Menu1 = GUICtrlCreateMenu("Start")
    $MenuItem1 = GUICtrlCreateMenuItem("Beenden", $Menu1)
    $TreeView1 = GUICtrlCreateTreeView(8, 8, 265, 825)
    $TreeView1_0 = GUICtrlCreateTreeViewItem("Sessions", $TreeView1)
    Local $buttoncontext = GUICtrlCreateContextMenu($TreeView1)
    ;$buttoncontext = GUICtrlCreateContextMenu($TreeView1_0)
    $buttonitemIP = GUICtrlCreateMenuitem("Import Vorlagen aus Textdatei", $buttoncontext)
    $buttonitemGA = GUICtrlCreateMenuitem("Gruppe Anlegen", $buttoncontext)
    $buttonitemIA = GUICtrlCreateMenuitem("Item Anlegen", $buttoncontext)
    $Tab1 = GUICtrlCreateTab(288, 8, 969, 825)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    If FileExists(@ScriptDir &"\Folder Icon.JPG") Then
    $TabSheet1 = GUICtrlCreateTabItem("Folder Icons List for chose Icon Number")
    $Pic3 = GUICtrlCreatePic(@ScriptDir &"\Folder Icon.JPG", 304, 51, 692, 268)
    EndIf
    If FileExists(@ScriptDir &"\Session Icon.JPG") Then
    $TabSheet2 = GUICtrlCreateTabItem("Session Icons List for chose Icon Number")
    $Pic1 = GUICtrlCreatePic(@ScriptDir &"\Session Icon.JPG", 307, 52, 932, 556)
    EndIf
    GUICtrlCreateTabItem("")
    _GUICtrlTreeView_Expand($TreeView1)
    GUISetState(@SW_SHOW)

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

    $Form22 = GUICreate("Session Select", 490, 260, 313, 208)
    $Label21 = GUICtrlCreateLabel("Wähle die Session aus:", 24, 24, 152, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    $Combo21 = GUICtrlCreateCombo("", 24, 48, 441, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    $Label22 = GUICtrlCreateLabel("oder", 24, 72, 31, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    $Input21 = GUICtrlCreateInput("", 24, 96, 441, 21)
    $Button21 = GUICtrlCreateButton("OK", 328, 200, 139, 25)
    ;~ Sessions Typs:
    ;~ Bash [Local]
    ;~ Host (User) [RDP]
    ;~ Hostname (Username) [SFTP]
    ;~ Hostname [VNC]
    ;~ Hostname aktiv (Username) [FTP]
    ;~ Hostname passiv (Username) [FTP]
    ;~ Ordner [Url]
    ;~ ping [Local] (1)
    ;~ ssh_1 [SSH]
    ;~ SSO Konfig.docx [Url]
    ;~ telnet_1 (Username) [Telnet]
    ;~ http://www.google.de [Url]
    $Combo22 = GUICtrlCreateCombo("", 24, 136, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    ; Set max number of combo elements
    Global $iMaxList = 14
    ; Initialise combo list
    Global $iComboCount = 13
    Global $aComboArray[$iMaxList] = ["Session Typ","Bash","CMD","RDP","SFDP","VNC","FTP aktiv","FDP Passiv","URL","SSH","Telnet","Dokument","Ordner_Explorer"]
    ; Clear existing combo data
    GUICtrlSetData($Combo22, "")
    ; Loop through list inserting elements into combo
    For $i = 0 To $iComboCount - 1
    GUICtrlSetData($Combo22, $aComboArray[$i])
    Next
    ; Set the top element into the combo edit box
    ;_GUICtrlComboBox_SetEditText($Combo22, $aComboArray[0])
    ;GUICtrlSetData(-1, "Session Typ|Bash|CMD|RDP|SFDP|VNC|FTP aktiv|FDP Passiv|URL|SSH|Telnet|Dokument|Ordner_Explorer")
    $Input22 = GUICtrlCreateInput("", 24, 192, 121, 21)
    $Label23 = GUICtrlCreateLabel("Login (Optional):", 24, 168, 120, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Modern No. 20")
    ;~ [Display]
    ;~ SidebarRight=0
    ;~ VisibleTabNum=1
    ;~ VisibleTabClose=1
    ;~ MenuAndButtons=2
    ;~ BtnType2=2
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Display", "SidebarRight", 0 )
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Display", "VisibleTabNum", 1 )
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Display", "VisibleTabClose", 1 )
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Display", "MenuAndButtons", 2 )
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Display", "BtnType2", 2 )

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

    ;GUISetOnEvent($GUI_EVENT_DROPPED,"_Event_DragAndDrop",$FTPGui)

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

    #EndRegion ### END Koda GUI section ###
    $counterGruppe = 0
    $counterItem = 0

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

    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

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

    While 1
    WEnd

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

    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $nID = BitAND($wParam, 0x0000FFFF)
    Local $hCtrl = $lParam

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

    If $nID <> 2 And $nNotifyCode = 0 Then ; Prüft auf IDCANCEL - 2
    ; Ownerdrawn Buttons senden keine Nachricht wenn ENTER gedrückt wird
    ; Also, IDOK - 1 tritt auf, prüfe nun das Control mit dem aktuellen Fokus
    If $nID = 1 Then
    Local $hFocus = DllCall("user32.dll", "hwnd", "GetFocus")
    Local $nCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hFocus[0])
    PostButtonClick($hWnd, $nCtrlID[0])
    EndIf
    Switch $nID
    Case $MenuItem1 ;Close
    Exit

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

    Case $TreeView1

    Case $buttonitemGA
    $value = InputBox("Gruppe Anlegen", "Bitte geben Sie den Namen der Gruppe an.", "", " M20")
    $value2 = InputBox("Bildnummer", "Bitte geben Sie Icon nummer an. Oder einfach OK", "52", " M2")
    _GUICtrlTreeView_BeginUpdate($TreeView1)
    $counterGruppe = $counterGruppe + 1
    ;$TreeView1_GA = _GUICtrlTreeView_AddChild($TreeView1, 0, StringFormat($value, $counterGruppe))
    $TreeView1_GA = GUICtrlCreateTreeViewItem($value, GUICtrlRead($TreeView1))

    _GUICtrlTreeView_EndUpdate($TreeView1)
    ;Prozedur um INI zu schreiben
    ;...
    ;~ Ordnerstrucktur:
    ;~ [Bookmarks_1]
    ;~ SubRep=ME
    ;~ ImgNum=41
    ;MsgBox(4160, "Information", _GUICtrlTreeView_GetTree($TreeView1) & "" & $value )
    ;SubRep=ME\Prismakonzentrator\TCP
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Bookmarks_"&$counterGruppe, "SubRep", _GUICtrlTreeView_GetTree($TreeView1) & "" & $value )
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Bookmarks_"&$counterGruppe, "ImgNum", $value2 )
    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)

    Case $buttonitemIA
    GUISetState(@SW_SHOW, $Form22)

    Case $Button21

    $combotext = GUICtrlRead($Combo21)
    $inputtext = GUICtrlRead($Input21)
    $combotext2 = GUICtrlRead($Combo22)
    $inputtext2 = GUICtrlRead($Input22)
    $value22 = InputBox("Bildnummer", "Bitte geben Sie Icon nummer an. Oder einfach OK", "103", " M3")
    ;~ [Verbindungsname] ([Loginname]) [Protokoll]=
    _GUICtrlTreeView_BeginUpdate($TreeView1)
    $counterItem = $counterItem + 1
    ;$TreeView1_GA = _GUICtrlTreeView_AddChild($TreeView1, 0, StringFormat($combotext & $inputtext & " ("&$inputtext2&")"& " ["&$combotext2&"]", $counterGruppe))
    if $inputtext2 = "" Then
    $TreeView1_IA = GUICtrlCreateTreeViewItem($combotext & $inputtext & " ["&$combotext2&"]", GUICtrlRead($TreeView1))
    $merkeinhalt = $combotext & $inputtext & " ["&$combotext2&"]"
    else
    $TreeView1_IA = GUICtrlCreateTreeViewItem($combotext & $inputtext & " ("&$inputtext2&")"& " ["&$combotext2&"]", GUICtrlRead($TreeView1))
    $merkeinhalt = $combotext & $inputtext & " ("&$inputtext2&")"& " ["&$combotext2&"]"
    EndIf
    _GUICtrlTreeView_EndUpdate($TreeView1)


    ;Prozedur um INI zu schreiben
    ;...
    ;~ Sessions Typs:
    ;~ Bash [Local]= #112#10%0%C:\%Commandline1%Commandline2%Commandline3%__DIEZE__%! Basch%@%$%__POURCENT__%&%?%<%>%__PIPE__%*%+%~%?MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "Bash" Then
    ;$counterGruppe Counter in Array + Prüfung?
    Iniwrite(@Scriptdir & "\MobaXterm.ini", "Bookmarks_"&$counterGruppe, $merkeinhalt, "#"&$value22&"#10%0%"&$combotext & $inputtext&"%#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0" )
    EndIf
    ;~ Host (User) [RDP]= #91#4%Host%3389%User%0%-1%-1%-1%-1%0%0%-1%%%22%%-1%0#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "RDP" Then

    EndIf
    ;~ Hostname (Username) [SFTP]= #140#7%Hostname%22%Username%-1%-1%#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "SFTP" Then

    EndIf
    ;~ Hostname [VNC]= #128#5%Hostname%5900%-1%0%%22%#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "VNC" Then

    EndIf
    ;~ Hostname aktiv (Username) [FTP]= #130#6%Hostname%21%Username%0%#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "FTP aktiv" Then

    EndIf
    ;~ Hostname passiv (Username) [FTP]= #130#6%Hostname%21%Username%-1%#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "FDP Passiv" Then

    EndIf
    ;~ Ordner [Url]= #84#9%C:\Hans Busch#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "Ordner->Explorer" Then

    EndIf
    ;~ ping [Local] (1)= #112#10%1%C:\%ping -a avsh#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "CMD" Then

    EndIf
    ;~ ssh_1 [SSH]= #109#0%ssh_1%22%login%%-1%-1%%%22%%0%0#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "SSH" Then

    EndIf
    ;~ SSO Konfig.docx [Url]= #84#9%\\sstr120f.edc.corpintra.net\BUSCHH$\data\My Documents\SSO Konfig.docx#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "Dokument" Then

    EndIf
    ;~ telnet_1 (Username) [Telnet]= #98#1%telnet_1%23%Username%Extra options#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "Telnet" Then

    EndIf
    ;~ http://www.google.de [Url]= #84#9%http://www.google.de#MobaFont%10%0%0%0%0%236,236,236%0,0,0%180,180,192%0%-1%0%%xterm#0
    If $combotext2 = "URL" Then

    EndIf

    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)
    GUISetState(@SW_HIDE, $Form22)


    Case $buttonitemIP ;, $MenuItem1
    $error = 0
    $filetoreadselect = FileOpenDialog("Computerliste öffnen", @scriptdir & "", "Textdatei (*.txt)|All (*.*)")
    $filetoread = FileOpen($filetoreadselect, 0)
    ConsoleWrite ( " Open List....$filetoread"& $filetoread&@CRLF)
    If $filetoread = -1 Then
    MsgBox($MB_SYSTEMMODAL, "", "Unable to open file.")
    $error = 1
    EndIf

    If $error = 0 Then
    $lineComplete = ""
    ; Read in lines of text until the EOF is reached
    While 1
    Local $line = FileReadLine($filetoread)
    If @error = -1 Then ExitLoop
    $lineComplete = $lineComplete & "|" & $line
    Wend
    EndIf
    FileClose($filetoread)
    GUICtrlSetData($Combo21, $lineComplete )
    ConsoleWrite ("Fertig"& @CRLF &".................................."& @CRLF)
    EndSwitch

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

    Return 0 ; Wird nur zurückgegeben, wenn Button gedrückt wurde
    EndIf
    ; Führt die Standard 'Autoit3 internal message commands' aus.
    ; Man kann die Zeile auch komplett weglassen.
    ; !!! Jedoch nur 'Return' (ohne irgendeinen Wert) führt in Zukunft nicht
    ; Die Standard 'Autoit3 internal message commands' aus !!!
    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_COMMAND

    [/autoit]