Page 1 of 1

Delay at Logon scheduled task

Posted: Thu Aug 31, 2023 11:26 pm
by simplysup
Hi,

Is it possible to access and programmatically set the "Delay task for" Advance setting in an At Logon task. I note that a number of 'TriggerRundomDelayMinutes' properties have been added to TTaskTrigger but there doesn't seem to be one for an At Logon task - and I'm not sure if these properties are involved with setting a delay in the first place?

Cheers,

Nigel

Re: Delay at Logon scheduled task

Posted: Fri Sep 01, 2023 5:11 am
by isiticov
Hello,

We will add the respective property to the class in the next update. Meantime, you can use the following code as a workaround for this:

Code: Select all

function GetLogonDelayMinutes(const ATrigger: TTrigger): DWORD;
var
  iLogon: ILogonTrigger;
begin
  iLogon := ATrigger.GetVistaTrigger as ILogonTrigger;
  Result := VistaPattern2Minutes(iLogon.Delay);
end;

procedure SetLogonDelayMinutes(const ATrigger: TTrigger; const AMinutes: DWORD);
var
  iLogon: ILogonTrigger;
begin
  iLogon := ATrigger.GetVistaTrigger as ILogonTrigger;
  iLogon.Delay := Minutes2VistaPattern(AMinutes);
end;
Hope this helps.

Re: Delay at Logon scheduled task

Posted: Fri Sep 01, 2023 8:56 pm
by simplysup
Many thanks Igor!