home *** CD-ROM | disk | FTP | other *** search
- (* TIMER for Deputy Version 1.0 1st August 1992
- Translated from Timer V.8.1 14/1/92
- Set time of execution of another script
- With thanks to Rtrue for the original script *)
-
- SCRIPT Timer;
- VAR Cver:String[4]; (* Version *)
- Schain:String; (* Script to chain to *)
- Gtime:String[8]; (* Time to start *)
- Ntime:String[8]; (* Time now *)
- Rtime:String[8]; (* Time remaining *)
-
- (* First, define a function to calculate elapsed time *)
-
- FUNC Felapsed(Stime:String;Etime:String):String;
- VAR Shour,Smin,Ssec,Ehour,Emin,Esec:Number;
- Selapsed,Tstr:String[8];
- BEGIN
- StrToInt(Slice(Stime,0,2),Shour);
- StrToInt(Slice(Stime,3,2),Smin);
- StrToInt(Slice(Stime,6,2),Ssec);
- StrToInt(Slice(Etime,0,2),Ehour);
- StrToInt(Slice(Etime,3,2),Emin);
- StrToInt(Slice(Etime,6,2),Esec);
- IF Ssec>Esec THEN
- INC(Smin);
- INC(Esec,60);
- END;
- IF Smin>Emin THEN
- INC(Shour);
- INC(Emin,60);
- END;
- IF Shour>Ehour THEN
- INC(Ehour,24);
- END;
- IntToStr(Ehour-Shour+100,Tstr);
- Selapsed:=Slice(Tstr,1,2);
- IntToStr(Emin-Smin+100,Tstr);
- Selapsed:=Selapsed+":"+Slice(Tstr,1,2);
- IntToStr(Esec-Ssec+100,Tstr);
- Selapsed:=Selapsed+":"+Slice(Tstr,1,2);
- RETURN Selapsed;
- END;
-
-
- (* Now here's the start of main script *)
-
- BEGIN
- Cver:="V1.0"; (* Version *)
- ClrScr();
- Write(" "+
- "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\r\n");
- Write(" "+
- "█ TIMER "+Cver+" - Timed script execution █\r\n");
- Write(" "+
- "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█\r\n\n\n");
- Write("Please enter the name of the script to be executed\r\n\n");
- Read(Schain); WrLn;
- Write("Please enter the time it is to be executed as HH:MM:SS\r\n");
- REPEAT
- GoToXY(0,11);
- Write(" ");
- GoToXY(0,11);
- Read(Gtime);
- UNTIL (Length(Gtime)=8) AND (Slice(Gtime,2,1)=":") AND
- (Slice(Gtime,5,1)=":");
- Write("\r\n\n");
- Write(" Time Now Time to Execute Time Remaining\n\r");
- Write(" -------- --------------- --------------\n\r\n");
-
- REPEAT
- Ntime:=Time();
- Rtime:=Felapsed(Ntime,Gtime);
-
- Cursor(FALSE);
- GoToXY(10,16);
- Write(Ntime+" "+Gtime+" "+Rtime+"\r\n\n");
- Cursor(TRUE);
- UNTIL Rtime="00:00:00";
-
- Write("\n\n\r");
- Chain(Schain+".SCR");
- END Timer.
-