Code, so far.....
C
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>
;
; ==============================================================================
; Projekt : Daten verschieben
; bearbeitet am : 05.05.2019
; ==============================================================================
; Danksagungen :
; Erstellt unter Mithilfe aus dem autoit.de-Forum von :
; @Musashi, @BugFix, @autoiter, @alpines, @Code-Jack, @zeitriss usw.
; ==============================================================================
; Variablendeklaration
;
Global $g_sPath_Source = "F:\TESTUMGEBUNG\Ursprungsdaten"
Global $g_aLV_Folder[0][2]
#GUI Start
$Form1_1 = GUICreate("Daten verschieben (c) Kayes", 615, 438, 250, 284)
$Radio1 = GUICtrlCreateRadio("DATA 1", 16, 48, 70, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", "Explorer", "wstr", 0) ; _WinAPI_SetWindowTheme($hWnd, $sName = Default, $sList = Default)
$Radio2 = GUICtrlCreateRadio("DATA 2", 104, 48, 70, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", "Explorer", "wstr", 0) ; _WinAPI_SetWindowTheme($hWnd, $sName = Default, $sList = Default)
_SetRadioColor()
$projektname = GUICtrlCreateInput("19", 208, 40, 281, 32)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
Global $g_idLV_SelectFolder = GUICtrlCreateListView("Projekt", 20, 100, 575, 280, $LVS_LIST, $LVS_EX_CHECKBOXES)
$aktualisieren = GUICtrlCreateButton("Aktualisieren", 20, 392, 120, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$verschieben = GUICtrlCreateButton("Verschieben", 475, 392, 120, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$umkehren = GUICtrlCreateButton("Auswahl umkehren", 323, 392, 120, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$amarkieren = GUICtrlCreateButton("Alles markieren", 172, 392, 120, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#Ende GUI
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $aktualisieren
aktualisieren()
Case $verschieben
MoveFiles()
Case $radio1
_SetRadioColor()
Case $radio2
_SetRechnerColor()
Case $umkehren
umkehren()
Case $amarkieren
markieren()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func Event_Button_SelectInv(); Invertiert die Auswahl des ListView
Local $iState
GUICtrlSetState($g_idLV_SelectFolder, $GUI_HIDE)
For $i = 0 to UBound($g_aLV_Folder) -1
$iState = GUICtrlRead($g_aLV_Folder[$i][1], 1)
If BitAND($iState, $GUI_CHECKED) Then
GUICtrlSetState($g_aLV_Folder[$i][1], $GUI_UNCHECKED)
Else
GUICtrlSetState($g_aLV_Folder[$i][1], $GUI_CHECKED)
EndIf
Next
GUICtrlSetState($g_idLV_SelectFolder, $GUI_SHOW)
EndFunc
Func Event_Button_Start(); Listet die ausgewählten Projekte auf und ruft CopyProject() auf
If Not CheckFolder() Then Return
GUICtrlSetState($g_idButton_Start, $GUI_DISABLE)
GUICtrlSetData($g_idButton_Start, "Arbeitet")
Local $aFolderList[UBound($g_aLV_Folder)][2]
Local $iCounter = 0
For $i = 0 to UBound($g_aLV_Folder) -1
If BitAND(GUICtrlRead($g_aLV_Folder[$i][1], 1), $GUI_CHECKED) Then
$aFilesList[$iCounter][0] = $g_aLV_Files[$i][0]
$aFilesList[$iCounter][1] = $g_aLV_Files[$i][1]
$iCounter += 1
EndIf
Next
ReDim $aFilesList[$iCounter][2]
CopyProject($aFilesList, $g_sPath_Source, $g_sPath_Dest)
GUICtrlSetState($g_idButton_Start, $GUI_ENABLE)
GUICtrlSetData($g_idButton_Start, "Kopieren")
EndFunc
Func Event_Button_Source(); Auswählen des Quellordners über den Benützer
Local $sNewPath = FileSelectFolder("Bitte den Projekt-Ordner wählen", $g_sPath_Source)
If @error Then Return
$g_sPath_Source = $sNewPath
GUICtrlSetData($g_idInput_Path_Source, $sNewPath)
LoadFilesInListView($g_sPath_Source)
GUICtrlSetState($g_idButton_Save, $GUI_ENABLE)
EndFunc
Func Event_Close()
Exit
EndFunc
Func LoadFilesInListView($sPath); Listet die Projekte aus dem Quellordner auf, wenn sie dem Schema entsprechenden.
For $i = 0 to UBound($g_aLV_Folder) -1
$g_aLV_Files[$i][0] = ""
GUICtrlDelete($g_aLV_Folder[$i][1])
Next
Local $aFiles = _FileListToArray($sPath, "*", $FLTA_FILES, False)
If Not IsArray($aFiles) Then
ReDim $g_aLV_Files[0][2]
Return
EndIf
Local $iCounter = 0
ReDim $g_aLV_Files[ $aFiles[0] ][2]
For $i = 1 to $aFiles[0]
If StringRegExp($aFiles[$i], "\d\d\d\d....") Then
$g_aLV_Files[$iCounter][0] = $aFolder[$i]
$g_aLV_Files[$iCounter][1] = GUICtrlCreateListViewItem($aFiles[$i], $g_idLV_SelectFiles)
$iCounter += 1
EndIf
Next
ReDim $g_aLV_Files[ $iCounter ][2]
EndFunc
Func movefiles()
;Prüfung der Radios und setzen der entsprechende Zielvariablen
If GUICtrlRead($radio1) = $GUI_CHECKED Then $dest = "\DATA1"
If GUICtrlRead($radio2) = $GUI_CHECKED Then $dest = "\DATA2"
Local $source =
Return
EndFunc ;==>movefiles
; Farbe für aktiven Radiobutton setzen :
Func _SetRadioColor()
If GUICtrlRead($radio1) = $GUI_CHECKED Then
GUICtrlSetColor($rradio1, $COLOR_RED)
Else
GUICtrlSetColor($radio1, $COLOR_BLACK)
EndIf
If GUICtrlRead($radio2) = $GUI_CHECKED Then
GUICtrlSetColor($radio2, $COLOR_RED)
Else
GUICtrlSetColor($radio2, $COLOR_BLACK)
EndIf
EndFunc ;==>_SetRadioColor
Alles anzeigen