Sign in to follow this  
Followers 0
Mast3rpyr0

Windows Backup Utility

56 posts in this topic

#1 ·  Posted (edited)

Well I don't know about anyone else but I'm sick of windows backup utilities that ask me to insert a floppy disc into my imaginary floppy drive to create a backup. I could just use a virtual floppy but thats no fun. Introducing the easiest, most reliable, Open source Windows Backup Utility: Mast3rpyr0's Backup Utility!

All you have to do is select the files you want to backup and find somewhere to put 'em and click "Backup" and your done.

Every single line of non-whitespace is commented so even the noobiest noob can edit!

Future Updates:

-Scheduled backups

Known Bugs/Issues:

-None

Updates:

-7-Zip Compression added.(7za.exe FileInstalled() into attached EXE)

-You can now select your own files as well as do a quick backup.

-You can choose weather or not to compress.

-Choice to display what will happen during backup process.

-Choose a default backup directory that backups will always be saved to.(Working towards scheduled backups)

-Added outlook folders to quick.

-Auto Shutdown on completion

-Choose to backup using both Quick and Select Modes.

-Tray and splash image by Gesller

Tested on vista!

Source:

;~> START Mbkup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;              Mast3rpyr0's Backup Utility
;;
;;            Small backup utility that allows
;;            You to to copy your important data
;;            To another partition or folder.
;;
;;            Mbkup v1.0.0 Features:
;;
;;            Easily choose which files and
;;            Folder to copy as well as export
;;            The registry.
;;
;;            Programmer: Mast3rpyr0
;;            Credits: MsCreatoR - _GetSelected() Function
;;
;;            Feel Free to do what you want
;;            With this script but please
;;            Give proper credits.
;;
;;            Updates:
;;            1.0.1_8_16_07-Added Compression and
;;            A few more points in the progress bar.
;;            1.0.2_8_16_07-Allows users to select
;;            Their own files to backup.
;;            1.1.0_8_20_07-Added Choice to compress
;;            Or not and to show what will happen
;;            During the backup. 7za is compiled
;;            With the exe attached in forum.
;;            Gesller's logo added.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Includes
#include <GUIconstants.au3>; Include the GUI constants required.
#include <Process.au3>; Include for _RunDos function.
#Include <File.au3>; Include for _PathSplit function.
#NoTrayIcon; Dont show tray icon.
FileInstall("C:\Include\7za.exe", @ScriptDir & "\7za.exe"); Include 7za into the compiled script.
FileInstall("C:\Include\winbac.bmp", @ScriptDir & "\winbac.bmp"); Include logo image by gesller.
FileInstall("C:\Include\winbac.ico", @ScriptDir & "\winbac.ico"); Include logo image by gesller.
Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown.
TraySetIcon("winbac.ico"); Set the icon as gesllers logo image.

;Initialize Variables
Global $Drive, $Dir, $FName, $Ext, $edtProcedure, $edtProcedurez; Needed for functions throughout.
$defaultDest = IniRead("mbkupConfig.ini", "Settings", "defaultDest", ""); reads the defaultDest key in the config INI and sets $doCompress to its value.
$doCompress = IniRead("mbkupConfig.ini", "Settings", "doCompress", "False"); reads the doCompress key in the config INI and sets $doCompress to its value.
$showProcedure = IniRead("mbkupConfig.ini", "Settings", "showProcedure", "False"); reads the showPocedure key in the config INI and sets $doCompress to its value.
$doShutdown = IniRead("mbkupConfig.ini", "Settings", "doShutdown", "False"); reads the doShutdown key in the config INI and sets $doCompress to its value.

;Build GUI's
If $showProcedure = "True" Then; Show procedure.
$mainWindow = GUICreate("Mast3rpyr0's Backup Utility", 400, 500); Create the Main GUI.
$tab1 = GUICtrlCreateTab(0, 0, 410, 510); Create a new tab system.
;On TabQuick
$tabQuick = GUICtrlCreateTabItem("Quick Backup"); Add Quick Backup Tab.
GUICtrlCreateLabel("Destination:", 10, 43); Print "Destination:" to the GUI.
$inpDest = GUICtrlCreateInput($defaultDest, 75, 40, 250); Create an input for the destination of backups.
$btnBrowse = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
GUICtrlCreateLabel("Select Files to Backup:", 10, 80); Print "Select Files to Backup" to the GUI.
$chkPrgFiles = GUICtrlCreateCheckbox("Program Files", 75, 110); Create a checkbox to select Program Files.
$chkMyDocs = GUICtrlCreateCheckbox("My Documents", 220, 110); Create a checkbox to select My Docs.
$chkShdDocs = GUICtrlCreateCheckbox("Shared Documents", 75, 140); Create a checkbox to select Shared Docs.
$chkDesktop = GUICtrlCreateCheckbox("Desktop", 220, 140); Create a checkbox to select desktop files.
$chkAppData = GUICtrlCreateCheckbox("Application Data", 75, 170); Create a checkbox to select App Data.
$chkReg = GUICtrlCreateCheckbox("Registry", 220, 170); Create a checkbox to select the registry.
$chkOutlook = GUICtrlCreateCheckbox("Outlook/Outlook Express", 75, 200); Create a checkbox to select Outlook/Outlook Express Data.
$edtProcedure = GuiCtrlCreateEdit("", 10, 230, 380, 200, $ES_READONLY); Create a Readonly edit box to show what will happen in the Backup Process.
$btnDoBackup = GUICtrlCreateButton("  Backup  ", 178, 450); Create a button to start the backup process
;On TabSelect
$tabSelect = GUICtrlCreateTabItem("Select Files"); Add Select Backup Tab.
GUICtrlCreateLabel("Destination:", 10, 43); Print "Destination:" to the GUI.
$inpDestz = GUICtrlCreateInput($defaultDest, 75, 40, 250); Create an input for the destination of backups.
$btnBrowsez = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
GUICtrlCreateLabel("Select Files to Backup:", 10, 80); Print "Select Files to Backup" to the GUI.
$inpSrcz = GUICtrlCreateInput("", 75, 110, 250); Create an input for the Source of files to backup.
$btnBrowsey = GUICtrlCreateButton(" Browse ", 330, 108); Create a button to allow a user to browse for files to backup.
$edtProcedurez = GuiCtrlCreateEdit("", 10, 230, 380, 200, $ES_READONLY); Create a Readonly edit box to show what will happen in the Backup Process.
$btnDoBackupz = GUICtrlCreateButton("  Backup  ", 178, 450); Create a button to start the backup process
$tabSettings = GUICtrlCreateTabItem("Settings"); Add Settings Tab.
GUICtrlCreateLabel("Default Destination:", 10, 43); Print "Default Destination:" to the GUI.
$inpDestConfig = GUICtrlCreateInput($defaultDest, 110, 40, 215); Create an input for the destination of backups.
$btnBrowseConfig = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
If $doCompress = "True" Then; If $doCompress is true Then
$doCompressConfig = GUICtrlCreateCheckbox("Compress Backups", 75, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$doCompressConfig = GUICtrlCreateCheckbox("Compress Backups", 75, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
If $showProcedure = "True" Then; If $showProcedure is true Then
$showProcedureConfig = GUICtrlCreateCheckbox("Show Procedure", 220, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$showProcedureConfig = GUICtrlCreateCheckbox("Show Procedure", 220, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
If $doShutdown = "True" Then; If $doShutdown is true Then
$doShutdownConfig = GUICtrlCreateCheckbox("Shutdown After Backup", 75, 120); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$doShutdownConfig = GUICtrlCreateCheckbox("Shutdown After Backup", 75, 120); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
$btnSaveConfig = GUICtrlCreateButton("  Save  ", 180, 450); Create a button to save the config data.
Else; Dont Show procedure.
$mainWindow = GUICreate("Mast3rpyr0's Backup Utility", 400, 300); Create the Main GUI.
$tab1 = GUICtrlCreateTab(0, 0, 410, 310); Create a new tab system.
;On TabQuick
$tabQuick = GUICtrlCreateTabItem("Quick Backup"); Add Quick Backup Tab.
GUICtrlCreateLabel("Destination:", 10, 43); Print "Destination:" to the GUI.
$inpDest = GUICtrlCreateInput($defaultDest, 75, 40, 250); Create an input for the destination of backups.
$btnBrowse = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
GUICtrlCreateLabel("Select Files to Backup:", 10, 80); Print "Select Files to Backup" to the GUI.
$chkPrgFiles = GUICtrlCreateCheckbox("Program Files", 75, 110); Create a checkbox to select Program Files.
$chkMyDocs = GUICtrlCreateCheckbox("My Documents", 220, 110); Create a checkbox to select My Docs.
$chkShdDocs = GUICtrlCreateCheckbox("Shared Documents", 75, 140); Create a checkbox to select Shared Docs.
$chkDesktop = GUICtrlCreateCheckbox("Desktop", 220, 140); Create a checkbox to select desktop files.
$chkAppData = GUICtrlCreateCheckbox("Application Data", 75, 170); Create a checkbox to select App Data.
$chkReg = GUICtrlCreateCheckbox("Registry", 220, 170); Create a checkbox to select the registry.
$chkOutlook = GUICtrlCreateCheckbox("Outlook/Outlook Express", 75, 200); Create a checkbox to select Outlook/Outlook Express Data.
$btnDoBackup = GUICtrlCreateButton("  Backup  ", 178, 250); Create a button to start the backup process
;On TabSelect
$tabSelect = GUICtrlCreateTabItem("Select Files"); Add Select Backup Tab.
GUICtrlCreateLabel("Destination:", 10, 43); Print "Destination:" to the GUI.
$inpDestz = GUICtrlCreateInput($defaultDest, 75, 40, 250); Create an input for the destination of backups.
$btnBrowsez = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
GUICtrlCreateLabel("Select Files to Backup:", 10, 80); Print "Select Files to Backup" to the GUI.
$inpSrcz = GUICtrlCreateInput("", 75, 110, 250); Create an input for the Source of files to backup.
$btnBrowsey = GUICtrlCreateButton(" Browse ", 330, 108); Create a button to allow a user to browse for files to backup.
$btnDoBackupz = GUICtrlCreateButton("  Backup  ", 178, 250); Create a button to start the backup process
$tabSettings = GUICtrlCreateTabItem("Settings"); Add Settings Tab.
GUICtrlCreateLabel("Default Destination:", 10, 43); Print "Default Destination:" to the GUI.
$inpDestConfig = GUICtrlCreateInput($defaultDest, 110, 40, 215); Create an input for the destination of backups.
$btnBrowseConfig = GUICtrlCreateButton(" Browse ", 330, 38); Create a button to allow a user to browse for a folder to save backups to.
If $doCompress = "True" Then; If $doCompress is true Then
$doCompressConfig = GUICtrlCreateCheckbox("Compress Backups", 75, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$doCompressConfig = GUICtrlCreateCheckbox("Compress Backups", 75, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
If $showProcedure = "True" Then; If $showProcedure is true Then
$showProcedureConfig = GUICtrlCreateCheckbox("Show Procedure", 220, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$showProcedureConfig = GUICtrlCreateCheckbox("Show Procedure", 220, 90); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
If $doShutdown = "True" Then; If $doShutdown is true Then
$doShutdownConfig = GUICtrlCreateCheckbox("Shutdown After Backup", 75, 120); Create the checkbox.
GUICtrlSetState(-1, $GUI_CHECKED); Start it checked.
Else; If false.
$doShutdownConfig = GUICtrlCreateCheckbox("Shutdown After Backup", 75, 120); Create the checkbox.
GUICtrlSetState(-1, $GUI_UNCHECKED); Start it unchecked.
EndIf; End the If.
$btnSaveConfig = GUICtrlCreateButton("  Save  ", 178, 250); Create a button to save the config data.
EndIf; End the If.
procedureUpdateSelect(); Update the select edit control once.
GUICtrlSetState($inpSrcz, $GUI_DROPACCEPTED)
SplashImageOn("Mast3rpyr0's Backup Utility", "winbac.bmp", 250, 242, -1, -1, 1); Set splash as Gesller's logo.
Sleep(3000); wait 3 seconds.
SplashOff(); turn off splash.
GUISetState(@SW_SHOW, $mainWindow); Show main GUI.

;Loop
While 1; Start program loop.
    $gMsg = GUIGetMsg(); Grab message sent by GUI.
    Switch $gMsg; Use $gMsg as the control for this Switch.
    Case $GUI_EVENT_CLOSE; If a user closes the GUI with the [X].
        Exit; Exit Program.
    Case $btnBrowse; If user clicks Browse button in quick
        $bkDest = FileSelectFolder("Select a folder to save the backup", "", 7); Create Folder Selection window.
        If @error <> 1 Then; If the FileSelectFolder() above was not canceled or if there was no error.
            GUICtrlSetData($inpDest, $bkDest); Set input equal to the destination folder selected.
            GUICtrlSetData($inpDestz, $bkDest); Set input equal to the destination folder selected.
        EndIf; End the If.
    Case $btnBrowsez; If user clicks Browse button in select (Dest)
        $bkDestz = FileSelectFolder("Select a folder to save the backup", "", 7); Create Folder Selection window.
        If @error <> 1 Then; If the FileSelectFolder() above was not canceled or if there was no error.
            GUICtrlSetData($inpDest, $bkDestz); Set dest. input equal to the destination folder selected.
            GUICtrlSetData($inpDestz, $bkDestz); Set dest. input equal to the destination folder selected.
            procedureUpdateSelect(); Change the data in the Procedure edit box in select.
        EndIf; End the If.
    Case $btnBrowsey; If user clicks Browse button in select (Src)
        $bkSrcy = FileOpenDialog("Select Files to Backup", @HomeDrive, "All(*.*)", 5); Create a file open window.
        If @error <> 1 Then; If the FileOpenDialog() above was not canceled or if there was no error.
            GUICtrlSetData($inpSrcz, $bkSrcy); Set input for source equal to the file(s) selected.
            procedureUpdateSelect(); Change the data in the Procedure edit box in select.
        EndIf; End the If.
    Case $btnBrowseConfig; If user clicks Browse button in Config (Dest)
        $bkDestConfig = FileSelectFolder("Select a folder to save the backup", "", 7); Create Folder Selection window.
        If @error <> 1 Then; If the FileSelectFolder() above was not canceled or if there was no error.
            GUICtrlSetData($inpDest, $bkDestConfig); Set dest. input equal to the destination folder selected.
            GUICtrlSetData($inpDestz, $bkDestConfig); Set dest. input equal to the destination folder selected.
            GUICtrlSetData($inpDestConfig, $bkDestConfig); Set defualt dest. input equal to the destination folder selected.
        EndIf; End the If.
    Case $btnDoBackup; If backup button in quick is pressed.
        doBackupQuick(); Start backup quick function.
    Case $btnDoBackupz; If backup button in select is pressed.
        doBackupSelect(); Start backup select function.
    Case $btnSaveConfig; If Save is pressed.
        doSave(); Start the save function.
    Case $chkPrgFiles Or $chkMyDocs Or $chkShdDocs Or $chkDesktop Or $chkAppData Or $chkReg Or $chkOutlook; If a checkbox is activated.
        procedureUpdateQuick(); Change the data in the Procedure edit box in quick.
    EndSwitch; End the Switch.
WEnd; End the While.

;Functions
Func doBackupQuick(); Backup (Quick) Function.
    $bkDest = GUICtrlRead($inpDest); set $bkDest to the data in the $inpDest input.
    If $bkDest = "" Then; If user did not enter a destination folder.
        MsgBox(0, "Error", "Please select a Destination folder"); Output error.
    Else; Else Continue script.
        If $doCompress = "true" Then; If $doCompress=true
    ProgressOn("Backing up System...", "Copying Program Files", "Starting...", -1, -1, 18); Create a Progress bar.
    If GUICtrlRead($chkPrgFiles) = $GUI_CHECKED Then; If $chkPrgFiles is Checked.
        ProgressSet(0, "Compressing...", "Copying Program Files"); Advance the Progress Bar.
        _RunDOS('7za a -y "Program Files.7z" "' & @ProgramFilesDir & '\"'); Compress contents of folder to .7z.
        ProgressSet(8, "Moving File...", "Copying Program Files"); Advance the Progress Bar.
       FileMove("Program Files.7z", $bkDest); Move File to backup destination.
       ProgressSet(14, "Done", "Copying Program Files"); Advance the Progress Bar.
   EndIf; End the If.
    ProgressSet(16.6, "", "Copying My Documents"); Advance the Progress Bar.
    If GUICtrlRead($chkMyDocs) = $GUI_CHECKED Then; If $chkMyDocs is Checked.
        ProgressSet(16.6, "Compressing...", "Copying My Documents"); Advance the Progress Bar.
        _RunDOS('7za a -y "My Documents.7z" "' & @MyDocumentsDir & '\"'); Compress contents of folder to .7z.
        ProgressSet(24, "Moving File...", "Copying My Documents"); Advance the Progress Bar.
        FileMove("My Documents.7z", $bkDest); Move File to backup destination.
        ProgressSet(30, "Done", "Copying My Documents"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(33.2, "", "Copying Shared Documents"); Advance the Progress Bar.
    If GUICtrlRead($chkShdDocs) = $GUI_CHECKED Then; If $chkShdDocs is Checked.
        ProgressSet(33.2, "Compressing...", "Copying Shared Documents"); Advance the Progress Bar.
        _RunDOS('7za a -y "Shared Documents.7z" "' & @DocumentsCommonDir & '\"'); Compress contents of folder to .7z.
        ProgressSet(40, "Moving File...", "Copying Shared Documents"); Advance the Progress Bar.
       FileMove("Shared Documents.7z", $bkDest); Move File to backup destination.
       ProgressSet(48, "Done", "Copying Shared Documents"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(49.8, "", "Copying Desktop Files"); Advance the Progress Bar.
    If GUICtrlRead($chkDesktop) = $GUI_CHECKED Then; If $chkDesktop is Checked.
        ProgressSet(49.8, "Compressing...", "Copying Desktop Files"); Advance the Progress Bar.
        _RunDOS('7za a -y Desktop.7z "' & @DesktopDir & '\"'); Compress contents of folder to .7z.
        ProgressSet(57, "Moving File...", "Copying Desktop Files"); Advance the Progress Bar.
       FileMove("Desktop.7z", $bkDest); Move File to backup destination.
       ProgressSet(65, "Done", "Copying Desktop Files"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(66.4, "", "Copying Application Data"); Advance the Progress Bar.
    If GUICtrlRead($chkAppData) = $GUI_CHECKED Then; If $chkAppData is Checked.
        ProgressSet(66.4, "Compressing...", "Copying Application Data"); Advance the Progress Bar.
        _RunDOS('7za a -y "App Data.7z" "' & @AppDataDir & '\"'); Compress contents of folder to .7z.
        ProgressSet(74, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
        FileMove("App Data.7z", $bkDest); Move File to backup destination.
        ProgressSet(82, "", "Copying Application Data"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(83, "", "Copying Outlook Data"); Advance the Progress Bar.
    If GUICtrlRead($chkOutlook) = $GUI_CHECKED Then; If $chkOutlookData is Checked.
        If Not DirGetSize(@UserProfileDir & "\Local Settings\Application Data\Identities\") = 0 Then; Check if folder exists.
            ProgressSet(83, "Compressing...", "Copying Outlook Data"); Advance the Progress Bar.
            _RunDOS('7za a -y "Outlook Data.7z" "' & @UserProfileDir & '\Local Settings\Application Data\Identities\"'); Compress contents of folder to .7z.
            ProgressSet(89, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
            FileMove("App Data.7z", $bkDest); Move File to backup destination.
            ProgressSet(91, "", "Copying Application Data"); Advance the Progress Bar.
        EndIf; End the If.
        If Not DirGetSize(@UserProfileDir & "\Local Settings\Application Data\Microsoft\Outlook\") = 0 Then; Check if folder exists.
            ProgressSet(83, "Compressing...", "Copying Outlook Data"); Advance the Progress Bar.
            _RunDOS('7za a -y "Outlook Data.7z" "' & @UserProfileDir & '\Local Settings\Application Data\Microsoft\Outlook\"'); Compress contents of folder to .7z.
            ProgressSet(89, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
            FileMove("App Data.7z", $bkDest); Move File to backup destination.
            ProgressSet(91, "", "Copying Application Data"); Advance the Progress Bar.
        EndIf; End the If.
    EndIf; End the If.
    ProgressSet(93, "", "Creating Registry Backup File"); Advance the Progress Bar.
    If GUICtrlRead($chkReg) = $GUI_CHECKED Then; If $chkReg is Checked.
        ProgressSet(93, "Creating File...", "Creating Registry Backup File"); Advance the Progress Bar.
        _RunDOS('regedit.exe /e regBkup.reg'); Create a backup of the registry.
        ProgressSet(95, "Compressing...", "Creating Registry Backup File"); Advance the Progress Bar.
        _RunDOS('7za a -y regBkup.7z regBkup.reg'); Compress contents of folder to .7z.
        ProgressSet(97, "Moving File...", "Creating Registry Backup File"); Advance the Progress Bar.
        FileMove("regBkup.7z", $bkDest); Move File to backup destination.
        ProgressSet(98, "Deleting Old File...", "Creating Registry Backup File"); Advance the Progress Bar.
        FileDelete("regBkup.reg"); Delete regBkup that has been 7zipped and move to backup destination.
        ProgressSet(99, "Done", "Creating Registry Backup File"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(100, "Done", "Backup Complete"); Advance the Progress Bar.
    Sleep(3000); Wait 3 seconds.
    ProgressOff(); Close progress window.
        Else; Else if $doCompress=false
        ProgressOn("Backing up System...", "Copying Program Files", "Starting...", -1, -1, 18); Create a Progress bar.
    If GUICtrlRead($chkPrgFiles) = $GUI_CHECKED Then; If $chkPrgFiles is Checked.
        ProgressSet(8, "Moving File...", "Copying Program Files"); Advance the Progress Bar.
       DirCopy(@ProgramFilesDir, $bkDest & "\Program Files", 1); Move File to backup destination.
       ProgressSet(14, "Done", "Copying Program Files"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(16.6, "", "Copying My Documents"); Advance the Progress Bar.
    If GUICtrlRead($chkMyDocs) = $GUI_CHECKED Then; If $chkMyDocs is Checked.
        ProgressSet(24, "Moving File...", "Copying My Documents"); Advance the Progress Bar.
        DirCopy(@MyDocumentsDir, $bkDest & "\My Documents", 1); Move File to backup destination.
        ProgressSet(30, "Done", "Copying My Documents"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(33.2, "", "Copying Shared Documents"); Advance the Progress Bar.
    If GUICtrlRead($chkShdDocs) = $GUI_CHECKED Then; If $chkShdDocs is Checked.
        ProgressSet(40, "Moving File...", "Copying Shared Documents"); Advance the Progress Bar.
       DirCopy(@DocumentsCommonDir, $bkDest & "\Shared Documents", 1); Move File to backup destination.
       ProgressSet(48, "Done", "Copying Shared Documents"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(49.8, "", "Copying Desktop Files"); Advance the Progress Bar.
    If GUICtrlRead($chkDesktop) = $GUI_CHECKED Then; If $chkDesktop is Checked.
       ProgressSet(57, "Moving File...", "Copying Desktop Files"); Advance the Progress Bar.
       DirCopy(@DesktopDir, $bkDest & "\Desktop", 1); Move File to backup destination.
       ProgressSet(65, "Done", "Copying Desktop Files"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(66.4, "", "Copying Application Data"); Advance the Progress Bar.
    If GUICtrlRead($chkAppData) = $GUI_CHECKED Then; If $chkAppData is Checked.
        ProgressSet(74, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
        DirCopy(@AppDataDir, $bkDest & "\AppData", 1); Move File to backup destination.
        ProgressSet(82, "", "Copying Application Data"); Advance the Progress Bar.
    EndIf; End the If.
    If GUICtrlRead($chkOutlook) = $GUI_CHECKED Then; If $chkOutlookData is Checked.
        If Not DirGetSize(@UserProfileDir & "\Local Settings\Application Data\Identities\") = 0 Then; Check if folder exists.
            ProgressSet(89, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
            DirCopy(@UserProfileDir & "\Local Settings\Application Data\Identities\", $bkDest & "\Outlook"); Move File to backup destination.
            ProgressSet(91, "", "Copying Application Data"); Advance the Progress Bar.
        EndIf; End the If.
        If Not DirGetSize(@UserProfileDir & "\Local Settings\Application Data\Microsoft\Outlook\") = 0 Then; Check if folder exists.
            ProgressSet(89, "Moving File...", "Copying Application Data"); Advance the Progress Bar.
            DirCopy(@UserProfileDir & "\Local Settings\Application Data\Microsoft\Outlook\", $bkDest & "\Outlook"); Move File to backup destination.
            ProgressSet(91, "", "Copying Application Data"); Advance the Progress Bar.
        EndIf; End the If.
    EndIf; End the If.
    ProgressSet(93, "", "Creating Registry Backup File"); Advance the Progress Bar.
    If GUICtrlRead($chkReg) = $GUI_CHECKED Then; If $chkReg is Checked.
        ProgressSet(95, "Creating File...", "Creating Registry Backup File"); Advance the Progress Bar.
        _RunDOS('regedit.exe /e regBkup.reg'); Create a backup of the registry.
        ProgressSet(96, "Moving File...", "Creating Registry Backup File"); Advance the Progress Bar.
        FileMove("regBkup.reg", $bkDest); Move File to backup destination.
        ProgressSet(98, "Done", "Creating Registry Backup File"); Advance the Progress Bar.
    EndIf; End the If.
    ProgressSet(100, "Done", "Backup Complete"); Advance the Progress Bar.
    Sleep(3000); Wait 3 seconds.
    ProgressOff(); Close progress window.
        If $doShutdown = "True" Then; If shutdown is selected in config.
            Shutdown(13); Shutdown Computer.
        EndIf; End The If.
    EndIf; End the If.
EndIf; End The If.
EndFunc; End the Function.

Func doBackupSelect(); Backup (Select) Funciton
    $bkDestz = GUICtrlRead($inpDestz); set $bkDestz to the data in the $inpDestz input.
    $bkSrcz = GUICtrlRead($inpSrcz); set $bkDestz to the data in the $inpDestz input.
    If $bkDestz = "" Or $bkSrcz = "" Then; If user did not enter a destination folder.
        MsgBox(0, "Error", "Please select a Destination/Source folder"); Output error.
    Else; Else Continue script.
        $c = MsgBox(4, "Warning", "This will delete any prviously made Backups If you have not renamed them. Continue?"); Output Overwrite warning
        If $c = 6 Then; If yes was chosen
        $bkSrcz = _GetSelected($bkSrcz); Run MsCreatoR's path parser function.
        $progBar = 100 / Ubound($bkSrcz); increment the progress bar by this much each pass of the loop.
        ProgressOn("Backing up System...", "Copying User Selected Files", "Starting...", -1, -1, 18); Create a Progress bar.
        If $doCompress = "True" Then; If $doCompress is true then
        For $i = 1 To UBound($bkSrcz)-1 Step 1; Loop to backup user selected files.
            FileCopy($bkSrcz[$i], @ScriptDir); Get a copy of the file to backup into the scriptdir.
            FileChangeDir(@ScriptDir); Change our working directory back to @ScriptDir.
            Sleep(1000); Wait 1 second.
            $path = _PathSplit($bkSrcz[$i], $Drive, $Dir, $FName, $Ext); Split the path of $bkSrcz because we moved it to our working directory.
            $path2 = $Fname & $Ext; Set the File name and extension from the split path as $path2
            ProgressSet($progBar * $i, "Compressing... " & $bkSrcz[$i], "Copying User Selected Files"); Advance the Progress Bar
            _RunDOS('7za a -y MbkupBackup.7z "' & $path2 & '"'); Compress selected file(s).
            FileDelete($path2); Delete the copyied file after compressing.
        Next; End the For Loop and continue script.
        FileMove("MbkupBackup.7z", $bkDestz, 1); Move Compressed files to Backup Destination
        Else; If false
        For $i = 1 To UBound($bkSrcz)-1 Step 1; Loop to backup user selected files.
            FileCopy($bkSrcz[$i], $bkDestz & "\Backups\", 9); Get a copy of the file to backup into the scriptdir.
            ProgressSet($progBar * $i, "Copying " & $bkSrcz[$i], "Copying User Selected Files"); Advance the Progress Bar
        Next; End the For Loop and continue script.
        EndIf; End the if.
        ProgressSet(100, "Done", "Backup Complete"); Advance the Progress Bar.
        Sleep(3000); Wait 3 seconds.
        ProgressOff(); Close progress window.
        If $doShutdown = "True" Then; If shutdown is selected in config.
            Shutdown(13); Shutdown Computer.
        EndIf; End The If.
        EndIf; End The If.
    EndIf; End The If.
EndFunc; End the Function.

Func doSave(); Saves config data to Config.ini.
    $inpDestConfig = GUICtrlRead($inpDestConfig); Read Default Dest. Input in Settings tab.
    IniWrite("mbkupConfig.ini", "Settings", "defaultDest", $inpDestConfig); Write Default Dest. Data to INI.
    If GUICtrlRead($doCompressConfig) = $GUI_CHECKED Then; If $doCompressConfig is Checked Then
    IniWrite("mbkupConfig.ini", "Settings", "doCompress", "True"); Write data to INI.
    Else; If not checked.
    IniWrite("mbkupConfig.ini", "Settings", "doCompress", "False"); Write data to INI.
    EndIf; End the If.
    If GUICtrlRead($showProcedureConfig) = $GUI_CHECKED Then; If $showProcedureConfig is Checked Then
    IniWrite("mbkupConfig.ini", "Settings", "showProcedure", "True"); Write data to INI.
    Else; If not checked.
    IniWrite("mbkupConfig.ini", "Settings", "showProcedure", "False"); Write data to INI.
    EndIf; End the If.
    If GUICtrlRead($doShutdownConfig) = $GUI_CHECKED Then; If $doShutdownConfig is Checked Then
    IniWrite("mbkupConfig.ini", "Settings", "doShutdown", "True"); Write data to INI.
    Else; If not checked.
    IniWrite("mbkupConfig.ini", "Settings", "doShutdown", "False"); Write data to INI.
    EndIf; End the If.
    GUISetState(@SW_HIDE, $mainWindow); Hide the window
    Run("Mbkup.exe"); Start program again with new settings.
    Exit; Close this program.
EndFunc; End the function.

Func procedureUpdateQuick(); Function to change the info in the edit control in Quick Mode.
    $bkDest = GUICtrlRead($inpDest); Read Data in $inpDest.
    $procedureText = "-Backup saved to " & $bkDest & @CRLF; Add text to be displayed.
    If $doCompress = "true" Then; If $doCompress is true.
        $procedureText &= "-Backups will be compressed" & @CRLF; Add text to be displayed.
    Else; If False.
        $procedureText &= "-Backups will not be compressed" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If $doShutdown = "true" Then; If $doShutdown is true.
        $procedureText &= "-Computer will shutdown after Backup Process." & @CRLF; Add text to be displayed.
    Else; If False.
        $procedureText &= "-Computer will not shutdown after Backup Process." & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkPrgFiles) = $GUI_CHECKED Then; If $chkPrgFiles is Checked.
        $procedureText &= "-Program Files will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkMyDocs) = $GUI_CHECKED Then; If $chkMyDocs is Checked.
        $procedureText &= "-My Documents will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkShdDocs) = $GUI_CHECKED Then; If $chkShdDocs is Checked.
        $procedureText &= "-Shared Documents will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkDesktop) = $GUI_CHECKED Then; If $chkDesktop is Checked.
        $procedureText &= "-Desktop files will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkAppData) = $GUI_CHECKED Then; If $chkAppData is Checked.
        $procedureText &= "-App Data will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkOutlook) = $GUI_CHECKED Then; If $chkOutlookData is Checked.
        $procedureText &= "-Outlook Data will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    If GUICtrlRead($chkReg) = $GUI_CHECKED Then; If $chkReg is Checked.
        $procedureText &= "-The Registry will be included in the backup" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    GUICtrlSetData($edtProcedure, $procedureText); Change Data in edit control.
EndFunc; End the function.

Func procedureUpdateSelect(); Function to change the info in the edit control in Select Mode.
    $bkDestz = GUICtrlRead($inpDestz); Read Data in $inpDestz.
    $bkSrcz = GUICtrlRead($inpSrcz); Read Data in $inpSrcz.
    $procedureTextz = "-Backup Destination: " & $bkDestz & @CRLF; Add text to be displayed.
    $procedureTextz &= "-Backup Source: " & $bkSrcz & @CRLF; Add text to be displayed.
    If $doCompress = "true" Then; If $doCompress=true.
        $procedureTextz &= "-Backups will be compressed" & @CRLF; Add text to be displayed.
    Else; If False.
        $procedureTextz &= "-Backups will not be compressed" & @CRLF; Add text to be displayed.
    EndIf; End the If.
    GUICtrlSetData($edtProcedurez, $procedureTextz); Change Data in edit control.
EndFunc; End the function.

; Written By MsCreatoR (Sorry I don't know how to comment on this function, Basically it parses the returned path(s) from the $bkSrcz FileOpenDialog()).
Func _GetSelected($String)
    Local $RetArr[1]
    If StringInStr($String, "|") Then
        Local $SplitArr = StringSplit($String, "|"), $InitPath = StringRegExpReplace($SplitArr[1], '([^\\])\\*$', '\1')
        For $i = 2 To UBound($SplitArr)-1
            ReDim $RetArr[UBound($RetArr) + 1]
            $RetArr[UBound($RetArr) - 1] = $InitPath & "\" & $SplitArr[$i]
        Next
        $RetArr[0] = UBound($RetArr) - 1
    Else
        Local $RetArr[2] = [1, $String]
    EndIf
    Return $RetArr
EndFunc
;~> END Mbkup.

Im very excited to hear your comments and suggestions.

EXE Attached.

Mbkup.exe

Edited by Mast3rpyr0

Share this post


Link to post
Share on other sites



nice! :):P:) :)

Share this post


Link to post
Share on other sites

love the comments! keep it up!

Share this post


Link to post
Share on other sites

I don't understand why Microsoft expects people to still use floppies for backups. Nowadays, people use DVD-Rs to back thinks up. Any chance you might work burning into this?

Share this post


Link to post
Share on other sites

What was the Bug?

Share this post


Link to post
Share on other sites

I don't understand why Microsoft expects people to still use floppies for backups. Nowadays, people use DVD-Rs to back thinks up. Any chance you might work burning into this?

Hmm good idea, maybe i will use iso compression. Burning may have to wait for awhile. Maybe it can create a iso then burn it but i dont think it should burn while copying the files if that is possible.

Share this post


Link to post
Share on other sites

Fixed?

Share this post


Link to post
Share on other sites

been a while since I've used it, but you can format a cd for drag drop backup. This could be an easy alternative to burning to backup.

Share this post


Link to post
Share on other sites

very nice.

suggestion: what you could probably implement is maybe an auto backup system. like Every week/month it copies the files at a selected time. maybe save the info to an ini ect ect ect. Maybe you could set it up so that it'll save the monthly and weekly in seperate folders. then maybe you can enable both so that if something gets a virus and it copies the weekly, you still have the monthly. and lets say that you copy the monthly which has a virus, you still have last weeks copies.

i might be jabbering, let me know if u don't understand what i mean lol

Share this post


Link to post
Share on other sites

That sounds interesting, i forgot to put the log file in but its gonna have a log, i was working on compression and i did it backwards so i have to start over on that part. Ive been working on this non stop since like 7PM EST so i think im gonna take a C&C3 break.

Share this post


Link to post
Share on other sites

Very nice. Only thing I can think of would be to make it where you can add your own files or folders to backup and store in said ini.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Updates:

7-Zip Compression is now enabled. Source in first post is updated. Files attached in first post are required.

Coming Soon:

Choose your own files as well as what is previously released.

Edited by Mast3rpyr0

Share this post


Link to post
Share on other sites

Hmm Im on XP, tried the quick backup, pointed destination to c:\temp and it said complete but no backup file in target directory....

Share this post


Link to post
Share on other sites

Excellent. This adds only the one file to backup. Is it possible to setup where you select a file or folder and it shows it is added and then gives a new browse to add another? This would make it much more user friendly...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0