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. subzero007

Beiträge von subzero007

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 20:30

    hey,

    ich glaube ich sollte mein problem näher erklären.
    so sieht meine ini aus.
    [Backup]
    Quelle=C:\xxxx
    Ziel=C:\xxx
    [Wochentag]
    tage=0

    Ich habe in der Listview mehrer einträge
    quelle|ziel
    quelle|ziel
    quelle|ziel
    quelle|ziel
    xxxx|xxx

    er speichert leider nur den letzen eintrag in die ini.?

    [autoit]

    Func _iniwrite()
    FileDelete($ini)
    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

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

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    IniWrite('save.ini', 'Backup', 'Quelle', $var1)
    IniWrite('save.ini', 'Backup', 'Ziel', $var2)
    Next
    ; Next
    IniWrite('save.ini', 'Wochentag', 'tage', $checked)
    Msgbox(0,"", $time)
    IniWrite('save.ini', 'Startzeit', 'Uhr', $Time)

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

    EndFunc

    [/autoit]

    Danke Danke
    Gruß
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 18:43

    Hey,

    Suppi .....

    Jetzt nur noch mein letztes Problem das nur der letzte Listview eintrag in der ini landet.
    Eine idee?
    Danke
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 16:13

    Sooo..

    meine

    [autoit]

    Func _iniwrite()
    FileDelete($ini)
    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

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

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    IniWrite('save.ini', 'Backup', 'Quelle', $var1)
    IniWrite('save.ini', 'Backup', 'Ziel', $var2)
    Next
    ; Next
    IniWrite('save.ini', 'Wochentag', 'tage', $checked)
    Msgbox(0,"", $time)
    IniWrite('save.ini', 'Startzeit', 'Uhr', $Time)

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

    EndFunc ;==>_iniwrite

    [/autoit]

    Funktioniert Bloss bei der $time gibt er immer nur 12 aus wo liegt der fehler?
    Und mein Problem noch das nur der letzte eintrag in der Listview eingetragen wird in die ini ist noch da hat jemand noch tipps oder vorschläge??

    Danke SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 14:37

    Hey,

    ini auslesen Wochntag funktioniert nicht so richtig was mache ich falsch ??

    und das er nur den Letzen eintrag aus der listview in die INI einträgt das habe ich auch noch ?? ?(

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    Local $arCheckBox[7]
    Global $ini = 'save.ini'
    Global $path = @ScriptDir & '\lastsave'
    Global $hfile = @ScriptDir & '\lastsave.log'

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Sicherung", 918, 457, 219, 121)
    $Tab1 = GUICtrlCreateTab(16, 24, 873, 417)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Backup")
    $arCheckBox[6] = GUICtrlCreateCheckbox("Montag", 24, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[5] = GUICtrlCreateCheckbox("Dienstag", 88, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[4] = GUICtrlCreateCheckbox("Mittwoch", 152, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[3] = GUICtrlCreateCheckbox("Donnerstag", 224, 361, 73, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[2] = GUICtrlCreateCheckbox("Freitag", 304, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[1] = GUICtrlCreateCheckbox("Samstag", 368, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[0] = GUICtrlCreateCheckbox("Sonntag", 432, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Date1 = GUICtrlCreateDate("2009/09/21 13:19:57", 24, 393, 170, 21)
    $hListView = GUICtrlCreateListView("Quelle|Ziel", 24, 73, 850, 246)
    GUICtrlSendMsg(-1, 0x101E, 0, 50)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $add = GUICtrlCreateButton("+", 24, 321, 75, 25)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $del = GUICtrlCreateButton("-", 104, 321, 75, 25)
    GUICtrlSetFont(-2, 20, 400, 0, "Arial")
    $Task_Plannen = GUICtrlCreateButton("Task_Planen", 408, 385, 75, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quelle = GUICtrlCreateLabel("Quelle", 24, 49, 34, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Sichern = GUICtrlCreateButton("Sichern", 184, 321, 75, 25)
    GUICtrlSetFont(-1, 15, 400, 0, "Arial")
    $TabSheet2 = GUICtrlCreateTabItem("Restore")
    $Input2 = GUICtrlCreateInput("Input1", 31, 81, 353, 22)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Restore_Ordner = GUICtrlCreateLabel("Restore_Ordner", 24, 57, 79, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quellpfadzeigen = GUICtrlCreateButton("Quellpfadzeigen", 392, 129, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $TreeView1 = GUICtrlCreateTreeView(40, 137, 345, 241)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Wiederherstellen = GUICtrlCreateButton("Wiederherstellen", 392, 353, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Button1 = GUICtrlCreateButton("suchen", 392, 81, 43, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Verfuegbare_sicherungen = GUICtrlCreateLabel("Verfuegbare_sicherungen", 48, 113, 126, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Offnen = GUICtrlCreateButton("Offnen", 392, 321, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)

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

    ;if FileExists(@ScriptDir & '\lastsave.log') Then
    ; _format()
    ; EndIf
    If FileExists(@ScriptDir & '\lastsave.log') Then
    $ini = IniRead(@ScriptDir & '\save.ini', "sicherung", "tage", 0)
    For $i = 6 To 0 step - 1
    If BitAND($ini, 2^$i) Then
    GUICtrlSetState($arCheckBox[$i], $GUI_CHECKED)
    EndIf
    Next

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

    EndIf
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $add
    $sfolder = FileSelectFolder("Wählen den zu Sichernden Ordner:", 'c:')

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

    ;if @error Then Return
    $dfolder = FileSelectFolder("Wählen Sie den Ziel Ordner:", 'c:')
    GUICtrlCreateListViewItem($sfolder & '|' & $dfolder, $hListView)
    ;if @error Then Return
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))

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

    Case $del
    _GUICtrlListView_DeleteItemsSelected($hListView)
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))
    Case $Sichern
    _xcopy()
    Case $Task_Plannen
    _iniwrite()

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

    EndSwitch
    WEnd

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

    Func _iniwrite()

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

    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

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

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    IniWrite($ini, 'Backup', 'Quelle', $var1)
    IniWrite($ini, 'Backup', 'Ziel', $var2)
    Next
    ; Next

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

    IniWrite($ini, 'Wochentag', 'tage', $checked)
    EndFunc ;==>_iniwrite

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

    Func _iniread()
    #cs Muster-INI
    [sicherung]
    tage=42
    #ce
    ; 2 + 8 + 32 = Mo/Mi/Fr

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

    ; aus INI lesen
    Local $savedays = IniRead($ini, 'sicherung', 'tage', 0)

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

    ; prüfen ob aktueller Tag für Sicherung vorgesehen ist
    If BitAND($savedays, 2 ^ (@WDAY - 1)) Then
    ; starte Sicherung
    EndIf
    EndFunc ;==>_iniread

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

    Func _GUICtrlListView_Export($hWnd, $exType = 0, $Delim = Default) ; $exType=0 Array / $exType=1 String
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $row = _GUICtrlListView_GetItemCount($hWnd)
    If $exType Then
    If $Delim <> Default Then Local $oldDelim = Opt('GUIDataSeparatorChar', $Delim)
    Local $sOut = ''
    For $i = 0 To $row - 1
    $sOut &= _GUICtrlListView_GetItemTextString($hWnd, $i) & @CRLF
    Next
    If $Delim <> Default Then Opt('GUIDataSeparatorChar', $oldDelim)
    Return $sOut
    EndIf
    Local $col = _GUICtrlListView_GetColumnCount($hWnd)
    Local $aOut[$row][$col]
    If $col = 1 Then
    ReDim $aOut[$row]
    For $i = 0 To UBound($aOut) - 1
    $aOut[$i] = _GUICtrlListView_GetItemText($hWnd, $i)
    Next
    Return $aOut
    EndIf
    For $i = 0 To UBound($aOut) - 1
    For $j = 0 To UBound($aOut, 2) - 1
    $aOut[$i][$j] = _GUICtrlListView_GetItemText($hWnd, $i, $j)
    Next
    Next
    Return $aOut
    EndFunc ;==>_GUICtrlListView_Export

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

    Func _Load() ; Datenbank-Datei laden
    _GUICtrlListView_DeleteAllItems($hListView) ; Das Handle eben noch bestimmen (s. Anfang des Threads)

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

    Local $sItem
    ; $FileOpenDialog = FileOpenDialog("Pc Liste Wählen", @ScriptDir & "\", "Pc Liste (*.txt;*.csv)", 1 + 4)
    Local $hfile = FileOpen(@ScriptDir & '\lastsave.log', 0) ; Datei zum lesen öffnen
    If $hfile <> -1 Then ; wenn das öffnen erfolgreich war, dann...
    _GUICtrlListView_BeginUpdate($hListView) ; Listview sperren
    While True ; Endlosschleife
    $sItem = FileReadLine($hfile) ; Zeile aus der Datei lesen
    If @error Then ExitLoop ; wenn das Ende der Datei erreicht ist, dann Endlosschleife verlassen
    GUICtrlCreateListViewItem($sItem, $hListView) ; mit den eingelesenen Daten einen neuen Listview-Eintrag erstellen
    WEnd
    _GUICtrlListView_EndUpdate($hListView) ; Listview wieder freigeben
    FileClose($hfile) ; Datei schließen
    EndIf
    EndFunc ;==>_Load

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

    Func CopyWithProgress($srcDir, $destDir)
    If StringRight($srcDir, 1) = "\" Then $srcDir = StringLeft($srcDir, StringLen($srcDir) - 1)
    If StringRight($destDir, 1) <> "\" Then $destDir = $destDir & "\"
    If Not FileExists($destDir) Then DirCreate($destDir)
    $srcSize = DirGetSize($srcDir, 1)
    $1_percent = $srcSize[0] / 100
    ;Run('XCOPY "'& $srcDir & '" "' & $destDir & '" /D /S /E /V /C /H /R /O /Y')

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

    $lastpath = StringTrimLeft($srcDir, StringInStr($srcDir, "\", "", -1))
    $TSDIS = Run(@ComSpec & " /c " & @SystemDir & '\xcopy ' & $srcDir & ' ' & $destDir & $lastpath & '\ /D /S /E /V /C /H /R /Y', "", @SW_HIDE)
    ProgressOn('Copy ' & $srcDir & ' ' & $destDir & $lastpath, $1_percent & "%", "")
    Do
    $destSize = DirGetSize($destDir & $lastpath, 1)
    ProgressSet(Round($destSize[0] / $1_percent, 2), Round($destSize[0] / (1024 * 1024), 2) & " MB of " & Round($srcSize[0] / (1024 * 1024), 2) & " MB Kopiert" & @CRLF _
    & $destSize[1] & " von " & $srcSize[1] & " Dateien Kopiert." & @CRLF _
    & $destSize[2] & " von " & $srcSize[2] & " Ordner Kopiert.", Round($destSize[0] / $1_percent, 2) & "% - Fertig!")
    Sleep(200)
    Until $destSize[0] >= $srcSize[0]
    ProgressOff()
    EndFunc ;==>CopyWithProgress

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

    Func _xcopy()
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    CopyWithProgress($var1, $var2)

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

    Next

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

    EndFunc ;==>_xcopy

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

    Func _format()

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

    Dim $sFilePath = @ScriptDir & '\lastsave.log'
    Dim $outFile = @ScriptDir & '\lastsave.log'
    Dim $aArray
    _FileReadToArray($sFilePath, $aArray) ; datei in Array lesen

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

    For $i = 1 To $aArray[0] ; zeilenweise durchgehen

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

    $aArray[$i] = StringReplace($aArray[$i], ',', '|') ; der String wird ersetzt durch den String mit der Eingabe
    Next

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

    If FileExists($outFile) Then FileDelete($outFile) ; falls Ausgabedatei bereits vorhanden - löschen
    _FileWriteFromArray($outFile, $aArray, 1) ; vom Array in Ausgabedatei schreiben

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

    EndFunc ;==>_format

    [/autoit]


    Eine frage noch nebenbei wie lese ich am elegantesten die ini um daraus Listview einträge zu erzeugen ?
    Also: Quelle|Ziel


    So sieht meine ini aus:

    [Backup]
    Quelle=C:\xxxx
    Ziel=C:\xxx
    [Wochentag]
    tage=0

    ich habe immer den wert Tage=0??

    Hier mein Aktuelles Script:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    Local $arCheckBox[7]
    Global $ini = 'save.ini'
    Global $path = @ScriptDir & '\lastsave'
    Global $hfile = @ScriptDir & '\lastsave.log'

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Sicherung", 918, 457, 219, 121)
    $Tab1 = GUICtrlCreateTab(16, 24, 873, 417)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Backup")
    $arCheckBox[6] = GUICtrlCreateCheckbox("Montag", 24, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[5] = GUICtrlCreateCheckbox("Dienstag", 88, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[4] = GUICtrlCreateCheckbox("Mittwoch", 152, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[3] = GUICtrlCreateCheckbox("Donnerstag", 224, 361, 73, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[2] = GUICtrlCreateCheckbox("Freitag", 304, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[1] = GUICtrlCreateCheckbox("Samstag", 368, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[0] = GUICtrlCreateCheckbox("Sonntag", 432, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Time = GUICtrlCreateDate('15:00:00', 24, 393, 70, 21, $DTS_TIMEFORMAT)
    ;GUICtrlCreateDate('00:00:00', 10, 10, 100, 30, $DTS_TIMEFORMAT)

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

    $hListView = GUICtrlCreateListView("Quelle|Ziel", 24, 73, 850, 246)
    GUICtrlSendMsg(-1, 0x101E, 0, 50)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $add = GUICtrlCreateButton("+", 24, 321, 75, 25)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $del = GUICtrlCreateButton("-", 104, 321, 75, 25)
    GUICtrlSetFont(-2, 20, 400, 0, "Arial")
    $Task_Plannen = GUICtrlCreateButton("Task_Planen", 408, 385, 75, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quelle = GUICtrlCreateLabel("Quelle", 24, 49, 34, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Sichern = GUICtrlCreateButton("Sichern", 184, 321, 75, 25)
    GUICtrlSetFont(-1, 15, 400, 0, "Arial")
    $TabSheet2 = GUICtrlCreateTabItem("Restore")
    $Input2 = GUICtrlCreateInput("Input1", 31, 81, 353, 22)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Restore_Ordner = GUICtrlCreateLabel("Restore_Ordner", 24, 57, 79, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quellpfadzeigen = GUICtrlCreateButton("Quellpfadzeigen", 392, 129, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $TreeView1 = GUICtrlCreateTreeView(40, 137, 345, 241)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Wiederherstellen = GUICtrlCreateButton("Wiederherstellen", 392, 353, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Button1 = GUICtrlCreateButton("suchen", 392, 81, 43, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Verfuegbare_sicherungen = GUICtrlCreateLabel("Verfuegbare_sicherungen", 48, 113, 126, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Offnen = GUICtrlCreateButton("Offnen", 392, 321, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)

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

    ;if FileExists(@ScriptDir & '\lastsave.log') Then
    ; _format()
    ; EndIf
    If FileExists(@ScriptDir & '\save.ini') Then
    $ini = IniRead(@ScriptDir & '\save.ini', "Wochentag", "tage", 0)
    For $i = 6 To 0 Step -1
    If BitAND($ini, 2 ^ $i) Then
    GUICtrlSetState($arCheckBox[$i], $GUI_CHECKED)
    EndIf
    Next

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

    EndIf
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

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

    Exit
    Case $add
    $sfolder = FileSelectFolder("Wählen den zu Sichernden Ordner:", 'c:')

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

    ;if @error Then Return
    $dfolder = FileSelectFolder("Wählen Sie den Ziel Ordner:", 'c:')
    GUICtrlCreateListViewItem($sfolder & '|' & $dfolder, $hListView)
    ;if @error Then Return
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))

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

    Case $del
    _GUICtrlListView_DeleteItemsSelected($hListView)
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))
    Case $Sichern
    _xcopy()
    Case $Task_Plannen
    _iniwrite()

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

    EndSwitch
    WEnd

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

    Func _iniwrite()

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

    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

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

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    IniWrite($ini, 'Backup', 'Quelle', $var1)
    IniWrite($ini, 'Backup', 'Ziel', $var2)
    Next
    ; Next
    IniWrite($ini, 'Wochentag', 'tage', $checked)

    IniWrite($ini, 'Startzeit', 'Uhr', $Time)

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

    EndFunc ;==>_iniwrite

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

    Func _iniread()
    #cs Muster-INI
    [sicherung]
    tage=42
    #ce
    ; 2 + 8 + 32 = Mo/Mi/Fr

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

    ; aus INI lesen
    Local $savedays = IniRead($ini, 'sicherung', 'tage', 0)

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

    ; prüfen ob aktueller Tag für Sicherung vorgesehen ist
    If BitAND($savedays, 2 ^ (@WDAY - 1)) Then
    ; starte Sicherung
    EndIf
    EndFunc ;==>_iniread

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

    Func _GUICtrlListView_Export($hWnd, $exType = 0, $Delim = Default) ; $exType=0 Array / $exType=1 String
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $row = _GUICtrlListView_GetItemCount($hWnd)
    If $exType Then
    If $Delim <> Default Then Local $oldDelim = Opt('GUIDataSeparatorChar', $Delim)
    Local $sOut = ''
    For $i = 0 To $row - 1
    $sOut &= _GUICtrlListView_GetItemTextString($hWnd, $i) & @CRLF
    Next
    If $Delim <> Default Then Opt('GUIDataSeparatorChar', $oldDelim)
    Return $sOut
    EndIf
    Local $col = _GUICtrlListView_GetColumnCount($hWnd)
    Local $aOut[$row][$col]
    If $col = 1 Then
    ReDim $aOut[$row]
    For $i = 0 To UBound($aOut) - 1
    $aOut[$i] = _GUICtrlListView_GetItemText($hWnd, $i)
    Next
    Return $aOut
    EndIf
    For $i = 0 To UBound($aOut) - 1
    For $j = 0 To UBound($aOut, 2) - 1
    $aOut[$i][$j] = _GUICtrlListView_GetItemText($hWnd, $i, $j)
    Next
    Next
    Return $aOut
    EndFunc ;==>_GUICtrlListView_Export

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

    Func _Load() ; Datenbank-Datei laden
    _GUICtrlListView_DeleteAllItems($hListView) ; Das Handle eben noch bestimmen (s. Anfang des Threads)

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

    Local $sItem
    ; $FileOpenDialog = FileOpenDialog("Pc Liste Wählen", @ScriptDir & "\", "Pc Liste (*.txt;*.csv)", 1 + 4)
    Local $hfile = FileOpen(@ScriptDir & '\lastsave.log', 0) ; Datei zum lesen öffnen
    If $hfile <> -1 Then ; wenn das öffnen erfolgreich war, dann...
    _GUICtrlListView_BeginUpdate($hListView) ; Listview sperren
    While True ; Endlosschleife
    $sItem = FileReadLine($hfile) ; Zeile aus der Datei lesen
    If @error Then ExitLoop ; wenn das Ende der Datei erreicht ist, dann Endlosschleife verlassen
    GUICtrlCreateListViewItem($sItem, $hListView) ; mit den eingelesenen Daten einen neuen Listview-Eintrag erstellen
    WEnd
    _GUICtrlListView_EndUpdate($hListView) ; Listview wieder freigeben
    FileClose($hfile) ; Datei schließen
    EndIf
    EndFunc ;==>_Load

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

    Func CopyWithProgress($srcDir, $destDir)
    If StringRight($srcDir, 1) = "\" Then $srcDir = StringLeft($srcDir, StringLen($srcDir) - 1)
    If StringRight($destDir, 1) <> "\" Then $destDir = $destDir & "\"
    If Not FileExists($destDir) Then DirCreate($destDir)
    $srcSize = DirGetSize($srcDir, 1)
    $1_percent = $srcSize[0] / 100
    ;Run('XCOPY "'& $srcDir & '" "' & $destDir & '" /D /S /E /V /C /H /R /O /Y')

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

    $lastpath = StringTrimLeft($srcDir, StringInStr($srcDir, "\", "", -1))
    $TSDIS = Run(@ComSpec & " /c " & @SystemDir & '\xcopy ' & $srcDir & ' ' & $destDir & $lastpath & '\ /D /S /E /V /C /H /R /Y', "", @SW_HIDE)
    ProgressOn('Copy ' & $srcDir & ' ' & $destDir & $lastpath, $1_percent & "%", "")
    Do
    $destSize = DirGetSize($destDir & $lastpath, 1)
    ProgressSet(Round($destSize[0] / $1_percent, 2), Round($destSize[0] / (1024 * 1024), 2) & " MB of " & Round($srcSize[0] / (1024 * 1024), 2) & " MB Kopiert" & @CRLF _
    & $destSize[1] & " von " & $srcSize[1] & " Dateien Kopiert." & @CRLF _
    & $destSize[2] & " von " & $srcSize[2] & " Ordner Kopiert.", Round($destSize[0] / $1_percent, 2) & "% - Fertig!")
    Sleep(200)
    Until $destSize[0] >= $srcSize[0]
    ProgressOff()
    EndFunc ;==>CopyWithProgress

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

    Func _xcopy()
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    CopyWithProgress($var1, $var2)

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

    Next

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

    EndFunc ;==>_xcopy

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

    Func _format()

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

    Dim $sFilePath = @ScriptDir & '\lastsave.log'
    Dim $outFile = @ScriptDir & '\lastsave.log'
    Dim $aArray
    _FileReadToArray($sFilePath, $aArray) ; datei in Array lesen

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

    For $i = 1 To $aArray[0] ; zeilenweise durchgehen

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

    $aArray[$i] = StringReplace($aArray[$i], ',', '|') ; der String wird ersetzt durch den String mit der Eingabe
    Next

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

    If FileExists($outFile) Then FileDelete($outFile) ; falls Ausgabedatei bereits vorhanden - löschen
    _FileWriteFromArray($outFile, $aArray, 1) ; vom Array in Ausgabedatei schreiben

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

    EndFunc ;==>_format

    [/autoit]


    Und hier steckt der Wurm drin was mache ich falsch ??

    [autoit]

    Func _iniwrite()

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

    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

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

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    IniWrite($ini, 'Backup', 'Quelle', $var1)
    IniWrite($ini, 'Backup', 'Ziel', $var2)
    Next
    ; Next
    IniWrite($ini, 'Wochentag', 'tage', $checked)

    IniWrite($ini, 'Startzeit', 'Uhr', $Time)

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

    EndFunc ;==>_iniwrite

    [/autoit]

    Danke
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 13:26

    Habe eine frage noch zu

    [autoit]


    Func _iniwrite()

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

    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf

    Next
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    ;CopyWithProgress($var1, $var2)
    Next

    IniWrite($ini, 'Backup', 'Quelle', $var1)
    IniWrite($ini, 'Backup', 'Ziel', $var2)
    IniWrite($ini, 'Wochentag', 'tage', $checked)
    EndFunc ;==>_iniwrite

    [/autoit]


    Wenn ich mehrer einträge in meiner Listview habe dann übernimmt er den letzten eintrag was muss ich dabei beachten ??

    Danke
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 13:22

    Dürfte ich es in einer Funktion Sehen ;)
    Vielleicht verstehe ich es dann ;-))

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 13:03

    So..
    das tut weh upps..

    so jetzt geht es ;)

    habe es bloss mit ini read nicht verstanden wie ich den Wochentag bestimme ??

    Wenn ich mittwoch freitag und Sonntag anklicke sieht mein eintrag so aus.

    [sicherung]
    tage=21

    wie kann ich daraus den Wochentag bestimmen ??

    Kann mir das jemand irgendwie verständlich machen ?

    Danke
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 12:55

    Hey,


    do habe ich siehe
    beitrag 10
    zeile 116

    [autoit]

    Case $Task_Plannen
    _iniwrite()

    [/autoit]

    Gruß
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 22. September 2009 um 12:05

    Danke,

    wollte die idee von Bugfix umsetzen aber irgendwie mache ich was falsch ??

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    Local $arCheckBox[7]

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Sicherung", 918, 457, 219, 121)
    $Tab1 = GUICtrlCreateTab(16, 24, 873, 417)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Backup")
    $arCheckBox[6] = GUICtrlCreateCheckbox("Montag", 24, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[5] = GUICtrlCreateCheckbox("Dienstag", 88, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[4] = GUICtrlCreateCheckbox("Mittwoch", 152, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[3] = GUICtrlCreateCheckbox("Donnerstag", 224, 361, 73, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[2] = GUICtrlCreateCheckbox("Freitag", 304, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[1] = GUICtrlCreateCheckbox("Samstag", 368, 361, 57, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $arCheckBox[0] = GUICtrlCreateCheckbox("Sonntag", 432, 361, 65, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Date1 = GUICtrlCreateDate("2009/09/21 13:19:57", 24, 393, 170, 21)
    $hListView = GUICtrlCreateListView("Quelle|Ziel", 24, 73, 850, 246)
    GUICtrlSendMsg(-1, 0x101E, 0, 50)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $add = GUICtrlCreateButton("+", 24, 321, 75, 25)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $del = GUICtrlCreateButton("-", 104, 321, 75, 25)
    GUICtrlSetFont(-2, 20, 400, 0, "Arial")
    $Task_Plannen = GUICtrlCreateButton("Task_Planen", 408, 385, 75, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quelle = GUICtrlCreateLabel("Quelle", 24, 49, 34, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Sichern = GUICtrlCreateButton("Sichern", 184, 321, 75, 25)
    GUICtrlSetFont(-1, 15, 400, 0, "Arial")
    $TabSheet2 = GUICtrlCreateTabItem("Restore")
    $Input2 = GUICtrlCreateInput("Input1", 31, 81, 353, 22)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Restore_Ordner = GUICtrlCreateLabel("Restore_Ordner", 24, 57, 79, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Quellpfadzeigen = GUICtrlCreateButton("Quellpfadzeigen", 392, 129, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $TreeView1 = GUICtrlCreateTreeView(40, 137, 345, 241)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Wiederherstellen = GUICtrlCreateButton("Wiederherstellen", 392, 353, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Button1 = GUICtrlCreateButton("suchen", 392, 81, 43, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Verfuegbare_sicherungen = GUICtrlCreateLabel("Verfuegbare_sicherungen", 48, 113, 126, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Offnen = GUICtrlCreateButton("Offnen", 392, 321, 83, 25)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    Global $ini = 'save.ini'
    Global $path = @ScriptDir & '\lastsave'
    Global $hfile = @ScriptDir & '\lastsave.log'

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd

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

    ;if FileExists(@ScriptDir & '\lastsave.log') Then
    ; _format()
    ; EndIf
    If FileExists(@ScriptDir & '\lastsave.log') Then
    _format()
    _Load()

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

    EndIf
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $add
    $sfolder = FileSelectFolder("Wählen den zu Sichernden Ordner:", 'c:')

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

    ;if @error Then Return
    $dfolder = FileSelectFolder("Wählen Sie den Ziel Ordner:", 'c:')
    GUICtrlCreateListViewItem($sfolder & '|' & $dfolder, $hListView)
    ;if @error Then Return
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))

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

    Case $del
    _GUICtrlListView_DeleteItemsSelected($hListView)
    $hWnd = $hListView
    If FileExists($path & ".log") Then FileDelete($path & ".log")
    FileWrite($path & ".log", _GUICtrlListView_Export($hWnd, 1, ','))
    Case $Sichern
    _xcopy()
    Case $Task_Plannen
    _iniwrite()

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

    EndSwitch
    WEnd

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

    Func _iniwrite()

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

    Local $checked = 0
    For $i = 0 To 6
    If BitAND(GUICtrlRead($arCheckBox[$i]), $GUI_CHECKED) Then
    $checked = BitOR($checked, 2 ^ $i)
    EndIf
    Next
    ; in INI schreiben
    IniWrite($ini, 'sicherung', 'tage', $checked)

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

    EndFunc ;==>_iniwrite

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

    Func _iniread()
    #cs Muster-INI
    [sicherung]
    tage=42
    #ce
    ; 2 + 8 + 32 = Mo/Mi/Fr

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

    ; aus INI lesen
    Local $savedays = IniRead($ini, 'sicherung', 'tage', 0)

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

    ; prüfen ob aktueller Tag für Sicherung vorgesehen ist
    If BitAND($savedays, 2 ^ (@WDAY - 1)) Then
    ; starte Sicherung
    EndIf
    EndFunc ;==>_iniread

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

    Func _GUICtrlListView_Export($hWnd, $exType = 0, $Delim = Default) ; $exType=0 Array / $exType=1 String
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $row = _GUICtrlListView_GetItemCount($hWnd)
    If $exType Then
    If $Delim <> Default Then Local $oldDelim = Opt('GUIDataSeparatorChar', $Delim)
    Local $sOut = ''
    For $i = 0 To $row - 1
    $sOut &= _GUICtrlListView_GetItemTextString($hWnd, $i) & @CRLF
    Next
    If $Delim <> Default Then Opt('GUIDataSeparatorChar', $oldDelim)
    Return $sOut
    EndIf
    Local $col = _GUICtrlListView_GetColumnCount($hWnd)
    Local $aOut[$row][$col]
    If $col = 1 Then
    ReDim $aOut[$row]
    For $i = 0 To UBound($aOut) - 1
    $aOut[$i] = _GUICtrlListView_GetItemText($hWnd, $i)
    Next
    Return $aOut
    EndIf
    For $i = 0 To UBound($aOut) - 1
    For $j = 0 To UBound($aOut, 2) - 1
    $aOut[$i][$j] = _GUICtrlListView_GetItemText($hWnd, $i, $j)
    Next
    Next
    Return $aOut
    EndFunc ;==>_GUICtrlListView_Export

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

    Func _Load() ; Datenbank-Datei laden
    _GUICtrlListView_DeleteAllItems($hListView) ; Das Handle eben noch bestimmen (s. Anfang des Threads)

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

    Local $sItem
    ; $FileOpenDialog = FileOpenDialog("Pc Liste Wählen", @ScriptDir & "\", "Pc Liste (*.txt;*.csv)", 1 + 4)
    Local $hfile = FileOpen(@ScriptDir & '\lastsave.log', 0) ; Datei zum lesen öffnen
    If $hfile <> -1 Then ; wenn das öffnen erfolgreich war, dann...
    _GUICtrlListView_BeginUpdate($hListView) ; Listview sperren
    While True ; Endlosschleife
    $sItem = FileReadLine($hfile) ; Zeile aus der Datei lesen
    If @error Then ExitLoop ; wenn das Ende der Datei erreicht ist, dann Endlosschleife verlassen
    GUICtrlCreateListViewItem($sItem, $hListView) ; mit den eingelesenen Daten einen neuen Listview-Eintrag erstellen
    WEnd
    _GUICtrlListView_EndUpdate($hListView) ; Listview wieder freigeben
    FileClose($hfile) ; Datei schließen
    EndIf
    EndFunc ;==>_Load

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

    Func CopyWithProgress($srcDir, $destDir)
    If StringRight($srcDir, 1) = "\" Then $srcDir = StringLeft($srcDir, StringLen($srcDir) - 1)
    If StringRight($destDir, 1) <> "\" Then $destDir = $destDir & "\"
    If Not FileExists($destDir) Then DirCreate($destDir)
    $srcSize = DirGetSize($srcDir, 1)
    $1_percent = $srcSize[0] / 100
    ;Run('XCOPY "'& $srcDir & '" "' & $destDir & '" /D /S /E /V /C /H /R /O /Y')

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

    $lastpath = StringTrimLeft($srcDir, StringInStr($srcDir, "\", "", -1))
    $TSDIS = Run(@ComSpec & " /c " & @SystemDir & '\xcopy ' & $srcDir & ' ' & $destDir & $lastpath & '\ /D /S /E /V /C /H /R /Y', "", @SW_HIDE)
    ProgressOn('Copy ' & $srcDir & ' ' & $destDir & $lastpath, $1_percent & "%", "")
    Do
    $destSize = DirGetSize($destDir & $lastpath, 1)
    ProgressSet(Round($destSize[0] / $1_percent, 2), Round($destSize[0] / (1024 * 1024), 2) & " MB of " & Round($srcSize[0] / (1024 * 1024), 2) & " MB Kopiert" & @CRLF _
    & $destSize[1] & " von " & $srcSize[1] & " Dateien Kopiert." & @CRLF _
    & $destSize[2] & " von " & $srcSize[2] & " Ordner Kopiert.", Round($destSize[0] / $1_percent, 2) & "% - Fertig!")
    Sleep(200)
    Until $destSize[0] >= $srcSize[0]
    ProgressOff()
    EndFunc ;==>CopyWithProgress

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

    Func _xcopy()
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1;hier zählst du die einträge
    $var1 = _GUICtrlListView_GetItemText($hListView, $i, 0)
    $var2 = _GUICtrlListView_GetItemText($hListView, $i, 1)
    CopyWithProgress($var1, $var2)

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

    Next

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

    EndFunc ;==>_xcopy

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

    Func _format()

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

    Dim $sFilePath = @ScriptDir & '\lastsave.log'
    Dim $outFile = @ScriptDir & '\lastsave.log'
    Dim $aArray
    _FileReadToArray($sFilePath, $aArray) ; datei in Array lesen

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

    For $i = 1 To $aArray[0] ; zeilenweise durchgehen

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

    $aArray[$i] = StringReplace($aArray[$i], ',', '|') ; der String wird ersetzt durch den String mit der Eingabe
    Next

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

    If FileExists($outFile) Then FileDelete($outFile) ; falls Ausgabedatei bereits vorhanden - löschen
    _FileWriteFromArray($outFile, $aArray, 1) ; vom Array in Ausgabedatei schreiben

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

    EndFunc ;==>_format

    [/autoit]

    Ich habe den vorschlag in
    Func _iniwrite() gepackt und wollte es mit dem button Taskplanen starten aber irgendwiee......?


    Vorab danke für die Unterstützung
    Gruß
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 21. September 2009 um 23:39

    Ich habe was gefunden.

    [autoit]

    #include <DateTimeConstants.au3>
    GUICreate('test', 400, 300)
    GUICtrlCreateDate('00:00:00', 10, 10, 100, 30, $DTS_TIMEFORMAT)
    GUICtrlSetFont(-1, 14)
    GUISetState()
    Do
    Until GUIGetMsg() = -3

    [/autoit]

    Wie gebe ich aber den wert aus?

    Danke SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 21. September 2009 um 23:07

    Hey,
    das Script ist schon nicht schlecht ist aber etwas zu hoch für mich kann mir das jemand erklären ganz kurz wenn jemand zeit Hat??
    Oder Alternativ GUICtrlCreateUpdown???
    Gruß
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 21. September 2009 um 22:01

    hey,

    danke erstaml für die vielen Tipps habe noch nicht alles umgestzt aber eine frage habe ich noch,

    wie kann ich den.

    [autoit]

    GUICtrlCreateUpdown

    [/autoit]

    so ausgeben
    00:59 - 23:59

    Wie muss ich das machen das mann dur diese werte wählen kann ?
    Konnte es aus der hilfe nicht entnehmen ...?

    Wie sollte denn die ini ausehen wenn man mehrer tage anklickt als beispiel Montag, Mittwoch, freitag was wäre vorteilhaft?
    Danke
    SubZero

  • Chekbox in ini eintragen und Uhrzeit....

    • subzero007
    • 21. September 2009 um 20:01

    Hallo,
    ich bin an meinem Sicherungtool dran und bastle gerade an der ini datei,
    hat jemand einen vorschläg für mich.
    habe 7 checkboxen
    montag
    dienstag
    mittwoch
    donnerstag
    freitag
    samstag und
    sonntag

    wenn der hacken gesetzt ist will ich es in ine ini schreiben wie mache ich das am besten in einem Format
    was ich auch später weiter bearbeiten kann?

    Wo ich noch ein Problem habe mit auswählen der Uhrzeit ich möchte in einer GUI die Uhrzeit auswählen wie mache ich das am besten ?
    mit der GUICtrlCreateDate geht es nicht so richtig ...
    bin für jeden vorschlag offen ;)

    Gruß
    SubZero

  • Vom Pfad den Letzten Ordner ausgeben

    • subzero007
    • 21. September 2009 um 17:28

    hallo,

    ich brauche hilfe möchte gerne den letzen odner vom Pfad ausgeben

    als beispiel
    c:\test1\test3
    =test3 ausgeben

    c:\test1\test3\test7\test8
    = test8 ausgeben

    c:\ordner\neu\suche7\ordner8
    = ordner8 ausgeben

    Danke
    SubZero

  • Beim Start einmal ausführen

    • subzero007
    • 20. September 2009 um 22:46

    Mhhh..
    also vor der

    [autoit]

    While 1

    [/autoit]

    Richtig ?

    Gruß
    SubZero

  • Beim Start einmal ausführen

    • subzero007
    • 20. September 2009 um 22:43

    Ok,

    ich versuche es nochmal ...
    Wenn ich meine GUI starte will ich eine funktion einmal beim starten der GUI aufrufen..

    Danke
    SubZero

  • Beim Start einmal ausführen

    • subzero007
    • 20. September 2009 um 22:32

    Hallo,

    kurze frage möchte gerne etwas beim Gui start aufrufen nur einmal,
    an welcher stelle und wie muss ich das machen?
    Danke
    SubZero

  • SicherungTool

    • subzero007
    • 18. September 2009 um 20:15

    McPoldy
    Sollte ich es lieber lassen mit Autoit ist Autoit überhaupt dazu in der lage ??

    Gruß
    SubZero

  • SicherungTool

    • subzero007
    • 18. September 2009 um 17:39

    Danke,

    werde bestimmt darauf zu greifen,
    Noch mehr vorschläge?

    ;)

  • SicherungTool

    • subzero007
    • 18. September 2009 um 16:59

    Hallo,
    brauche wieder mal Tipps Hilfe Ratschläge...

    Will ein Sicherungstool bauen ;)
    Wo ich verschiedene Pfade sichern kann und wo ich auch das ziel frei defnieren kann alle sicherungen sollten in einen Ordner gesichert werden
    %Datum%_%time%
    Wo ich direkt sichern kann und Per Task
    Das task Problem wollte ich wie folgt lösen mit 2 Windows diensten
    einer Lokal und einer der in Netzschreibt also mit einem Account das ganze mit srvany.

    Ich wollte das über eine ini lösen.
    in der ini sollte stehen
    Quelle
    Ziel
    tag
    Uhrzeit

    der lokale Dienst prüft alle 30 minuten ob eine bediengung zu trift und netzwerk vorhanden ist,
    dann übergibt er es an den Dienst der ins Netzschreiben darf also ein Dienst läuft permanent und der andere wird nur gestartet und später dann gestoppt.

    Also brauche ich Zwei exe dateien
    eine Für die Gui der die Konfig erstellt und einen für den Dienst...

    Restore Sollte es auch können.

    will einen order angeben können und er und er sagt mir welche sicherungen es gibt.
    Ich will dabei mit loggen woher welche datei oder Ordner stammen weil alle dateien Müssen an den gleichen ort wiederhergestellt werden.
    Also in jeden sicherungs ordner eine datei sicherung.log wo Quelle und Sicherungsziel angeben sind sodas ich wieder weiss wohin das hinkommt.


    Mit listview habe ich schonbmal gearbeitet aber nicht mit TreeView.
    Weiss im Moment garnicht wie ich anfangen soll????

    Für Konstruktieve Ratschläge würde ich sehr dankbar sein.

    Danke
    SubZero


    Hier ein Grober entwurf der GUI da bin ich auch offen für Ratschläge ;)

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    #Region ### START Koda GUI section ### Form=D:\eyup\autiit\sicherung\Form1.kxf
    $Form1 = GUICreate("SiDienst", 633, 447, 218, 120)
    $Tab1 = GUICtrlCreateTab(24, 56, 577, 377)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Backup")
    $Montag = GUICtrlCreateCheckbox("Montag", 424, 136, 97, 17)
    $Dienstag = GUICtrlCreateCheckbox("Dienstag", 424, 160, 97, 17)
    $Mittwoch = GUICtrlCreateCheckbox("Mittwoch", 424, 184, 97, 17)
    $Donnerstag = GUICtrlCreateCheckbox("Donnerstag", 424, 208, 97, 17)
    $Freitag = GUICtrlCreateCheckbox("Freitag", 424, 232, 97, 17)
    $Samstag = GUICtrlCreateCheckbox("Samstag", 424, 256, 97, 17)
    $Sonntag = GUICtrlCreateCheckbox("Sonntag", 424, 280, 97, 17)
    $Date1 = GUICtrlCreateDate("2009/09/18 15:54:5", 424, 104, 170, 21)
    $ListView1 = GUICtrlCreateListView("", 32, 96, 346, 70)
    $add = GUICtrlCreateButton("add", 40, 168, 75, 25, 0)
    $del = GUICtrlCreateButton("del", 120, 168, 75, 25, 0)
    $Task_Plannen = GUICtrlCreateButton("Task_Planen", 424, 312, 75, 25, 0)
    $Input1 = GUICtrlCreateInput("Input1", 32, 224, 321, 21)
    $Ziel = GUICtrlCreateLabel("Ziel", 32, 200, 21, 17)
    $Quelle = GUICtrlCreateLabel("Quelle", 32, 80, 34, 17)
    $Sichern = GUICtrlCreateButton("Sichern", 32, 272, 75, 25, 0)
    $Suchen = GUICtrlCreateButton("Suchen", 352, 224, 51, 25, 0)
    $TabSheet2 = GUICtrlCreateTabItem("Restore")
    GUICtrlSetState(-1,$GUI_SHOW)
    $Input2 = GUICtrlCreateInput("Input1", 39, 112, 353, 21)
    $Restore_Ordner = GUICtrlCreateLabel("Restore_Ordner", 32, 88, 79, 17)
    $Quellpfadzeigen = GUICtrlCreateButton("Quellpfadzeigen", 400, 160, 83, 25, 0)
    $TreeView1 = GUICtrlCreateTreeView(48, 168, 345, 241)
    $Wiederherstellen = GUICtrlCreateButton("Wiederherstellen", 400, 384, 83, 25, 0)
    $Button1 = GUICtrlCreateButton("suchen", 400, 112, 43, 25, 0)
    $Verfuegbare_sicherungen = GUICtrlCreateLabel("Verfuegbare_sicherungen", 56, 144, 126, 17)
    $Offnen = GUICtrlCreateButton("Offnen", 400, 352, 83, 25, 0)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd

    [/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™