The Stick soll meine Batch-Datei auf dem USB-Stick ersetzen und diesen bei Bedarf auf die Festplatte nach Eigene Dateien\Eigene Sticks sichern. Es ist ein kleines Script und benötigt ca. 1MB Speicherplatz auf dem USB-Stick. Als Packer kommt das Kommandozeilenprogramm "7zA.exe" (Standalone-Vers. von 7Zip) zur Anwendung. Das Open-Source Programm ist im normalen Download nicht enthalten. 7Za wird hier mitgeliefert und kann dem Download entnommen werden. Bei der Sicherung handelt es sich um ein "SystemBackup". Nach 7 Sicherungen, wird die Erste überschrieben die Festplatte wird nicht so schnell voll und die Daten bleiben aktuell.
Sprache: Deutsch
Betriebssysteme: Windows XP, 2003, Vista, Seven
Version: USBv3800_2010-08-11.zip
Dateigröße: 732 K
TheStick
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=USBsys\compile.ico
#AutoIt3Wrapper_outfile=USBv3.8.exe
#AutoIt3Wrapper_Res_Description=The Stick
#AutoIt3Wrapper_Res_Fileversion=3.8.0.0
#AutoIt3Wrapper_Res_LegalCopyright=© 2010 by Ritzelrocker04
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Res_Field=Compiled by|Ritzelrocker04
#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%
#AutoIt3Wrapper_Res_Field=Original Name|USBv3.8.exe
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#region ### include section ###
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#endregion ### include section ###
#region ### variablen section ###
$src_LW = StringLeft(@ScriptDir, 3); Quelle - The Stick
$dest_LW = StringLeft(@MyDocumentsDir, 2); Ziel - Eigene Dateien
Dim $VOL_Ziel[2], $VOL_Quelle[4]
[/autoit] [autoit][/autoit] [autoit]$title = "The Stick v 3.8"
$build = " Build 2010-08-11 "
$uccess = "USBsound\Success.wav"
#endregion ### variablen section ###
#region ### START The Stick - GUI section ###
$GUI = GUICreate($title, 300, 147, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUICtrlCreatePic("USBskin\Yellow3.jpg", 0, 16, 300, 115, 0)
$bn_Up = GUICtrlCreateButton(" J J J J J J J J ", 0, 0, 300, 16)
GUICtrlSetFont(-1, 10, 400, 0, "Wingdings")
$gb_Ziel = GUICtrlCreateGroup("", 66, 24, 224, 70) ; create group $gb_Ziel
$tb_Ziel = GUICtrlCreateInput("", 78, 41, 200, 17, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetBkColor(-1, 0xFFFBF0)
$ctrlProgBkgrnd1 = GUICtrlCreateLabel("", 78, 67, 200, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetBkColor(-1, 0x00FF00) ; green background
$ctrlProgress1 = GUICtrlCreateLabel("", 78, 67, 1, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetBkColor(-1, 0xFF0000) ; Red progress bar
GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group $gb_Ziel
$bn_Pic = GUICtrlCreateButton("PicBn", 10, 30, 55, 64, $BS_BITMAP)
GUICtrlSetImage(-1, "USBsys\img.bmp")
$bn_Sichern = GUICtrlCreateButton("&Sichern", 133, 101, 75, 22, 0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$bn_Close = GUICtrlCreateButton("&Beenden", 213, 101, 75, 22, 0)
$bn_Autor = GUICtrlCreateButton("RR04", 10, 111, 34, 16)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetTip(-1, "UpdateCheck")
$bn_Down = GUICtrlCreateButton(" J J J J J J J J ", 0, 131, 300, 16)
GUICtrlSetFont(-1, 10, 400, 0, "Wingdings")
#endregion ### START The Stick - GUI section ###
#region ### The Stick - GUI section ###
$GuiStick = GUICreate($title, 300, 115, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUICtrlCreatePic("USBskin\Dialo.jpg", 0, 0, 300, 115, 0)
$tb_src_Total = GUICtrlCreateInput("", 8, 20, 140, 17, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$tb_src_Free = GUICtrlCreateInput("", 152, 20, 140, 17, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$tb_src_Belegt = GUICtrlCreateInput("", 8, 70, 140, 17, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$tb_src_Prozent = GUICtrlCreateInput("", 152, 70, 68, 17, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$ctrlProgBkgrnd2 = GUICtrlCreateLabel("", 8, 45, 284, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetBkColor(-1, 0x00FF00) ; green background
$ctrlProgress2 = GUICtrlCreateLabel("", 8, 45, 1, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
GUICtrlSetBkColor(-1, 0xFF0000) ; Red progress bar
$bn_Return = GUICtrlCreateButton("zurück", 225, 85, 65, 22, 0)
GUISetState(@SW_SHOW, $GUI)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") ;i Funktion zum verschieben der Oberfläche
#endregion ### The Stick - GUI section ###
; starten Func _infoLW()
_infoLW()
While 1
$msg = GUIGetMsg(1)
Switch $msg[1] ; window-handle
Case $GUI
Switch $msg[0] ; event/control-handle
Case $bn_Pic
GUISetState(@SW_HIDE, $GUI)
GUISetState(@SW_SHOW, $GuiStick)
Case $bn_Close
Exit
Case $bn_Autor
ShellExecute("http://ritzelrocker04.bplaced.net/thema1.htm")
Case $bn_Up
_About() ; starten Func _About()
Case $bn_Down
_About() ; starten Func _About()
Case $bn_Sichern
If FileExists(@MyDocumentsDir & '\Eigene USB-Sticks\USB-Stick-0' & @WDAY & '.zip') Then
$ExistsFileWahl = MsgBox(262144 + 48 + 4, " Löschen", "Die Datei " & 'USB-Stick-0' & @WDAY & '.zip besteht bereits. ' & @CRLF & ' Möchten Sie sie ersetzen ? ')
If $ExistsFileWahl = 6 Then
FileDelete(@MyDocumentsDir & '\Eigene USB-Sticks\USB-Stick-0' & @WDAY & '.zip')
EndIf
EndIf
$_Userwahlsich = MsgBox(262144 + 32 + 4, " Sichern", $VOL_Ziel[2] & " MB frei " & @CRLF & $VOL_Quelle[4] & " MB ca. nötig " & @CRLF & "Die Daten werden in komprimierter Form abgespeichert." & @CRLF & "Dass kann, je nach Datenmenge des USB-Sticks, einige Minuten dauern." & @CRLF & "Bitte warten Sie die Erfolgsmeldungen ab !" & @CRLF & @CRLF & "Möchten Sie fortfahren ? ")
If $_Userwahlsich = 7 Then
MsgBox(262144 + 48, " Sichern", " ...es wurden keine Daten gesichert ! ")
Exit
EndIf
RunWait('USBsys\7za.exe a -tzip "' & @MyDocumentsDir & '\Eigene USB-Sticks\USB-Stick-0"' & @WDAY & '".zip" "' & $src_LW, @MyDocumentsDir, @SW_HIDE)
_infoLW() ; starten Func _infoLW()
_Log_Write() ; starten Func _Log_Write()
;SoundSetWaveVolume(50) ; optional (50)Lautstärke in %
SoundPlay($uccess, 1) ; 1 = Skript wartet, bis der Sound abgespielt ist.
MsgBox(262144 + 64, " Sicherung fertig", "Sicherung vom " & @CRLF & @CRLF & @MDAY & "-" & @MON & "-" & @YEAR & " um " & @HOUR & ":" & @MIN & " Uhr " & @CRLF & @CRLF & "ist abgeschlossen ! ")
Exit
EndSwitch
Case $GuiStick
Switch $msg[0]
Case $bn_Return
GUISetState(@SW_SHOW, $GUI)
GUISetState(@SW_HIDE, $GuiStick)
Case $GUI_EVENT_CLOSE
GUISetState(@SW_SHOW, $GUI)
GUISetState(@SW_HIDE, $GuiStick)
EndSwitch
EndSwitch
WEnd
; die Funktion _infoLW()
Func _infoLW()
; Quelle
$VOL_Quelle = _drive($src_LW)
$iProg2 = ($VOL_Quelle[0] / 100) * 284
GUICtrlSetPos($ctrlProgress2, 8, 45, $iProg2, 15)
GUICtrlSetData($tb_src_Prozent, "Free: " & 100 - $VOL_Quelle[0] & "%")
GUICtrlSetData($tb_src_Total, "Total: " & $VOL_Quelle[3] & " MB")
GUICtrlSetData($tb_src_Free, "Free: " & $VOL_Quelle[2] & " MB")
GUICtrlSetData($tb_src_Belegt, "Full: " & $VOL_Quelle[4] & " MB")
; Ziel
$VOL_Ziel = _drive($dest_LW)
$iProg1 = ($VOL_Ziel[0] / 100) * 200
GUICtrlSetPos($ctrlProgress1, 78, 67, $iProg1, 15)
GUICtrlSetData($tb_Ziel, "(" & $VOL_Ziel[1] & ")" & " = " & $VOL_Ziel[2] & " MB = " & 100 - $VOL_Ziel[0] & "% free ")
EndFunc ;==>_infoLW
; die Funktion _drive()
Func _drive($LW)
Local $aDrive[5]
$aDrive[1] = $LW
$TOTAL = DriveSpaceTotal($LW)
$FREE = DriveSpaceFree($LW)
$aDrive[2] = _StringAddThousandsSep(StringReplace(Round($FREE, 0), '.', ','), ".", ",")
$aDrive[0] = _StringAddThousandsSep(StringReplace(Round(($TOTAL - $FREE) / ($TOTAL / 100), 0), ".", ","), ".", ",")
$aDrive[3] = _StringAddThousandsSep(StringReplace(Round($TOTAL, 0), '.', ','), ".", ",")
$aDrive[4] = _StringAddThousandsSep(StringReplace(Round($TOTAL - $FREE, 0), '.', ','), ".", ",")
; ^ genauer als $VOL_Quelle[3] - $VOL_Quelle[2]
Return $aDrive
EndFunc ;==>_drive
; die Funktion _Log_Write()
Func _Log_Write()
$logfile = FileOpen("TheStick.log", 2) ;2 = Schreibmodus mit Löschen des vorherigen Inhaltes
If $logfile = -1 Then
MsgBox(262144 + 48, "Error", " Die Datei " & @ScriptDir & "/TheStick.log" & @CRLF & " konnte nicht gefunden werden.", 9)
;Exit
EndIf
FileWriteLine($logfile, @MDAY & "." & @MON & "." & @YEAR & " um " & @HOUR & ":" & @MIN & ":" & @SEC & " Uhr ")
FileClose($logfile)
EndFunc ;==>_Log_Write
; die Funktion _About()
Func _About()
$logfile = FileOpen("TheStick.log", 0) ; 0 = nur Lesemodus (read mode)
If $logfile = -1 Then
MsgBox(262144 + 48, "Error", " Die Datei " & @ScriptDir & "TheStick.log" & @CRLF & " konnte nicht gefunden werden. Diese Datei wird erstmals nach der ersten Sicherung erstellt ! ")
Exit
EndIf
$line = FileReadLine($logfile)
MsgBox(262144 + 64, 'About', $title & $build & @CRLF & '' & @CRLF & 'Copyright: 2010 by Ritzelrocker04 ' & @CRLF & 'Thx an das http://www.Autoit.de - Team ' & @CRLF & '' & @CRLF & 'Die letzte Sicherung war am : ' & @CRLF & $line)
FileClose($logfile)
EndFunc ;==>_About
Func _StringAddThousandsSep($SSTRING, $STHOUSANDS = ",", $SDECIMAL = ".")
Local $SRESULT = ""
Local $ANUMBER = StringRegExp($SSTRING, "(\d+)\D?(\d*)", 1)
If UBound($ANUMBER) = 2 Then
Local $SLEFT = $ANUMBER[0]
While StringLen($SLEFT)
$SRESULT = $STHOUSANDS & StringRight($SLEFT, 3) & $SRESULT
$SLEFT = StringTrimRight($SLEFT, 3)
WEnd
$SRESULT = StringTrimLeft($SRESULT, 1)
If $ANUMBER[1] <> "" Then $SRESULT &= $SDECIMAL & $ANUMBER[1]
EndIf
Return $SRESULT
EndFunc ;ehemals aus AutoIt ==>_StringAddThousandsSep
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Or ($hWnd = $GuiStick) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST
; Ende
Den kompletten Download findet Ihr auf meiner AutoIt-Skriptsammlung!
Viel Spaß mit "The Stick" !
Die aktuelle Version hier: