I found the following which displays a marquee-type progress bar but, despite many attempts, have not been able to incorporate it so it starts, runs whilst the restore point is being created then disappears again. I'm sure I'm doing (or not doing) something stupid but just can't work it out. Any help would be gratefully received, either to incorporate the progress bar or a different/better visual indicator.
Progress Bar:
Code: Select all
; https://autohotkey.com/board/topic/12306-infinite-progress-bar/#entry79882
Gui, Add, Progress, vlvl -Smooth 0x8 w350 h18 ; PBS_MARQUEE = 0x8
Gui, Show, , Example
SetTimer, Push, 45
Push:
GuiControl, , lvl, 1
Return
GuiClose:
ExitApp
Code: Select all
; Prompt to 'Run as Admin', i.e. show UAC dialog
if Not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%", , UseErrorLevel ; Requires AutoHotkey v1.0.92.01+
ExitApp
}
; Note: In Win 10 there's a frequency restriction about how often restore points can be created.
; Use the following to remove the restriction.
SetRegView 64 ; Allow registry commands in a 32-bit script to access redirected keys in the 64-bit registry view and vice versa
RegRead, vOS, HKLM\Software\Microsoft\Windows NT\CurrentVersion, ProductName
IfInString, vOS, Windows 10
{
RegWrite, REG_DWORD, HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore, SystemRestorePointCreationFrequency, 0
}
SetRegView default ; Restore normal behaviour for 'Reg' commands
; Ask for the name to be used...
InputBox, vDesc, Restore Point Name, Input a name for your restore point, , 320, 130
objWMIService := ComObjGet("winmgmts:\\.\root\default:Systemrestore")
objService := objWMIservice.CreateRestorePoint( vDesc, 12, 100)
objWMIService ()
objService ()
; Pop message to inform user
MsgBox, 64, Instant Restore Point, A restore point has been created, 2
ExitApp
Code: Select all
; Prompt to 'Run as Admin', i.e. show UAC dialog
If Not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires AutoHotkey v1.0.92.01+
ExitApp
}
; Note: In Win 10 there's a frequency restriction about how often restore points can be created.
; Use the following to remove the restriction.
SetRegView 64 ; Allow registry commands in a 32-bit script to access redirected keys in the 64-bit registry view and vice versa
RegRead, vOS, HKLM\Software\Microsoft\Windows NT\CurrentVersion, ProductName
IfInString, vOS, Windows 10
{
RegWrite, REG_DWORD, HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore, SystemRestorePointCreationFrequency, 0
}
SetRegView default ; Restore normal behaviour for 'Reg' commands
; Ask for the name to be used...
InputBox, vDesc, Create Instant Restore Point, Description?, , 320, 130
if ErrorLevel
{
MsgBox, CANCEL was pressed.
ExitApp
}
else
psScript =
(
Checkpoint-Computer -Description '%vDesc%' -RestorePointType "MODIFY_SETTINGS"
)
; Note the use of single quotes around the 'description' variable.
; This is one of the quirks of wrapping PowerShell cmdlets in AHK
; Use this call if you don't want to see PowerShell output
RunWait PowerShell.exe -Command %psScript% ,, hide
; Use this call if you want to see PowerShell output
;Run powershell.exe -NoExit -Command %psScript%
; Pop message to inform user
MsgBox, 64, Instant Restore Point, A restore point has been created, 2
ExitApp