AutoHotkey: Auto-Delete BAK-files created by TC's File-Compare-Editor
Jump to navigation
Jump to search
; //////////////////////////////////////////////////////////////////////////// ; // TC_CompareEditor_AutoDelBak.ahk v0.11 ; // (W) StatusQuo 2008 for TC 7.03 ; //-------------------------------------------------------------------------- ; // Auto-deletes *.bak-files created by TC's File-Compare-Editor ; // (after confirmation) ; // ; // Full support is only included for a single instance of TC's compare window - ; // for now, to have the BAK files of multiple instances deleted, you have to ; // close the compare windows in the same order you opened them ; // (first close the one which was opened first). ; //////////////////////////////////////////////////////////////////////////// #SingleInstance, Force Loop { WinWaitActive, ahk_class TFileCompForm ControlGetText, sFNLeft , TEdit2 ControlGetText, sFNRight, TEdit1 sBakLeft := sFNLeft . ".bak" sBakRight := sFNRight . ".bak" Loop ; wait for compare-editor to close { Sleep, 500 ; save CPU time IfWinNotExist, ahk_class TFileCompForm, %sFNLeft%, Break } boFileDeleted := "0" if not ( f_DelBak( sBakLeft ) = "10") f_DelBak( sBakRight ) if not (boFileDeleted = "0") ; no reread if nothing was deleted { ; Sleep, 200 PostMessage, 1075, 540,,, ahk_class TTOTAL_CMD ; cm_RereadSource } } Return f_DelBak( sFNBak ) { global boFileDeleted IfNotExist, %sFNBak% Return MsgBox, 35,, Delete Backup file?`n`n%sFNBak% IfMsgBox, Cancel Return, 10 IfMsgBox, Yes { FileRecycle, %sFNBak% boFileDeleted := "1" } }
Back to AutoHotkey