Jump to content

ASV Backup


Recommended Posts

  • Moderators

@stefanwue batch translates pretty easily to AutoIt. See below for some tips, let's see what you can do on your own :)

Anything where you see set, just create a local variable, like so:

;set ziel =c:\ASV\Sicherung would become
Local $ziel = "c:\ASV\Sicherung"

;set pgdumpProgramm="C:\Program Files\PostgreSQL\9.2\bin\pg_dump.exe" would become
Local $pgdumpProgramm = "C:\Program Files\PostgreSQL\9.2\bin\pg_dump.exe"

For If Exist, look at FileExists in the help file. Your If...Then...Else would look something like this:

If FileExists($ziel) Then
    ;Do this
Else
    ;Do that
EndIf

For all the Echo statements, you can look at ConsoleWrite in the help file. That should more than get you started; if you get stuck, feel free to post your script here and we'll do our best to help ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks

my Script:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GUIEdit.au3>
#include <Process.au3>


$start = "Backup wurde inizialisiert!"
$Jahr = @YEAR
$Monat = @MON
$Tag = @MDAY

$destination="C:\ASV\Sicherung"
$programm="C:\Program Files\PostgreSQL\9.5\bin\pg_dump.exe"
$password="geheim"
$backup="asv_"&$Tag&"_"&$Monat&"_"&$Jahr&"_"&".backup"


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ASV Datenbank sichern (C) Stefan Donaubauer 2016", 611, 545, -1, -1)
$Group1 = GUICtrlCreateGroup("Einstellungen", 8, 8, 593, 97)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("PostgreSQL-pg_dump.exe-Verzeichnis:", 24, 40, 240, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$verzeichnis = GUICtrlCreateInput($programm, 24, 64, 529, 24)
$Button1 = GUICtrlCreateButton("....", 560, 64, 33, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Tab1 = GUICtrlCreateTab(8, 112, 593, 209, BitOR($TCS_BUTTONS,$WS_BORDER))
$TabSheet1 = GUICtrlCreateTabItem("Backup")
$Label2 = GUICtrlCreateLabel("Zielverzeichnis:", 24, 166, 77, 17)
GUICtrlSetBkColor(-1, 0xF0F0F0)
$Label3 = GUICtrlCreateLabel("Backupdateiname:", 24, 198, 93, 17)
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ziel = GUICtrlCreateInput($destination, 144, 163, 409, 21)
$dateiname = GUICtrlCreateInput($backup, 144, 195, 409, 21)
$Label4 = GUICtrlCreateLabel("ASV-Benutzername:", 24, 245, 99, 17)
$Label5 = GUICtrlCreateLabel("ASV-Passwort:", 24, 267, 74, 17)
$asvbenutzer = GUICtrlCreateInput("sys", 143, 240, 161, 21)
$asvpass = GUICtrlCreateInput("", 143, 264, 161, 21)
;$Button3 = GUICtrlCreateButton(".....", 559, 192, 33, 25)
$Button2 = GUICtrlCreateButton(".....", 559, 160, 33, 25)
$TabSheet2 = GUICtrlCreateTabItem("Wiederherstellung")
$Label6 = GUICtrlCreateLabel("Backupdateiname:", 24, 166, 93, 17)
GUICtrlSetBkColor(-1, 0xF0F0F0)
$backupdateiwh = GUICtrlCreateInput("", 144, 163, 409, 21)
$Button4 = GUICtrlCreateButton(".....", 559, 160, 33, 25)
$Label7 = GUICtrlCreateLabel("Postgre-Benutzername:", 24, 245, 115, 17)
$Label8 = GUICtrlCreateLabel("Postgre-Passwort:", 24, 267, 106, 17)
$postgrebenutzer = GUICtrlCreateInput("", 143, 240, 161, 21)
$postgrepass = GUICtrlCreateInput("", 143, 264, 161, 21)
$Label9 = GUICtrlCreateLabel("ASV-Benutzername:", 319, 245, 99, 17)
$Label10 = GUICtrlCreateLabel("ASV-Passwort:", 319, 267, 82, 17)
$asvbenutzerwh = GUICtrlCreateInput("", 423, 240, 161, 21)
$asvpasswh = GUICtrlCreateInput("", 423, 264, 161, 21)
GUICtrlCreateTabItem("")
$listausgabe = GUICtrlCreateList("", 8, 328, 593, 162, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
$btnBackup = GUICtrlCreateButton("Backup", 8, 504, 145, 25)
$btnWiderherstellung = GUICtrlCreateButton("Wiederherstellung", 160, 504, 145, 25)
GUISetState(@SW_SHOW)


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

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

            $Path = FileSelectFolder("Ordner auswählen","",3,@DesktopDir)
            If Not @error Then GUICtrlSetData($verzeichnis,$Path)
        Case $Button2
            $Path = FileSelectFolder("Verzeichnis auswählen","",3,@DesktopDir)
            If Not @error Then GUICtrlSetData($ziel,$Path)

        Case $btnBackup

                if fileexists($destination) then
                    if fileexists($programm) then
                    ShellExecute($programm,"-U asv -Fc "&$destination&"\"&$backup&" asv")
                    endif
                endif
        
        EndSwitch
WEnd

Sorry for my English, the script just does not know what am I doing wrong?

Edited by JLogan3o13
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...