View Full Version : Is there a way to get a script to start at a specific time?
XcanadamanX
11-22-2006, 03:00 AM
ok i want my script to start at like lets say 11 pm. i thought i could do something like:
begin
repeat
wait(60000+random(200))
getsystemtime; (i dont know the actual procedure to get the system time)
until (systemtime= 11:00 pm) then
begin
blah
blah
end;
could someone help with this i tried something like this earlier but it didnt work. any help is greatly appreciated:D
Boreas
11-22-2006, 03:19 AM
{************************************************* ******************************
function TheTime: String;
By: RsN
Description: Returns current time as a string
************************************************** *****************************}
function TheTime: String;
var
Hour, Mins, Sec, MSec: Word;
H, M, S, PM: string;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
PM := 'am';
if (hour > 12) then
begin
hour := hour - 12;
PM := 'pm';
end;
H := inttostr(hour);
M := inttostr(mins);
S := inttostr(sec);
if (hour < 10) then
H := '0' + H;
if (mins < 10) then
M := '0' + M;
if (sec < 10) then
S := '0' + S;
Result := (H + ':' + M + ':' + S + ' ' + PM);
end;
Thats from timing.scar
Run this
program New;
var
Hour, Mins, Sec, MSec: Word;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
writeln(inttostr(hour));
writeln(inttostr(Mins));
writeln(inttostr(sec));
writeln(inttostr(msec));
If Hour>22 then writeln('its past 11pm, time to start script);
end.
XcanadamanX
11-22-2006, 09:53 PM
Thanks!!! ill try that out when i get some time.:D
Jansen
11-25-2006, 07:09 PM
Or you could just add an extremely long wait in the beginning of the script based on what time it is :P His idea is better though :/
XcanadamanX
11-25-2006, 08:28 PM
lol ya im using Boreas' now. it works good
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.