# backup-lfa2020.au3 -rw-r--r-- 1.3 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; Creates a Lexware faktura+auftrag 2020 backup

#include <Date.au3>

Const $LFA_PATH = "C:\Program Files (x86)\Lexware\faktura + auftrag\2020\Pcfk32.exe"
Const $LFA_TITLE = "Lexware faktura+auftrag <Firma>"
Const $LFA_BACKUP_TITLE = "Datensicherung"

Const $BACKUP_PATH = "C:\Users\Username\Backup\Lexware\LFA2020_automatic"

; Run LFA and wait for it to become active
DEBUG("Start LFA")
Run($LFA_PATH)
WinWaitActive($LFA_TITLE)
Sleep(5000)

; Send the key combination to open the backup dialog and wait for it
DEBUG("Start backup assistant")
Send("!d")
Send("{DOWN 7}")
Send("{RIGHT}")
Send("{ENTER}")
WinWaitActive($LFA_BACKUP_TITLE)

; Step 1
DEBUG("Confirm the start page")
Send("!w")
Sleep(1000)

; Step 2: Configure the backup settings
DEBUG("Enter backup location")
Send($BACKUP_PATH)
DEBUG("Enable checkbox to backup forms")
ControlClick("Datensicherung", "", "[CLASS:Button; INSTANCE:5]")
Send("!w")

; Step 3: Start the backup
DEBUG("Start backup")
Send("!w")

; Wait for the backup to finish
DEBUG("Wait for backup to finish")
WinWaitActive($LFA_BACKUP_TITLE, "Fertig stellen")
SEND("!f")

; Close LFA
DEBUG("Close LFA")
WinWaitActive($LFA_TITLE)
WinClose($LFA_TITLE)

DEBUG("Backup successful")

Func DEBUG($text)
   ConsoleWrite(_Now() & " [DEBUG]: " & $text & @CRLF)
EndFunc