npCron plugin

About this plugin

This plugin allow you to create runtime Timers list objects, who can contain one or more Timers. Every list can contain one or more Timers, and of course you can create the Timers lists that you need.

Every Timer can have their own interval, and can run on a counted or cycled behaviour. The plugin allow you to act when a Timer tick event is fired, and also when all the Timers on a list are finished.

Thirparty

This plugin are imposible without the aid of this people:

Thanks a lot!

Plugin actions index

npCronCreate

Create a new instance of an Cron object. The result variable store the instance ID (a numeric value) of the created object, which you can use later on other plugin actions.

↑↑

npCronDestroy

Destroy a previously created instanace of an Cron object. Specify the instance ID of the object that you what to destroy. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronDestroyAll

Destroy all previously created instances of Cron objects.

↑↑

npCronActive

Active the specified Cron object and begin with the execution of the Cron Timers objects if any. Use this action to active all the Timers objects previously added to the specified Cron object instance. Note that a "cycled" Timer can be actived or deactivated, but, a "counted" Timer need to be enable after finish their counted ticks. Of course this plugin have actions to enable/disable individual Timers. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronDeactive

Deactive a previous active Cron object and stop with the execution of the Cron Timers objects if any. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronIsActive

Determine if the specified Cron object is active or not. The result variable store "True" if the specified Cron object is active, or "False" when not. Also the resutl variable can store "False" if an error occur. In this last case the [LastError] variable store information about the error.

↑↑

npCronAddTimer

Add a new Timer object to the specified Cron object. Cycled can be "True" or "False", and determine if the Timer continue their execution in a cycled, or if only need to be executed just some count times. The Timer Interval must be the milliseconds of the Timer interval. The Repeat Count is a numeric value that take effect when Cycled is "False": this is the number of times that the Timer is executed.

The result variable store the ID of the added Timer. You can use this numeric value later with other plugin actions, for example, to enable or disable an specific Timer. The result variable also can store "False" if an error occur. In this last case the [LastError] variable store information about the error.

↑↑

npCronDeleteTimer

Delete a previosly added Timer from the specified Cron object. Specify the Timer ID (returned by npCronAddTimer) in order to delete this Timer from the Cron object. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronTimersList

Get an array with the added Timers on the specified Cron object. The List variable store a NeoBook Array with the ID's of the Timers in the Cron object. The List Count variable store the number of items in the List Array, so you can use it to iterate the Timers ID's array. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronEnableTimer

Enable a previosly added Timer on the specified Cron object. Specify a Timer ID in order to enable it. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronDisableTimer

Disable a previosly added Timer on the specified Cron object. Specify a Timer ID in order to disable it. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npCronTimerIsEnable

Determine if the specified Timer of the specified Cron object is enable or not. The result variable store "True" if the specified Timer is enable, or "False" when not. The result variable also can store "False" if an error occur. In this last case the [LastError] variable store information about the error.

↑↑

npOnCronTimers

Set a publication subroutine to be executed when a Cron Timer tick event is fired. The Instance ID variable store the ID of the Cron object instance who fired the event, and the Timer ID variable store the ID of the Timer which fired the event. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

npOnCronFinish

Set a publication subroutine to be executed when the Cron Timers finish event is fired. Note that "cycled" Timers never finished, except when you programatically deactive the Cron object. The "count" Timers finished when consume their "Repeat count" property. The Instance ID variable store the ID of the Cron object instance who fired the event. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable store information about the error.

↑↑

Action errors subroutine

All the NeoPlugins deal with errors in the same way that NeoBook does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.

But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:

Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:

:OnNeoPluginActionError
  AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]"
Return

Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.

↑↑