Code: Select all
; Wait till Window Title found
#Persistent
SetTimer, WaitForText, 100
return
WaitForText:
WinGetActiveTitle, ActiveTitle
TrayTip, active title, %ActiveTitle%, 3
If (ActiveTitle = "Macrium Reflect") ; change this to match the title of the confirmation message box
{
SetTimer, WaitForText, Off
Loop, Files, D:\*.*, F
{
FormatTime, CurrentDateTime,, MM-dd-yyyy
; Rename files in D drive with date as prefix
FileMove, % A_LoopFileFullPath, % "D:\" CurrentDateTime "_" A_LoopFileName
; Copy those files to V drive
FileCopy, % "D:\" CurrentDateTime "_" A_LoopFileName, % "V:\Backup\" CurrentDateTime "_" A_LoopFileName
}
;-----------------------------------------------------------------------------------------------------------
; EVERYTHING BELOW STOPPED WORKING after ActiveTitle = "Macrium Reflect"
; trying to turn on screen after file transfer is completed
SetTimer IdleChk, Off
Sleep, 5000
SendMessage, 0x112, 0xF170, -1, , Program Manager
Sleep, 2000
Send, {1}
Sleep, 2000
; trying to shutdown pc with msgbox
Secs := 10
SetTimer, CountDown, 1000
MsgBox, 4, System Shutdown, Shutdown in %Secs%?, %Secs%
SetTimer, CountDown, Off
IfMsgBox, No
WinClose,Back up.ahk ahk_exe AutoHotkey.exe
IfMsgBox Timeout
Shutdown, 1
IfMsgBox Yes
Shutdown, 1
CountDown:
Secs -= 1
ControlSetText,Static1,Allow Auto Shutdown in %Secs%?,System Shutdown ahk_class #32770
return
}
; 3. Checks every 3 sec, if idle for more than 3 sec, turn off monitor
SetTimer IdleChk,3000
IdleChk:
if (A_TimeIdlePhysical > 3000)
SendMessage 0x112, 0xF170, 2,,Program Manager
RETURN