Kevin
2013-06-18 13:27:50
In case anyone feels like releasing a script during a testing phase and enforcing people to stop using it (which I may plan on before long…), this little snippet can A)Delete the currently running script and/or B)Only run the delete after a certain date.
Thanks to @The Killer for grabbing the date.
Thanks to @The Killer for grabbing the date.
procedure DeleteSelf;
var
fh: integer;
begin
if(ScriptFile='')then
TerminateScript();
fh := Rewritefile(ScriptPath + ScriptFile, true);
WriteFileString(fh, '');
CloseFile(fh);
TerminateScript();
end;
procedure CheckDate;
var
Year, Month, Day: Word;
iYear, iMonth: Integer;
begin
DecodeDate(Date, Year, Month, Day);
iYear := StrToInt(ToStr(Year));
iMonth := StrToInt(ToStr(Month));
if ((iYear > 2013) or (iMonth > 7)) then//This will make the script delete itself at any point August 1st 2013 or later - so long as you call this method.
DeleteSelf;
end;