MyChat Scripts Engine: mAddAutoScriptFromString
Creating a time-script from a specified text string.
You can form it manually, download from the file or get over the network by the POST query, etc.
Notice! There is no script validation control, so you should test the script before adding it to the execution queue (or use the mAddAutoScriptFromTemplate function from the template, which can be tested from the Scripts Editor interface.
Syntax
procedure mAddAutoScriptFromString(sScriptName, sScriptSource: string; dtToRun: double);
Parameters and return values
Parameter |
Type |
Value |
sScriptName |
string |
time script name; |
sScriptSource |
string |
script source text. Usage of brackets "begin..end." is necessary; |
dtToRun |
double |
scheduled date/time of the script execution. |
Example
The script is added to the queue from the string. The CRLF function is used for convenience (this is unnecessary, you can do all work by one big string). The script calls the record function into the message text file c:\temp\logscript.txt with the current date/time value.
begin
mAddAutoScriptFromString('myscript',
'begin' + CRLF +
'Protocol(''mAddAutoScriptFromString test'', ''c:\temp\logscript.txt'', true);' + CRLF +
'end.',
IncSecond(Now, 1));
end.
Script work result
See also