1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Dswayne

Beiträge von Dswayne

  • Doppelter Eintrag im ListView

    • Dswayne
    • 17. Dezember 2014 um 15:35

    Hallo, ich erhalte seit der rekursiven Suche immer einen doppelten Pfadeintrag im ListView..
    Ich sehe den Wald vor lauter Bäumen nicht mehr.

    Seht ihr meinen Fehler?

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=U:\Azubi - Entwicklungen\Suche - Kolling\shell32_135.ico
    #AutoIt3Wrapper_Res_Description=Suche für den Aktenplan
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_SaveSource=y
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #cs ----------------------------------------------------------------------------

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

    Script Function:
    #author: Björn Alles
    Programm zur Ordnersuche

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

    #ce ----------------------------------------------------------------------------

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

    ; Includes

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

    #include <File.au3>
    #include <Date.au3>
    #include <Misc.au3>
    #include <Array.au3>
    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <ButtonConstants.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <RecFileListToArray.au3>

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

    ; Variablendeklaration:

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

    $version = "1.0"
    $name = "Suchsoftware"
    $quellpfad = @ScriptDir
    $Debug_LV = False
    Local $aFileList[1]
    Local $hListView
    Local $typ

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

    ; Hotkeys definieren

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

    HotKeySet("{ENTER}", "Suchen")
    HotKeySet("^{End}","Ende")

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

    ; TrayIcon anzeigen

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

    Opt("TrayIconHide", 0)
    Opt("TrayMenuMode", 1)
    TraySetIcon("Shell32.dll", 23)
    TraySetToolTip($name & " ist AKTIV / Strg+Ende zum Beenden")

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

    ;------- Programmstart --------

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

    ;Erstellung der Start-GUI

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

    $start = GUICreate("Auf der Spur...", 1200, 279, 128, 160)
    GUISetIcon("C:\Windows\System32\shell32.dll", -172)
    GUISetBkColor(0xA6CAF0)
    $slabel_1 = GUICtrlCreateLabel("Quelle:",18 ,40, 104, 20)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $slabel_2 = GUICtrlCreateLabel("Suchbegriff:", 18, 110, 104, 20)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $sinput_1 = GUICtrlCreateInput($quellpfad, 18, 69, 215, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    $sinput_2 = GUICtrlCreateInput("", 18, 139, 215, 21)
    $sbutton_1 = GUICtrlCreateButton("Neu", 246, 51, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "C:\Windows\System32\shell32.dll", -46)
    $sbutton_3 = GUICtrlCreateButton("", 246, 121, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "C:\Windows\System32\shell32.dll", -23, 0)
    $hListView = GUICtrlCreateListView("", 320, 0, 800, 273)
    $Datei = GUICtrlCreateRadio("Datei", 128, 210, 65, 17)
    $Ordner = GUICtrlCreateRadio("Ordner", 40, 210, 65, 17)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    GUICtrlSetState($ordner,$GUI_CHECKED)
    GUISetState(@SW_SHOW)

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

    While 1
    $msg = GUIGetMsg()

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

    Select

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

    Case $msg = $GUI_EVENT_CLOSE ;Programm beenden
    Exit

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

    Case $msg = $sbutton_1 ;Quellpfad über Navigationsfenster wählen

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

    $quellpfad2 = FileSelectFolder("Bitte den Ordner angeben in dem die Dateien gesucht werden sollen:", "", "2", $quellpfad)
    If @error Then
    GUICtrlSetData($sinput_1, $quellpfad )
    Else
    GUICtrlSetData($sinput_1, $quellpfad2 )
    EndIf

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

    Case $msg = $sbutton_3 ;Weiter zur Suche (StartGUI verlassen)

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

    ;Selektion der Dokumente und Wartebildschirm

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

    _GUICtrlListView_DeleteColumn($hListView,0)

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

    If GUICtrlRead($datei) = $GUI_CHECKED Then
    $typ = "1"
    Elseif guictrlread($ordner) = $gui_checked then
    $typ = "2"
    EndIf

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

    $fpath = GUICtrlRead($sinput_1 & "\")

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

    If GUICtrlRead($sinput_2) = "" Then
    $input_2 = "*"
    Else
    $input_2 = GUICtrlRead($sinput_2)
    EndIf

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

    $search = $input_2
    Local $aFileList[1]

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

    $fFileList = _RecFileListToArray($fpath,"*" & $input_2 & "*",$typ,1,1,2)
    If IsArray($fFileList) Then
    $prev = UBound($aFileList)-1
    ReDim $aFileList[$prev+1+$fFileList[0]]
    For $j = 1 To $fFileList[0]
    $aFileList[$prev+$j] = $fpath & $fFileList[$j]
    Next
    EndIf

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

    ;Übergabe an Ergebnisausgabe oder Errorhandling
    If $aFileList = 0 then
    msgbox(0, $name, "Es wurden keine Dokumente nach Ihren Vorgaben gefunden.")
    Else
    _GUICtrlListView_DeleteAllItems($hListView)

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

    _Result()

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

    EndIf

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

    EndSelect

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

    WEnd

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

    Func _Result()

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

    sleep(100)
    _GUICtrlListView_InsertColumn($hListView, 0, "Dateiname", 1000)

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

    ; Ergänze Listeneinträge

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

    For $n = 1 to UBound($aFileList) -1
    _GUICtrlListView_AddItem($hListView, $aFileList[$n], 0)
    Next

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

    EndFunc

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $iIDFrom
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

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

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $NM_DBLCLK
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    ShellExecute($aFileList[DllStructGetData($tInfo, "Index")+1])
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func Suchen()
    If WinActive("[CLASS:AutoIt v3 GUI]") Then $msg = $sbutton_3
    EndFunc

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

    Func Ende()
    Exit
    EndFunc

    [/autoit]
  • ListView von verschobenen Datein

    • Dswayne
    • 27. November 2014 um 10:40

    Hallo,

    also das folgene Script verschiebt die in einer INI bestimmten Datein an verschiedene Ordner.
    Alle in die $Zielpfad verschobenen Datein möchte ich in einem listview sehen. Mir fehlt jeder Ansatz -.-.
    Vielleicht habt ihr eine Idee?

    Regards

    Dswayne

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <File.au3>
    #include <Array.au3>

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

    ;Variablen deklarieren

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

    $name = "Verschieben"
    $config = "verschieben.ini"

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

    ;~ GUI
    opt("GUIOnEventMode", 1)
    GUICreate("Graphical User Interface",300,200,-1,-1) ;GUI wird erstellt
    GUISetOnEvent($GUI_Event_Close, "_Exit") ;Funktion wird an das "X" gebunden
    GUICtrlCreateButton("Verschieben",200,155,100,40) ;Button wird erstellt
    ;~ GUICtrlCreateButton("Suchen",200,115,100,40);Button wird erstellt
    GUICtrlSetOnEvent(3, "_verschieben") ;Funktion wird mit Button verknüpft
    GUISetState() ;zeigt das Fenster an

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

    While 1 ;While-Schleife damit das Fenster nicht geschlossen wird
    Sleep(100);sleep um die CPU zu entlasten
    WEnd

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

    Func _Exit()
    Exit;Funktion die zum Schließen der GUI benötigt wird
    EndFunc

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

    Func _verschieben()

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

    $i=1

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

    While 1

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

    $quellpfad = iniread($config,$i,"quellpfad","ERROR")
    $zielpfad = iniread($config,$i,"zielpfad","ERROR")
    $datei = iniread($config,$i,"datei","ERROR")
    $benachrichtigung = IniRead($config,$i,"benachrichtigung","ERROR")
    $archiv = IniRead($config,$i,"archiv","ERROR")

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

    If $quellpfad = "ERROR" Or $zielpfad = "ERROR" Or $datei = "ERROR" or $benachrichtigung ="ERROR" or $archiv = "ERROR" Then
    msgbox(4112,$name & $datei,"Die INI-Datei konnte nicht gelesen werden.")
    Exit
    EndIf

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

    If FileExists($quellpfad & "\" & $benachrichtigung) Then
    FileMove($quellpfad & "\" & $benachrichtigung, $archiv, 0)
    MsgBox(0,"PDF GEFUNDEN","PDF-Datei in " & $quellpfad & " gefunden")
    EndIf
    If FileExists($quellpfad & "\" & $datei) Then
    FileCopy($quellpfad & "\" & $datei, $archiv, 0)
    EndIf
    If FileExists($quellpfad & "\" & $datei) Then
    FileMove($quellpfad & "\" & $datei , $zielpfad, 0)
    EndIf

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

    $i = $i+1

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

    If IniReadSection($config,$i) = @error Then
    ExitLoop
    EndIf

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

    WEnd
    EndFunc

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

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™