Jump to content

Easy BackUp


Recommended Posts

I made the following script:

$van = InputBox( "Easy BackUp", "Van welke map moet een backup gemaakt worden?" )
$naar = InputBox( "Easy BackUp", "In welke map moet de backup worden opgeslagen?" )

If FileExists ( $van ) Then
    If FileExists ( $naar ) Then
        $groot = FileGetSize ( $van )
        DirCopy ( $van, $naar )
        MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
    Else
        #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Warning
        If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(52,"Easy BackUp","De bakup map bestaat niet, aanmaken?")
        Select
        
        Case $iMsgBoxAnswer = 6;Yes         
        Case $iMsgBoxAnswer = 7;No

        EndSelect
        #EndRegion --- CodeWizard generated code End ---
        If $iMsgBoxAnswer = 6 Then
            DirCreate ( $naar )
            $groot = FileGetSize ( $van )
            DirCopy ( $van, $naar )
            MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
        Else
            MsgBox ( 0, "Easy BackUp", "De backup is mislukt!" )
        EndIf
    EndIf
Else
    MsgBox ( 0, "Easy BackUp", "De map waarvan een backup moet worden gemaakt bestaat niet!" )
EndIf

But it doesn't work, please help me.

Go to This site for my best product!

Link to comment
Share on other sites

Hoi,

Zo te zien komt dit omdat je geen "flag" bij het DirCopy commando hebt staan.

Als je DirCopy ( $van, $naar,1 ) gebruikt werkt het wel.

$van = InputBox( "Easy BackUp", "Van welke map moet een backup gemaakt worden?" )
$naar = InputBox( "Easy BackUp", "In welke map moet de backup worden opgeslagen?" )

If FileExists ( $van ) Then
    If FileExists ( $naar ) Then
        $groot = FileGetSize ( $van )
        DirCopy ( $van, $naar,1 )
        MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
    Else
        #Region --- CodeWizard generated code Start ---
   ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Warning
        If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(52,"Easy BackUp","De bakup map bestaat niet, aanmaken?")
       ;Select
        
       ;Case $iMsgBoxAnswer = 6;Yes         
       ;Case $iMsgBoxAnswer = 7;No

       ;EndSelect
        #EndRegion --- CodeWizard generated code End ---
        If $iMsgBoxAnswer = 6 Then
            DirCreate ( $naar )
            $groot = FileGetSize ( $van )
            DirCopy ( $van, $naar )
            MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
        Else
            MsgBox ( 0, "Easy BackUp", "De backup is mislukt!" )
        EndIf
    EndIf
Else
    MsgBox ( 0, "Easy BackUp", "De map waarvan een backup moet worden gemaakt bestaat niet!" )
EndIf

groeten,

Ruud

Link to comment
Share on other sites

Hoi,

Zo te zien komt dit omdat je geen "flag" bij het DirCopy commando hebt staan.

Als je DirCopy ( $van, $naar,1 ) gebruikt werkt het wel.

$van = InputBox( "Easy BackUp", "Van welke map moet een backup gemaakt worden?" )
$naar = InputBox( "Easy BackUp", "In welke map moet de backup worden opgeslagen?" )

If FileExists ( $van ) Then
    If FileExists ( $naar ) Then
        $groot = FileGetSize ( $van )
        DirCopy ( $van, $naar,1 )
        MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
    Else
        #Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Warning
        If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(52,"Easy BackUp","De bakup map bestaat niet, aanmaken?")
    ;Select
        
    ;Case $iMsgBoxAnswer = 6;Yes            
    ;Case $iMsgBoxAnswer = 7;No

    ;EndSelect
        #EndRegion --- CodeWizard generated code End ---
        If $iMsgBoxAnswer = 6 Then
            DirCreate ( $naar )
            $groot = FileGetSize ( $van )
            DirCopy ( $van, $naar )
            MsgBox ( 0, "Easy BackUp", "De backup is voltooid!" )
        Else
            MsgBox ( 0, "Easy BackUp", "De backup is mislukt!" )
        EndIf
    EndIf
Else
    MsgBox ( 0, "Easy BackUp", "De map waarvan een backup moet worden gemaakt bestaat niet!" )
EndIf

groeten,

Ruud

Yeah... what he said! :P

Or possibly:

$van = InputBox("Easy BackUp", "Van welke map moet een backup gemaakt worden?")
$naar = InputBox("Easy BackUp", "In welke map moet de backup worden opgeslagen?")

If FileExists($van) Then
    ; Need to create destination?
    If Not FileExists($naar) Then
        If MsgBox(48 + 4, "Easy BackUp", "De bakup map bestaat niet, aanmaken?") = 6 Then
            DirCreate($naar)
        Else
            MsgBox(0, "Easy BackUp", "De backup is mislukt!")
        EndIf
    EndIf
    ; Perform copy
    If DirCopy($van, $naar, 1) Then
        MsgBox(64, "Easy BackUp", "Successfully backed up from:  " & $van & @CRLF & "To:  " & $naar)
    Else
        MsgBox(16, "Easy BackUp", "Error!  Error backing up from:  " & $van & @CRLF & "To:  " & $naar)
    EndIf
Else
    MsgBox(0, "Easy BackUp", "De map waarvan een backup moet worden gemaakt bestaat niet!")
EndIf

Cheers!

:nuke:

P.S. I would add some error checking for the DirCopy():

Edited above code to include error checking the write operations... translation needed... :">

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

lol @ reactions :P

I'll translate for you ...

Hoi,

Zo te zien komt dit omdat je geen "flag" bij het DirCopy commando hebt staan.

Als je DirCopy ( $van, $naar,1 ) gebruikt werkt het wel.

basicly translates to:

Hi,

Looks like this is because you don't have a "flag" added to the DirCopy command.

If you use DirCopy ( $van, $naar,1 ) it works fine.

Or more litteral:

Hi,

So to see comes this because you no "flag"at the DirCopy command have standing

If you DirCopy ( $van, $naar,1 ) use works it ok. :nuke:

I'll stick to English from now on okay ?

Link to comment
Share on other sites

ach als je genoeg ervan afweet, mag je het best zeggen in het Nederlands.

en je hoeft het echt niet speciaal voor hun te 'translaten'.

I'm pretty certain it's Dutch. A good indication for that is that it usually looks

like it was a drunk German who wrote it. It sounds pretty damn weird too :P

and yes its dutch :nuke:!

@Somebody Someware

en bij $imsgboxanswer heb je spelfoutje. "bakup".

niet dat het uitmaakt, maar ziet er niet zo pro uit.

Edited by aceloc

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...