May be it will useful:
In 'D:\Programs\7-Zip\Arc.bat':
7z.exe a %DATE%.7z D:\Finder
Move %DATE%.7z D:\Copy\Finder\
Cd D:\Copy\Finder
Renamer %DATE%.7z
In D:\Copy\Finder I have a Renamer.exe. Source:
Program Renamer;
Uses
Windows, SysUtils;
Var
Name1, Name2,S : String;
I : Integer;
Begin
Name1 := ParamStr(1);
S := Name1;
Name2 := '';
While Pos('\',S)<>0 Do
Begin
Name2 := Name2 + S[1];
Delete(S,1,1);
End;
For I := 1 to Length(S) - 2 Do
Name2 := Name2 + S[I];
Name2 := Name2 + TimeToStr(Time) + S[Length(S)-2] + S[Length(S)-1] + S[Length(S)];
For I := 1 To Length(Name2) Do
If Name2[I] = ':' Then Name2[I] := '.';
RenameFile(Name1, Name2);
end.
And I have Watcher.exe in AutoRun of Windows. Source:
program Watcher;
uses
ShellAPI, {SysUtils,} Windows;
Var
Look : Boolean = FALSE;
Gotcha : Boolean = FALSE;
Hand : Integer;
Begin
While True Do
Begin
(* Search for Lazarus *)
Hand := 0;
Hand := FindWindow('Window','Lazarus IDE v0.9.28.2 beta - Finder.lpi');
Gotcha := (Hand <> 0);
If (Look) And Not(Gotcha) Then
Begin
ShellExecute(0,'Open','D:\Programs\7-Zip\Arc.bat', Nil, Nil, SW_HIDE);
Look := FALSE;
End
Else
If Not(Look) And (Gotcha) Then
Begin
Look := TRUE;
End;
Sleep(10 * 1000);
End;
End.
It make a copy of my project, when I close a Lazarus.