Jump to content

Question About Time in PAL


Recommended Posts

Hi people :D well i have a question about a PAL i am writting, the problem is this in the PAL i put the hours i want to execute and action, for example:

 

PAL.WaitForTime('08:00:00');

Something

 

PAL.WaitForTime('10:00:00');

Something

 

The problem is... i don't know how to make in the PAL to say if i execute at

 

13:00 PM (for example)

 

NOT LOAD de 8 and 10 AM actions (because this is old), just ignore, somebody know how ? :) because sometimes the energy shutdown and when i start the pal script load the old actions (in time)

 

Thank you :thumbup:

 

SOLVED

 

Just i add this

 

var OldTime : DateTime;

OldTime := Now;

 

if (OldTime

begin

 

something

 

end;

 

Thats the idea :)

Link to comment
Share on other sites

No, no the problem is... if at the 13 PM (for example) y START the pal script... the PAL do all the action of past time in this case the 8 AM and the 10 AM

 

I want to know how i can say to the pal script "Don't do the old action" just wait to the another day.

 

SOLVED FIRST POST

Link to comment
Share on other sites

  • 1 month later...

If you have to wait inside an IF section, you can change it to a WHILE section.

 

For example:

WHILE (NOW   BEGIN
    PAL.WaitForTime(T['15:05:00']);
    //Do stuff here
END;

WHILE (NOW>=T['15:05:07']) AND (NOW   BEGIN
    PAL.WaitForTime(T['19:32:00']);
    //Do stuff here
END;

I copy/pasted this from one of my own scripts that I use on a regular basis.

 

The above script (with the times shown in it) is started by the Event Scheduler shortly after 3pm (15:00:00). It then moves into the first section and waits for the set time (15:05:00). At this point I have it set a couple variables and then bypass the next section (not valid time yet), use those variables to complete a task, and then loop. When it comes around again,the first section is invalid, but the second section is now valid, so it will wait for that time.

 

Of course if it gets stopped and restarted after it's run the first section, it will skip that first section.

 

I also have this script set up (not shown here) to stop itself after running the last set time.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...