Set Scheduled Task start time via variable

Hi;

Is there any way to set the Absolute start time of a Add Scheduled Task action to a variable?

The UI allows me to enter %StartTimeVariable% in the Absolute start time drop-down but this value does not appear to be retained on OK/Save.

I'd appreciate any pointers - thanks.

Mark

Hi Mark,

You will need to use the “BeforeAction” script event of the “Schedule Add” action and use the following script:

 
var absDate = new Date([YOUR_VARIABLE]);

Action.PropertyStore.absDay = absDate.getDate();
Action.PropertyStore.absHour = absDate.getHours();
Action.PropertyStore.absMin = absDate.getMinutes();


Regards,
Paul.

Paul;

Thanks for the reply - but I can't get it to fly. Here's the error:

Error Executing script : BeforeAction
Microsoft JScript runtime error
'PropertyStore' is null or not an object
Line : 2
Char : 3
Error in BeforeScript : JavaScript, This Action did not execute.

Here's the code located on the BeforeAction in the Add Scheduled task:

  var absDate = new Date([BackupStartTime]);
  Action.PropertyStore.absDay = absDate.getDate();
  Action.PropertyStore.absHour = absDate.getHours();
  Action.PropertyStore.absMin = absDate.getMinutes();

Hi Mark

I think Paul must have been looking at the wrong action, here's an example that worked for me :

Action.AbsoluteStartTime = StrToDateTime("10:32")

The value passed to StrToDateTime can be any valid time format (e.g 14:32 or 10:45PM )

HTH