SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Run a task every hour in vista

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent
View previous topic :: View next topic  
Author Message
famini



Joined: 22 Oct 2007
Posts: 4

PostPosted: Fri May 16, 2008 9:37 am    Post subject: Run a task every hour in vista Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Fri May 16, 2008 11:41 am    Post subject: Reply with quote

Hello,

There is a problem with this under Vista. We will fix this in forthcoming 2.0.1 release.
Back to top
View user's profile Send private message
famini



Joined: 22 Oct 2007
Posts: 4

PostPosted: Fri May 16, 2008 12:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Fri May 16, 2008 3:04 pm    Post subject: Reply with quote

Yes, exactly. These fields shall to be used.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group