4
4
#AutoIt3Wrapper_UseX64= y
5
5
#AutoIt3Wrapper_Change2CUI= y
6
6
#AutoIt3Wrapper_Res_Description= SimpleBackup
7
- #AutoIt3Wrapper_Res_Fileversion= 1.0.0.212
7
+ #AutoIt3Wrapper_Res_Fileversion= 1.0.0.215
8
8
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement= y
9
9
#AutoIt3Wrapper_Res_ProductVersion= 1
10
10
#AutoIt3Wrapper_Res_LegalCopyright= SimpleBackup
@@ -56,6 +56,7 @@ Global $RequiredSettings = "Setup_Password|Backup_Path|Backup_Prune|RESTIC_REPOS
56
56
Global $SettingsTemplate = $RequiredSettings & " |AWS_ACCESS_KEY_ID|AWS_SECRET_ACCESS_KEY|RESTIC_READ_CONCURRENCY=4|RESTIC_PACK_SIZE=32|" & $SMTPSettings
57
57
Global $ConfigFile = StringTrimRight (@ScriptName , 4 ) & " .dat"
58
58
Global $ConfigFileFullPath = @ScriptDir & " \" & $ConfigFile
59
+ Global $ActiveProfile = " Default"
59
60
60
61
; $RunSTDIO will determine how we execute restic, if this is not done properly we will miss console output or log output
61
62
; This value changes depending on program contexts to give us the most aplicable output
@@ -87,6 +88,7 @@ For $i = 1 To $CmdLine[0]
87
88
; The profile parameter and the following parameter are used to adjust the
88
89
$i = $i + 1
89
90
$ConfigFileFullPath = StringTrimRight ($ConfigFileFullPath , 4 ) & " ." & $CmdLine [$i ] & " .dat"
91
+ $ActiveProfile = $CmdLine [$i ]
90
92
_ConsoleWrite(" Config file is now " & StringTrimLeft ($ConfigFileFullPath , StringInStr ($ConfigFileFullPath , " \" , 0 , - 1 )))
91
93
92
94
Case Else
@@ -211,7 +213,7 @@ While 1
211
213
212
214
; Setup tools menu
213
215
$g_hTools = _GUICtrlMenu_CreateMenu()
214
- _GUICtrlMenu_InsertMenuItem($g_hTools , - 1 , " Create/Reset Scheduled Task" , $ScheduledTaskMenuItem )
216
+ _GUICtrlMenu_InsertMenuItem($g_hTools , - 1 , " Create/Reset Scheduled Task (Profile: " & $ActiveProfile & " ) " , $ScheduledTaskMenuItem )
215
217
_GUICtrlMenu_InsertMenuItem($g_hTools , - 1 , " Open Restic Browser" , $BrowserMenuItem )
216
218
_GUICtrlMenu_InsertMenuItem($g_hTools , - 1 , " Add Missing Configuration Options From Template" , $TemplateMenuItem )
217
219
@@ -313,6 +315,9 @@ While 1
313
315
314
316
_ConsoleWrite(" $ConfigFileFullPath=" & $ConfigFileFullPath , 3 )
315
317
318
+ $ActiveProfile = StringTrimRight (StringTrimLeft ($ConfigFileFullPath , StringInStr ($ConfigFileFullPath , " \" , 0 , - 1 ) + StringLen ($Title ) + 1 ), 4 )
319
+ _ConsoleWrite(" $ActiveProfile=" & $ActiveProfile , 3 )
320
+
316
321
; Delete the GUI and restart
317
322
GUIDelete ($SettingsForm )
318
323
ContinueLoop 2
@@ -329,7 +334,7 @@ While 1
329
334
$EnvPath = EnvGet (" Path" )
330
335
If Not StringInStr ($EnvPath , $TempDir ) Then
331
336
EnvSet (" Path" , $TempDir & " ;" & $EnvPath )
332
- _ConsoleWrite(" EnvSet: " & @error )
337
+ _ConsoleWrite(" EnvSet: " & @error , 3 )
333
338
EndIf
334
339
335
340
; Verify the hash of the restic-browser.exe
@@ -344,13 +349,22 @@ While 1
344
349
$ResticBrowserPid = Run ($ResticBrowserFullPath )
345
350
346
351
Case $ScheduledTaskMenuItem
347
- $Run = " SCHTASKS /CREATE /SC DAILY /TN " & $Title & " /TR "" '" & @ScriptFullPath & " ' backup"" /ST 22:00 /RL Highest /NP /F /RU System"
352
+ If $ActiveProfile <> " Default" Then
353
+ $ProfileSwitch = " profile " & $ActiveProfile
354
+ $TaskName = " ." & $ActiveProfile
355
+ Else
356
+ $ProfileSwitch = " "
357
+ $TaskName = " "
358
+ EndIf
359
+
360
+ $Run = " SCHTASKS /CREATE /SC DAILY /TN " & $Title & $TaskName & " /TR "" '" & @ScriptFullPath & " ' backup" & $ProfileSwitch & " "" /ST 22:00 /RL Highest /NP /F /RU System"
348
361
_ConsoleWrite($Run )
349
362
$Return = _RunWait($Run , @ScriptDir , @SW_SHOW , $STDERR_MERGED , True )
350
363
If StringInStr ($Return , " SUCCESS: " ) Then
351
364
MsgBox (0 , $TitleVersion , " Scheduled task created. Please review and test the task." )
352
365
Else
353
366
MsgBox ($MB_ICONERROR , $TitleVersion , " Error creating scheduled task." )
367
+ If @Compiled Then MsgBox ($MB_ICONERROR , $TitleVersion , " Are you running without admin?" )
354
368
EndIf
355
369
356
370
0 commit comments