View previous topic :: View next topic |
Author |
Message |
famini
Joined: 22 Oct 2007 Posts: 4
|
Posted: Fri May 16, 2008 9:37 am Post subject: Run a task every hour in vista |
|
|
Hello,
I'd like to schedule a task in Vista but I have some problems.
This task must be executed every hour between 0 AM and 12PM.
For XP I use :
Code: |
Task.Triggers[0].StartDate := Date();
Task.Triggers[0].StartTime := 0;
Task.Triggers[0].Duration := 1440; // 24 hours
Task.Triggers[0].Interval := 60; // every hour
|
But this doesn't work in Vista
How can I do this without change property TaskScheduler1Only to True ?
Thanks, |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Fri May 16, 2008 11:41 am Post subject: |
|
|
Hello,
There is a problem with this under Vista. We will fix this in forthcoming 2.0.1 release. |
|
Back to top |
|
 |
famini
Joined: 22 Oct 2007 Posts: 4
|
Posted: Fri May 16, 2008 12:14 pm Post subject: |
|
|
Thank you for your answer isiticov.
By searching in the component source I have found a solution to my problem by setting the properties "Interval" & "Duration" of the IRepetitionPattern interface.
Here is the code :
Code: |
if TaskScheduler.RunningVistaOrLater then begin
Task.Triggers[0].GetVistaTrigger().Repetition.Interval := 'PT1H'; // 1 hour
Task.Triggers[0].GetVistaTrigger().Repetition.Duration := 'PT24H'; // 24 hours
end;
|
Regards |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Fri May 16, 2008 3:04 pm Post subject: |
|
|
Yes, exactly. These fields shall to be used. |
|
Back to top |
|
 |
|