Calculating a number of time-scripts with specified names which are scheduled for execution. This function is used to determine if there are any time-scripts in the execution queue.

 

Syntax

function mGetAutoScriptsCountByName(sScriptName: string): integer;

 

Parameters and return values

Parameter

Type

Value

sScriptName

string

time-script name.

 

Function result

Returns the number of scripts. If there are no scripts, the function returns 0.

 

Example

Three fake scripts with the same name ("myscript") are added to the queue. The number of scheduled scripts with the non-existent name "testname" and "testscript" is displayed in the debugging console. After this, all "myscript" entries are deleted from the execution queue.

 

var
  i, iCount: integer;
begin
  for i := 1 to 3 do
    mAddAutoScriptFromString('myscript', 'begin end.', IncMinute(Now, i));
  iCount := mGetAutoScriptsCountByName('testscript');
  mLogScript(inttostr(iCount), 'nonexistent script');
  
  iCount := mGetAutoScriptsCountByName('myscript');
  mLogScript(inttostr(iCount), '"myscript" entries');
  
  mDeleteAutoScriptByName('myscript');
end.

Script work result

[18:04:46] (Log "mGetAutoScriptsCountByName"): [nonexistent script] 0

[18:04:46] (Log "mGetAutoScriptsCountByName"): ["myscript" entries] 3

[18:04:46] (Run "mGetAutoScriptsCountByName"): Script operation time: 2 ms

[18:04:46] (Run "mGetAutoScriptsCountByName"): Script done successfully.

 
See also

IncMinute

IntToStr

mAddAutoScriptFromString

mDeleteAutoScriptByName

mLogScript

Now