Can't create event without UserName and Password
Posted: Sun Nov 05, 2006 4:42 am
I'm new, have tried your demo but can't even get demo to work without UserName and Password. My intention was to use this component to set events though my software using this component (advertised feature being I would not need to use timer resources). This is a snipet of your demo... which fails to do anything unless UserName and Password is also supplied. Can you provide modified code that will work from my application... for example: to run another application once a day, on a computer which I know nothing about (which is the normal case). Thanks. Here's your current code from your demo:
procedure TMainForm.Createtasktorunevery10minutesfor24hours1Click(
Sender: TObject);
var
TriggerDetails: TTriggerDetails;
ANow: TDateTime;
S: string;
begin
if not odExecutable.Execute then Exit;
with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := odExecutable.FileName;
Triggers.Add;
Triggers[0].TriggerType := ttDaily;
// Modern Delphi can use this code
// Triggers[0].StartTime := IncHour(Now, 1);
// Delphi 4 compatible code
ANow := Now;
Triggers[0].StartTime := ((ANow * 24) + 1) / 24;
Triggers[0].BeginDate := Date;
Triggers[0].EndDate := Date + 30; // not needed!
Triggers[0].HasEndDate := False;
TriggerDetails.Daily.DaysInterval := 1;
Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
Triggers[0].Duration := 24 * 60; // run for 24 hours
Triggers[0].Interval := 10; // 10 minutes
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
acRefresh.Execute;
end;
procedure TMainForm.Createtasktorunevery10minutesfor24hours1Click(
Sender: TObject);
var
TriggerDetails: TTriggerDetails;
ANow: TDateTime;
S: string;
begin
if not odExecutable.Execute then Exit;
with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := odExecutable.FileName;
Triggers.Add;
Triggers[0].TriggerType := ttDaily;
// Modern Delphi can use this code
// Triggers[0].StartTime := IncHour(Now, 1);
// Delphi 4 compatible code
ANow := Now;
Triggers[0].StartTime := ((ANow * 24) + 1) / 24;
Triggers[0].BeginDate := Date;
Triggers[0].EndDate := Date + 30; // not needed!
Triggers[0].HasEndDate := False;
TriggerDetails.Daily.DaysInterval := 1;
Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
Triggers[0].Duration := 24 * 60; // run for 24 hours
Triggers[0].Interval := 10; // 10 minutes
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
acRefresh.Execute;
end;