You can add a script for execution from the template by specifying its name, execution time and name from the section "Custom", "Service", "Examples".

 

Syntax

procedure mAddAutoScriptFromTemplate(sScriptName, sTemplateName: string; dtToRun: double);

 

Parameters and return values

Parameter

Type

Value

sScriptName

string

time-script name;

sTemplateName

string

script-template name from the section of the script tree: "Custom", "Service" or "Examples";

dtToRun

double

date/time of the script execution.

 

Example

The script is added to the queue from the template. The execution time is set as already past (-1 minute from the current time). This "trick" means that in the next second the script will be executed immediately by the scheduler. This procedure is optional, but such method is convenient for a real test (you do not have to wait until the event occurs).


begin
  mAddAutoScriptFromTemplate('testautoscript', 'Custom\TemplateScriptTest', IncMinute(Now, -1));
end.


Script template text. Writing a string with the current time value into the text file c:\temp\log.txt


begin
  DeleteFile('c:\temp\log.txt');
  AddLineToFile(FormatDateTime('hh:nn:ss', Now), 'c:\temp\log.txt');
end.


Script work result
 

Результат работы time-скрипта MyChat? созданного по шаблону

 
See also

AddLineToFile

DeleteFile

IncMinute

FormatDateTime

Now