From 462da5f58d807871ba6d9122a0c7fb7d0edac921 Mon Sep 17 00:00:00 2001 From: John Mclaren Date: Sun, 11 Aug 2024 18:44:06 -0400 Subject: [PATCH] add advanced menu option to copy program to program files --- SimpleBackup.au3 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SimpleBackup.au3 b/SimpleBackup.au3 index 3420f5d..fe44992 100644 --- a/SimpleBackup.au3 +++ b/SimpleBackup.au3 @@ -200,7 +200,7 @@ While 1 ; Setup a custom menu Global $MenuMsg = 0 If Not IsDeclared("ExitMenuItem") Then Global Enum $ExitMenuItem = 1000, $ScheduledTaskMenuItem, $FixConsoleMenuItem, $BrowserMenuItem, _ - $VerboseMenuItem, $TemplateMenuItem, $NewProfileMenuItem, $AboutMenuItem, $WebsiteMenuItem + $VerboseMenuItem, $TemplateMenuItem, $NewProfileMenuItem, $AboutMenuItem, $WebsiteMenuItem, $InstallMenuItem ; Setup file menu $g_hFile = _GUICtrlMenu_CreateMenu() @@ -227,6 +227,7 @@ While 1 ; Setup tools menu $g_hTools = _GUICtrlMenu_CreateMenu() + _GUICtrlMenu_InsertMenuItem($g_hTools, -1, "Copy " & @ScriptName & " To Program Files And Restart Program", $InstallMenuItem) _GUICtrlMenu_InsertMenuItem($g_hTools, -1, "Create/Reset Scheduled Task (Profile: " & _GetProfileName() & ")", $ScheduledTaskMenuItem) _GUICtrlMenu_InsertMenuItem($g_hTools, -1, "Open Restic Browser", $BrowserMenuItem) _GUICtrlMenu_InsertMenuItem($g_hTools, -1, "Add Missing Configuration Options From Template", $TemplateMenuItem) @@ -388,6 +389,15 @@ While 1 _UpdateEnv($aConfig) $ResticBrowserPid = Run($ResticBrowserFullPath) + ; Copy the program to Program Files + Case $InstallMenuItem + If @Compiled Then + $sDestinationFullPath = @ProgramFilesDir & "\" & StringTrimRight(@ScriptName, 4) & "\" & @ScriptName + FileCopy(@ScriptFullPath, $sDestinationFullPath, $FC_CREATEPATH) + ShellExecute($sDestinationFullPath) + Exit + EndIf + ; Create a sceduled task to run the backup Case $ScheduledTaskMenuItem If _GetProfileName() <> "Default" Then