Extended Mode (Syntax)
Extended mode is the main and most powerful syntax mode used by nnCron. In extended mode, a user can create tasks with unique names; all tasks are started at user-specified times and allow to fine-tune both the actions performed in the task and conditions on which they are performed.
Definition of every task is started with the following construct:
When the crontab parser encounters this construct, it immediately switches to enhanced mode.
denotes end of task definition and switches the crontab parser back to classic mode. In this way, both classic and extended modes can easily coexist in the same crontab file. The logic of this is very simple: anything in crontab that is within the following construct
#( task_name )#
is treated as extended mode, and everything that is outside of this construct is treated as classic mode. Simplicity rules! :)
# starting a batch file every hour 0 * * * * * cmd /c "c:\xxx\my.bat" # this is classic mode #( my_task \ and this is extended mode already \ displaying a message box after each 30 minutes Time: */30 * * * * * Action: TMSG: "30 minutes have passed" 3 )#
Extended mode parser ignores empty lines, so a task may include any amount of them. Leading blank spaces and tabs are ignored as well. Important notice: extended mode syntax requires that all key words of nnCron should be separated at least with one blank space or tab or placed on a separate lines.
Extended mode allows to "cut" long lines into any amount of short ones by placing character '\' (backslash) in the separation point. When parsing a task, the parser will "assemble" the complete line from several short ones. For example, the following two tasks are absolutely identical from the parser's viewpoint:
#( test_task \ this is a comment Action: \ and here are short lines which will be treated \ by the parser like a single long one START-APP: c:\very\very\long\\ path\to\the\file.exe \ -run my-script -exit \ -nowarning )# #( test_task1 \ this is a comment Action: \ and this is a long string: START-APP: c:\very\very\long\path\to\the\file.exe -run my-script -exit -nowarning )#
In any place within any task you can use a special Forth-style symbol meaning "comment until the end of line": \ (backslash). Please make sure you use a blank space after a comment symbol, for it is one of nnCron key words.
Attention, please: comment symbol used in classic mode (#) won't work in extended mode!
#( first_task \ this is the first task of my own NoLog \ option Time: */15 * * * 1-5 * \ time specifier Action: \ action PLAY-SOUND: c:\winnt\media\chimes.wav )#
Now let's talk about main advantage provided by the extended mode: the Task.