Setting Time using ITaskSettings interface

This forum is designated to discuss SiComponents Scheduling Agent.
Post Reply
petrossa
Posts: 23
Joined: Tue Aug 12, 2008 6:38 pm

Setting Time using ITaskSettings interface

Post by petrossa »

Using any method/property that takes a date/time as documented format (The format for this string is PnYnMnDTnHnMn etc) throws an exception.

At first i quessed i did it wrong, but i ran the provided Delphi Demo and tried to set a setting it gave the same exception.

see screenshot www.petrossa.com/error.jpg

Every tasksetting accepting these strings gets weird. I got it to accept PT1M for DeleteExpiredTaskAfter, but then it throws an EndBoundary exception. The task enddate has been set.
petrossa
Posts: 23
Joined: Tue Aug 12, 2008 6:38 pm

Post by petrossa »

is there anyway of knowing if this post is under evaluation?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

yes, we're trying to reproduce this now.
Best regards,
Igor Siticov.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

In C++ Demo project there is code under:

Code: Select all

void __fastcall TMainForm::Runnotepadexeeachdayat09001Click(
      TObject *Sender)
which sets end date:

Code: Select all

  Task->Triggers->Items[0]->EndDate = Date() + 30; // will be executed during 1 month
  Task->Triggers->Items[0]->HasEndDate = true;
Does it raises this error? If not, do you set the EndDate using the same way?
Best regards,
Igor Siticov.
petrossa
Posts: 23
Joined: Tue Aug 12, 2008 6:38 pm

Post by petrossa »

EndDate in itself doesn't really cause any problems.
i use
FTask->Triggers->operator [](MultipleActionsIndex)->EndDate=TEndDate->AsDate();

where TEndDate is a TEdit decendant with a TDateTime as member, it returns a valid TDateTime at all times. And that works ok.

Just when i do:

FTask->TaskDefinition->Settings->Set_RestartInterval("PT10M");
or
FTask->TaskDefinition->Settings->Set_ExecutionTimeLimit("PT1H");
the exception as shown in the screenshot occurs.
I just mentioned enddate because at 1 time it accepted
FTask->TaskDefinition->Settings->Set_RestartInterval("PT1M");
but then threw a fit at enddate.
So the real prob is not enddate but all the functions which use the Formatstring just are not agreeable.

I never compiled the C++demo, i only compiled the DelphiDemo because it had Vista implemented. The screenshot is from the Delphi demo.

Addendum:

FTask->Triggers->operator [](CurAction)->GetStartVistaDateTime();
works perfect,
but
TDateTime Dt=FTask->Triggers->operator [](CurAction)->BeginDate;
throws:

class EConvertError Invalid argument to date decode, as do EndDate, StartTime.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Uhh, I thought you was referring any problem with our code.
You can try to pass fully encoded time string like: "P0DT0H1M".
Best regards,
Igor Siticov.
petrossa
Posts: 23
Joined: Tue Aug 12, 2008 6:38 pm

Post by petrossa »

well, first thing i did before posting was trying:
PT1H
PT2H0M
P0M3D
P0Y0M1DT0H0M

which didnt work. So thats why i compiled YOUR delphidemo, tried to set the expiration limit with using your Properties Interface on an already preexisting task set by the native Windows TaskScheduler interface.

Didnt change a letter to the code. That gave me exactly the same error, as shown in the screenshot www.petrossa.com/error.jpg which shows your demo as you can see.
Post Reply