Welcome to the WinCron Tutorial.
In this first chapter of the Tutorial, we will present the quintessential ‘Hello World’ program.
Actually, WinCron doesn’t really have programs, but instead, jobs.
Jobs start with a ‘{‘ and end with a ‘}’, and have any number of statements in-between.
Okay, that’s the basics, now for the ‘Hello World’ job:
{
-action –print “Hello World!”
}
Now, there is a problem with the above job… It has no ‘start’ trigger.
You see, unlike programs written in 'C', C++, and perl, etc., WinCron scripts don’t have an
entry point. WinCron scripts instead register triggers with the WinCron interpreter. These triggers tell WinCron when a job should
fire.Okay, lets now add a -start trigger.
In the following job, the start trigger has no arguments and therefore indicates that the job should fire now.
# This is a comment
{
# Start now!
-start
# Print Hello World!
-action -print “Hello World!”
}
Lets try our new script.
First save the script.
(I saved mine to c:\temp\hello.tg)
Launch WinCron:
Use the Load Button to load the script:
Use the Start button to start the WinCron interpreter:
Lets look at what we see on the WinCron console:
Ready.
Loading C:\Temp\hello.tg.
1 jobs loaded.
Trigger:unnamed: Saturday, December 23, 2000 13:09:25.
Hello World!The first line output is what WinCron says when it enters a
ready state. WinCron will print
Ready only once on startup, after all auto-run scripts have finished.
The next two lines simply indicate that WinCron has successfully loaded the script named ‘hello.tg’.
Additionally, the script that was loaded only contained 1 job. (It is possible that a single file loaded may contain multiple jobs.)
Finally you see the results of the script having been run.
The line:
Trigger:unnamed: Saturday, December 23, 2000 13:09:25.Means, that on Saturday, December 23, 2000, at 13:09:25, an unnamed job was triggered.
The last line,
Hello World!, is the output from the script.