Cron Script Manager

Home   Syntax   Download   Screenshots   Contact

Cron Syntax


Cron Syntax

Cron is a timer which checks each line in the code and runs a command if the line and the time match. Minimum interval is one minute. Code contains lines (text) and each line contains trigger time and command.

Trigger time is defined with exactly 5 segments, separated with space(s) or tab(s). Segment can be defined with a number (e.g. 14th day of the month), range (e.g. from monday to friday), step (e.g. when hour is 0, 2, 4, 6...), star ('*', e.g. for every day) or list (combination of number(s), range(s), step(s)). After the time comes a command - it can be filename with arguments, script name starting with ? or internal command starting with !.
Time segments must be written in the following order: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-6 or 7, where 0 is the same as 7 and represents Sunday).

Comments are written with # symbol and are ignored by the Cron. # should be written before any alphanumeric character (numbers, letters and other symbols).

Samples: # This is a comment # Commented lines are ignored, so next line is NOT executed
# * * * * * !test Hello World
# Stars mean that the command will be triggered every minute, hour, day...
* * * * * !test Hello World
# Command will be triggered at 15:00, 2nd day of month, every month
0   15   2   *   *   !test Hello World
# Command will be triggered at 6:00, 6:30, 18:00, 18:30, every month, on monday
0,30   6,18   *   *   1   !test Hello World
# Command will be triggered on 5, 10, 15... minute when hour is 0, 1, 2, 20, 21, 22 and month is December
*/5   0-2,20-22   *   12   *   !test Hello World
# Next line executes notepad every minute
* * * * * notepad.exe
# Next line executes script.bat with arguments every minute
* * * * * C:\Temp\script.bat -x -y
# Next line executes script named "my_script" every minute
* * * * * ?my_script

Wikipedia for more info about Cron.

Internal Commands

Cron Script Manager contains some integrated (hard-coded) commands. A command is called with ! and name (e.g. !spinup) and optional arguments.

List of commands:
!test [message] - show a message in a balloon
!spinup [file] - write a byte to the file; external disks usually spindown after some period of inactivity, this technique enables constant disk spinning
!click [x,y] [count] [delay] - click on the [x,y] coordinate on the screen; [count] specifies number of clicks, [delay] is delay between each click; bug: click is perfomed on the active window not on the screen

Samples: # Shows "Cron works fine..." message every minute * * * * * !test Cron works fine... # Write a byte to h:\spinup.txt - dummy file on the external disk
# Writting is performed daily, every 5 minutes from 8:00 to 22:55; disk spins down at night
*/5 8-22 * * * !spinup h:\spinup.txt
# Close all (max 20) maximized windows at resolution 1280x1024
* * * * * !click 1270,10 20 500


Application settings are saved in Windows Registry: HKEY_CURRENT_USER\Software\Papn Kukn\Cron Script Manager
Default entries are not written to the registry, but you can specify them manually:
EnableSchedule - enable schedule at next application startup
EnableLogging - enable error logging to ScriptDirectory; for debugging (development)
ScriptDirectory - directory where the Cron code is saved, also default directory for scripts; if the directory is not specified then
%APPDATA%\Cron Script Manager is used, contains Cron lines.


Send me an e-mail if you have any question.