You might want to use the new "StartPeriodicScript" function rather then the Macropump:
StartPeriodicScript
Function StartPeriodicScript(ByVal ScriptQFN as String, ByVal UpdatePeriod as
Double) as Integer
This function causes Mach to start a script that will be invoked with the specified
periodicity.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be run.
The qualified path name is relative to the Mach install directory. The QFN does
not include the script extension. Mach will look first for ScriptQFN.mcc and if
not found, then ScriptQFN.m1s.
If the QFN is the name of a script already started by a previous call to
StartPeriodicScript(), an error condition is returned. Mach does not support
multiple periodic instances of a single script.
UpdatePeriod: The length of the time period between runs of the script.
The time units are seconds. The minimum value is 5ms, any value less than 5ms
will be ignored and the minimum value of 5ms will be used for the UpdatePeriod.
Page 88
It is recommended that periodic scripts be run with the longest UpdatePeriod
appropriate for the script’s task. This will help minimize the load on the machine
from multiple periodic scripts.
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Return Values:
<tbd>
Example:
‘ Initialize a script that runs the way oiler every 30
minutes
If StartPeriodicScript(“OilerScript”, 30*60*1000) then
Msgbox “Oiler periodic script is running”
Else
Msgbox “Oiler script was not started”
End If
See also:
IsPeriodicScriptRunning, StopPeriodicScript
First Mach3 version with API:
This API was first implemented in Mach3 version 3.43.06.
It was defined as a Boolean function with
Return Value:
True = requested function was performed successfully (script is now
running).
False = error, requested function was not successful (script is not running).
This API was revised in Mach3 version 3.43.19 to be an Integer function.
StopPeriodicScript
Function StopPeriodicScript(ByVal ScriptQFN as String) as Integer
This function is used to stop a previously started periodic script.
A periodic script only stops at the end of one of the script’s UpdatePeriod time quanta (as
set by StartPeriodicScript) cycles. For example if a script is running with a 5 minute
UpdatePeriod, and the stop request is issued 2 minutes into the cycle, the script will not
stop until the current 5 minute cycle expires.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to be
stopped. The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Attempts to stop a script that has not been started by StartPeriodicScript are
ignored (this is not an error condition as the script is “stopped” upon return from
the call).
Return Value:
0 = requested function was performed successfully (script is now running).
< 0 = error, requested function was not successful (script is not running).
Error Values:
<tbd>
Example:
‘ Stop a the running way oiler script
If StopPeriodicScript(“OilerScript”) then
Msgbox “Oiler periodic script has been stopped”
Else
Msgbox “Error, Oiler script was not stopped,
check the QFN passed.”
End If
Page 90
See also:
IsPeriodicScriptRunning, StartPeriodicScript,
First Mach3 version with API:
This API was first implemented in Mach3 version 3.43.06.
It was defined as a Boolean function with
Return Value:
True = requested function was performed successfully (script is now
running).
False = error, requested function was not successful (script is not running).
This API was revised in Mach3 version 3.43.19 to be an Integer function.
IsPeriodicScriptRunning
Function IsPeriodicScriptRunning(ByVal ScriptQFN as String) as Boolean
This function is used to determine if a periodic script has been started.
Arguments:
ScriptQFN: the string of the Qualified File Name (QFN) for the script to check.
The QFN is relative to the Mach install directory.
The QFN passed must be identical to the QFN used to start the periodic script.
Return Value:
True = the Script is running.
False = the script is not running.
Example:
‘ check if the oiler has been started
If IsPeriodicScriptRunning(“OilerScript”) then
Msgbox “Oiler script is running.”
Else
Msgbox “Oiler script is not running.”
End If
See also:
StartPeriodicScript, StopPeriodicScript,
First Mach3 version with API:
This API was first implemented in Mach3 version 3.43.06.