home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 November / Chip_2000-11_cd2.bin / sharewar / wincron / WinCron.CAB / WinCron.txt < prev    next >
Encoding:
Text File  |  2000-04-22  |  21.2 KB  |  557 lines

  1. WinCron (C)1997-2000 Steve J. Gray
  2. ======= FREEWARE
  3.  
  4. Version: 1.40, Apr 22/2000
  5.  
  6. Please see the readme file for program history and requirements.
  7.  
  8. Introduction
  9. ------------
  10.  
  11.   WinCron is a Windows task scheduler/runner/controller. It can run
  12. Windows or DOS programs, or batch files (EXE, COM or BAT). Tasks can
  13. be set up to execute manually, on startup, or on a scheduled basis.
  14. A schedule can be a specific day or range of days, specific days of
  15. the week, or during specific months. Tasks can be set to run once or
  16. at specific intervals between two times, or excluded between two times.
  17. Tasks can be individually enabled or disabled or all tasks can be
  18. disabled. When run, tasks can be recorded in a log file for later
  19. verification.
  20.  
  21. Special internal WinCron commands allow automated messages, log
  22. comments, and log backups. Command-line variable substitutions allow
  23. passing of date/time/count etc to commands or batch files. WinCron
  24. scripts can be used for advanced application control.
  25.  
  26.  
  27. Window Layout
  28. -------------
  29.  
  30.  When run, the program window will appear. On the titlebar is the
  31. current date. Below the Titlebar is the current time, enable box, and
  32. busy indicator and buttons for general options.
  33.  
  34.     Enable
  35.         - Is the MASTER enable box. When checked tasks may run.
  36.     Busy
  37.         - Lights RED when a task is running.
  38.  
  39.     Event Log
  40.         - Runs the Notepad program to display the "wincron.log"
  41.           file. Please note: If you are viewing the log and
  42.           a logged event occurs the log file will be changed
  43.           in the file but NOT in Notepad! If you then SAVE
  44.           the log file those events will be lost.
  45.     Msg Log
  46.         - Displays the Messages log window.
  47.     Options/Docs
  48.         - Displays program options and documentation.
  49.     Save
  50.         - Saves task information, including "last run" info.
  51.  
  52.  Below is the Tasks list with several columns that display the tasks and
  53. some of the most important task settings. You may adjust the width of
  54. the columns or rearrange them using the mouse.
  55.  
  56. Below the list are buttons that modify the task list:
  57.  
  58.     Add    - Adds a task to the list.
  59.     Edit    - Edit currently selected task.
  60.     Del    - Deletes currently selected task.
  61.     Copy  - Copies the currently selected task and it's settings
  62.           and adds it to the bottom of the task list. The "Last Run"
  63.           and "Run Count" are reset.
  64.     Up    - Moves the task up the list
  65.     Dn    - Moves the task down the list
  66.     Run Now
  67.         - Runs the currently selected task.
  68.           Note: Always runs the task regardless
  69.           of schedule settings.
  70.  
  71.   The UP and DN buttons can be used to change the order that
  72. tasks are run. Tasks at the top of the list are run first. You may
  73. need to adjust the order of tasks if one task depends on another
  74. (ie: if you start a program in one, then send keys to it in another).
  75.  
  76.  
  77. Adding or Editing a Task
  78. ------------------------
  79.  
  80.   When you click on the Add or Edit button another window will appear
  81. where you can define the task and schedule. In the top half of the
  82. window you specify a description for the task, the command to run,
  83. when to run it and how it appears on the screen. You can also define
  84. whether the task is enabled or disabled and if the task should be
  85. recorded in the event log.
  86.  
  87. * Desc
  88.     Description of the task.
  89.  
  90. * Command
  91.     Command to execute. May include a command line string if
  92.     needed. Click on the "..." button to browse the computer to
  93.     find the executable file. The command can be left blank to
  94.     record comments (the description) in the log file at specific
  95.     times.
  96.          
  97.     Commands can contain variables in the form %NAME% that will be
  98.     substituted with the appropriate value when the command is
  99.     executed. See the VARIABLES.TXT file for details.
  100.  
  101.     To execute special "internal" WinCron commands, start the line
  102.     with a "$". See the COMMANDS.TXT file for details.
  103.  
  104.     NOTE!:
  105.         WinCron can NOT execute INTERNAL DOS commands directly.
  106.         Internal DOS commands are those that are part of
  107.         COMMAND.COM (like COPY and DIR). To use internal DOS
  108.         commands you must run them in a batch file, or use the
  109.         equivilent WinCron command!
  110.  
  111. * When
  112.     Specifies when the event should run:
  113.  
  114.     * Manually - only when "Run Now" clicked.
  115.     * At Startup - when WinCron first runs.
  116.     * Scheduled - as specified in bottom section
  117.     * At Shutdown - when WinCron is exited.
  118.     
  119.     Note: the bottom section is hidden when not required
  120.  
  121. * State
  122.     Determines how commands are displayed when run:
  123.     * Hidden with Focus
  124.     * Original Size with Focus
  125.     * Icon with Focus
  126.     * Maximized with Focus
  127.     * Original Size (no focus)
  128.     * Icon (no focus)
  129.  
  130. * Record in Log
  131.     Enables event recording in log file.
  132.  
  133. * Enable Event
  134.     Enables event to run when scheduled.
  135.  
  136. * Run Count
  137.     The number of times the task has run.
  138.  
  139. * Reset Button
  140.     Reset the run count.
  141.  
  142. * OK Button
  143.     Uses the settings. Updates the task info or adds the task.
  144.  
  145. * Cancel Button
  146.     Ignores any changes or additions.
  147.  
  148.   If "When" is set to "Scheduled" the event window will expand to
  149. display the bottom section, where you may set the dates and times that
  150. the task will be run.
  151.  
  152. * Date Valid
  153.     Specifies the range of dates that the event may run. To specify
  154.     a date you must enter the year, month and day in exactly the
  155.     following format: YYYYMMDD.
  156.     
  157.     IE: Tue Oct 20,1998 would be entered as 19981020.
  158.  
  159.     From    - The first day the event is valid (00000000=any day).
  160.     To    - The last day the event is valid (00000000=any day).
  161.  
  162. * Activation
  163.     Specifies month and day, or month and day range that the event
  164.     will run. Month and Day values are separate. Under each column
  165.     there is a checkbox to enable the column. If not checked, the
  166.     column will be ignored. IE: if the DD column is not checked ANY
  167.     day will be valid. If the DD column is checked then the day
  168.     must match the specified day or day range.
  169.  
  170.     From    - specifies the FIRST valid month and/or day.
  171.     To    - specifies the LAST valid month and/or day.
  172.         - If the "To" Checkbox is NOT checked then the "From"
  173.           month and/or day specify a single date. If checked
  174.           then the month and/or days become a range.
  175.  
  176.     * TIP: the MM and DD values are separate therefore
  177.             / FROM: 01 05 \
  178.             \   TO: 03 07 /
  179.       would NOT mean all days from Jan 5 to Mar 7, but rather only
  180.       the days 5 to 7 in the months Jan to Mar.
  181.       IE: Jan 5,6,7, Feb 5,6,7, and Mar 5,6,7.
  182.     
  183.     (If you need Jan 5 to Mar 7 then those dates should be
  184.      specified in the date range and the "from" and "to" should be
  185.      left un-selected!)
  186.  
  187.     NOTES:
  188.     * When using a single day, an entry of "99" can be used to
  189.       specify the "last day of the month".
  190.     * When using a day range, if you need to run a task to
  191.       "the end of the month", use "31" in the day "to" field.
  192.  
  193. * HHMM
  194.     Specifies the time or time range for the event. Times must be
  195.     specified in 24-hour format (ie: 1pm=1300).
  196.  
  197. * Time and Frequency
  198.     The dropdown menu beside the "From" time determines if the
  199.     time is a single time or a range and if the event is kept or
  200.     deleted after it runs:
  201.  
  202.     * Once a day, Anytime:
  203.         - Once per day (At midnight if wincron is left running,
  204.           or shortly after WinCron first runs each day)
  205.     * Once a day, Specified Time:
  206.         - Once per day at the exact time, provided WinCron is
  207.           running at that time.
  208.     * Intervals, Between Times:
  209.         - One or more times between From/To range.
  210.     * Intervals, Outside Times:
  211.         - One or more times, NOT between From/To range.
  212.     * Once Only, Specified time:
  213.         - Once at the specifed time provided WinCron is running.
  214.         - The event is recorded then never runs again
  215.           (provided tasks are saved).
  216.     * Once Only, then delete task:
  217.         - Once at specified time provided WinCron is running.
  218.         - The event will be marked deleted in the task list then
  219.           will be deleted when the task list is next saved.
  220.     * Once a day, within Time Range:
  221.         - Once per day provided the time is inside the time range
  222.  
  223.     - The dropdown menu beside the "To" time determines the
  224.         frequency of events:
  225.  
  226.     * Every 1,2,5,10,15,20 or 30 minutes.
  227.     * Every 1,2,4,6,8, or 12 hours.
  228.     * Custom
  229.  
  230. * Custom Interval (minutes)
  231.     When "Time and Frequency" is set to custom.
  232.     - any value from 001 to 999
  233.  
  234. * Day (of week)
  235.     Specifies valid days for the event:
  236.  
  237.     * Any Day - Any day of the week.
  238.     * Weekday - Monday to Friday.
  239.     * Weekend - Saturday and Sunday.
  240.     * Selected- Only the days that are indicated.
  241.  
  242.     NOTE:
  243.     Be careful when combining day and day-of-week settings!
  244.          IE: if you set an event to happen only on the first of
  245.     the month but also set the day-of-week to Monday then
  246.     the event will ONLY occur if the first is a monday.
  247.  
  248.  
  249. Drag and Drop Adding (32-bit version only)
  250. --------------------
  251.  
  252.   You can add a task to the tasklist by dragging a file from explorer,
  253. a directory window or the desktop TO the task list area in the WinCron
  254. window. A new task will be created with the name of the dropped file in
  255. the command field. This is equivilent to clicking the ADD button from
  256. the main window then the "..." browsing button in the task window and
  257. browsing to locate a file.
  258.  
  259. Prefs Window
  260. ------------
  261.  
  262.   This window displays the WinCron documentation and lets you set
  263. the program options. Options are saved automatically.
  264.  
  265. * Show Tray Icon (32-bit version only):
  266.     - Displays an Icon in the sytem tray on the taskbar.
  267. * Minimize on Startup:
  268.     - Hides the main window when first run.
  269. * Save task list when changed:
  270.     - Saves the entire task list whenever you add/edit/delete a
  271.       task.
  272. * Save task list on exit:
  273.     - Saves the task list when WinCron exits.
  274. * Confirm Task Deletes:
  275.     - If selected, a popup window asks you to confirm the action.
  276. * Disable Messages:
  277.     - Stops messages from appearing for invalid internal commands.
  278.  
  279.   If the tray icon is enabled and you minimize the main window a button
  280. will NOT appear on the taskbar. Left-clicking on the tray icon will
  281. re-display the main window.  Right clicking on the tray icon will
  282. display a menu with the following options:
  283.  
  284.     * Enable Tasks    - enables task execution
  285.     * Disable Tasks    - disables all tasks
  286.     * Preferences    - Display preferences window
  287.     * View Log    - View Log file
  288.     * Close        - Exits WinCron
  289.  
  290.   Preference settings will be saved when WinCron is exited. The "enable"
  291. setting as well as main window position and size will be saved.
  292.  
  293.  
  294. Command-line option
  295. -------------------
  296.  
  297.   If you want WinCron to use a task list other than the default
  298. (wincron.dat) you can specify the name of the task list file on the
  299. command line. To do this create a shortcut to the WinCron executable
  300. then edit the command line by appending the filename to the end.
  301.  
  302. Example: WinCron50.exe newlist.dat
  303.  
  304. Task lists must have an extension of "DAT".
  305.  
  306.  
  307. Operation
  308. ---------
  309.   When run, the program will look for the file "WINCRON.DAT" (or the
  310. one specified on the command line) which must be in the same directory
  311. as the WINCRON.EXE file. This file contains information for each task
  312. in the list. WinCron updates the clock each second. When the seconds
  313. gets to "00" the entire task list is checked from first entry to last
  314. and all tasks that are currently set to "enabled" will be performed
  315. provided all the specified conditions are met: Date range,
  316. month range, day range, time range, day of week and/or frequency etc.
  317.  
  318.   When a task is performed it runs concurrently (at the same time) as
  319. any other tasks that may be running. WinCron does NOT wait for programs
  320. to exit before continuing. If a program can not be found there will be
  321. NO error messages displayed. If "Record in Log" is enabled the current
  322. date and time as well as the description will be recorded in the file
  323. "WINCRON.LOG". If the program starts then "OKAY" will be recorded, if
  324. not then "ERROR" will be recorded.
  325.  
  326.   If you want to disable all events (IE: to verify scheduled tasks)
  327. simply un-check the "Enabled" box in the main window.
  328.  
  329.   If the "Save task list when changed" option is NOT enabled you must
  330. click on the SAVE button to save the event information. Tasks
  331. can be added, edited or deleted while WinCron is running and will be
  332. acted on immediately, however any changes will be lost when WinCron
  333. exits unless they are saved! Clicking the SAVE button will also record
  334. the date and time each event was last run, which will be displayed when
  335. a task is selected from the task list.
  336.  
  337.     NOTE:    The "last run" info is saved with the task list,
  338.         however the task list is NOT saved when a task is RUN.
  339.         Therefor, to ensure the last run info is saved, you
  340.         might want to create a task that is run once a day or
  341.         when WinCron is exited to save the task list (use the
  342.         $SAVE internal command).
  343.  
  344.   Lastly, if not obviously, tasks will not and cannot be run unless
  345. WinCron is actually runnning! Tasks that were scheduled and missed
  346. when WinCron is not running will NOT be performed when WinCron first
  347. starts again. If WinCron is vital you might consider adding it to the
  348. STARTUP menu. Tasks that are missed can be run manually at any time
  349. by selecting the task from the list and clicking the "Run Now" button.
  350.  
  351.  
  352. Scripts
  353. -------
  354.  
  355.   Scripts are similar to DOS batch files. A script is a text file
  356. containing a list of commands to be executed in sequence. Scripts can
  357. contain "external" DOS commands, or Windows commands. Unlike DOS
  358. batch files however, scripts can also contain special WinCron commands
  359. ($ commands) and internal WinCron variables. To use scripts in WinCron
  360. use the $RUN internal command. The syntax is:
  361.  
  362.     $RUN {scriptname}
  363.  
  364. Where {scriptname} is the name of the script file. Script files can
  365. be called anything you want (IE: script.txt, test.scr, wincron.wcs) etc.
  366. I recommend you use the extension "WCS". You can also associate specific
  367. extensions with WinCron so that double-clicking a script from explorer
  368. will launch wincron, run the script, then exit.
  369.  
  370. When you use the EDIT button to edit a task you can use the
  371. "Edit script" button to edit your scripts using Notepad.
  372.  
  373. The following commands are useful in scripts:
  374.  
  375.     $EXISTS    - Checks if a file exists. Sets condition.
  376.     $PROMPT    - Gets YES/NO reponse from user. Sets condition.
  377.     $YES    - runs a command if the condition was TRUE
  378.     $NO    - runs a command if the condition was FALSE
  379.     $SEND    - sends keystrokes to a specified window
  380.     $KEYS    - sends keystrokes to the currently active window
  381.     $DELAY    - delays execution for a specified time (milliseconds)
  382.     $WAITSEC- waits until the time gets to the the specied second
  383.     $STOP    - stops script processing
  384.     $SKIPTO    - jumps forward to the specified line
  385.  
  386. IMPORTANT!!!:
  387.     WinCron runs WinCron ($) commands in sequence (IE: the next
  388.     command runs only AFTER the first is finished, however, DOS
  389.     and Windows commands are started as separate tasks. This means
  390.     that the command may still be loading/running when the next
  391.     command is executed. If you intend to send keystrokes to a
  392.     windows application you should use the $DELAY command to give
  393.     the windows application enough time to load and respond to
  394.     keyboard input!
  395.  
  396. CAUTION:
  397.     If a script contains many $DELAY commands and the task takes
  398.     more than one minute, it may cause other tasks to be missed!
  399.  
  400. NOTE:
  401.     WinCron scripts can NOT use DOS batch-only commands such as
  402.     IF, FOR, GOTO, EXISTS, ERRORLEVEL, SHIFT, or %1 to %9, nor can
  403.     it use INTERNAL DOS command such as DIR, DEL, MKDIR, COPY etc.
  404.     Most internal DOS commands are duplicated with internal WinCron
  405.     commands (ie: $COPY, $MKDIR, $KILL etc).
  406.  
  407. Timers
  408. ------
  409.  
  410.   There are 10 general-purpose timers available in WinCron. Timers can
  411. be used to co-ordinate tasks that must be performed after specific
  412. intervals. For example, when the computer turns on you might want to
  413. start processing something that takes 10 to 15 minutes to complete.
  414. Then 15 minutes later you want to run another task that depends on the
  415. results of the first task.
  416.  
  417.   You wouldn't be able to schedule the second task at a set time,
  418. because you don't know when the first task started. The anwser is to
  419. use a timer in the first task (set to 15 minutes) then in the second
  420. task (say set to run every 5 minutes) check the timer to see if it's
  421. been 15 minutes or more. If it has, do the task, if not just skip it.
  422.  
  423. For example:    (NOTE: do not type in the comments!)
  424.  
  425. * Task1:
  426.         longtask.exe        ;run the task
  427.         $countup 0        ;start/enable timer#0
  428.  
  429. * Task2:
  430.         $IFTIMER 0        ;check if timer1 enabled
  431.         $NO $STOP        ;no, so forget it
  432.         $CHECKTIMER 0 15    ;has 15 minutes elapsed?
  433.         $IFLESS $STOP        ;no, bye again
  434.         nexttask.exe        ;yes, run the other task
  435.         $TIMER 0 STOP        ;disable the timer!
  436.  
  437. The same thing using a count-down timer:
  438. * Task1:
  439.         longtask.exe    ;run the task
  440.         $countdown 1 15    ;set timer#1 to countdown from 15 minutes
  441. * Task2:        
  442.         $ifzero 1 nexttask.exe    ;if the timer is 0 do it
  443.         ; note: the timer is automatically disabled
  444.  
  445. Some Example Tasks
  446. ------------------
  447.  
  448. Here are some example tasks and what need to be set.
  449. "[*]" indicates checkbox is checked. "(N/A)" indicates setting not used.
  450.  
  451. A) Record each time WinCron runs:
  452.  
  453.   Desc=WinCron was started
  454.   Command= (leave empty)            [*]Record in Log
  455.   When=On Startup    State: (N/A)        [*]Enable Event
  456.   ----------------------------------------------------------------
  457.   (Event schedule info will not be shown)
  458.  
  459.  
  460. B) Run a tape backup every Sunday at 1pm:
  461.  
  462.   Desc: Backup system to tape
  463.   Command: "C:\tape\backup.exe" -auto               [*]Record in Log
  464.   When: Scheduled   State: Original Size with Focus [*]Enable Event
  465.   -----------------------------------------------------------------
  466.   Date Valid: YYYYMMDD  Activation: MM DD HHMM
  467.         From: 00000000          From: 00 00 1300  Specified time
  468.       To: 00000000      To: [ ] 00 00 0000
  469.                     [ ][ ]
  470.   Day: Selected   [*]Sun [ ]Mon [ ]Tue [ ]Wed [ ]Thu [ ]Fri [ ]Sat
  471.  
  472.  
  473. C) Display the message "Work Harder!" once every Hour from 9am to 5pm
  474.    during the week just before a big deadline on Friday Nov 21, 1997:
  475.  
  476.   Desc: Reminder
  477.   Command: $MSG Work Harder!            [ ]Record in Log
  478.   When: Scheduled     State: (N/A)        [*]Enable Event
  479.   --------------------------------------------------------------
  480.   Date Valid: YYYYMMDD  Activation: MM DD HHMM
  481.         From: 00000000          From: 00 00 0900  Intervals, Between Range
  482.       To: 19971121      To: [ ] 00 00 1700  Every Hour
  483.                     [ ][ ]
  484.   Day: Weekday   [ ]Sun [ ]Mon [ ]Tue [ ]Wed [ ]Thu [ ]Fri [ ]Sat
  485.  
  486.  
  487. D) Perform a task via batch file every 10 minutes starting 1 minute
  488.    past the hour except between noon and 7pm every day during the
  489.    months of May to July starting in the year 2001 and ending in the
  490.    year 2010 but don't record them:
  491.  
  492.   Desc: Menial tasks in PROCESS.BAT batch file.
  493.   Command: C:\JUNK\PROCESS.BAT            [ ]Record in Log
  494.   When: Scheduled     State: (N/A)        [*]Enable Event
  495.   --------------------------------------------------------------
  496.   Date Valid: YYYYMMDD  Activation: MM DD HHMM
  497.         From: 20010101          From: 05 00 1201  Outside Range
  498.       To: 20101231      To: [*] 07 00 1900  Every 10 Minutes
  499.                     [*][ ]
  500.   Day: Any Day  [ ]Sun [ ]Mon [ ]Tue [ ]Wed [ ]Thu [ ]Fri [ ]Sat
  501.  
  502.  
  503.  
  504. FAQ - Frequently Asked Questions
  505. --------------------------------
  506.  
  507. Q: When I run a batch file the MS-DOS window remains open.
  508. A: You must enable the "close on exit" option in the properties for the
  509.    batch file.
  510.  
  511. Q: My events don't seem to run.
  512. A: Check that all events are enabled, then check that the event itself is
  513.    enabled. The event may actually be running but is set to run "Hidden"
  514.    so it won't appear on the screen (use CTRL-ALT-DEL to check if the
  515.    application is running but not visible).
  516.  
  517. Q: Can I use WinCron to run tasks on a Windows NT server without anyone 
  518.    logged in?
  519. A: You can make WinCron a service (see the NT resource kit for details).
  520.    NOTE: Microsoft advises against making VB programs into services.
  521.    Use at own risk! I will not support WinCron run in this way.
  522.  
  523. Q: An application doesn't work when run from WinCron.
  524. A: It may need to be started with a batch file, because it might need to access
  525.    files from a default directory or drive.
  526. A: The program may already be running hidden and may not operate as expected or
  527.    at all (like when attempting to run WinCron twice).
  528.  
  529. Q: When I send keys to an application nothing happens.
  530. A: The application may not be designed to handle keyboard input, or it is
  531.    performing an operation that does not respond to input at that time.
  532. A: The titlebar of the application may have changed.
  533. A: The application may have a "fake" titlebar (WinCron won't know where to
  534.    send the keys!).
  535.  
  536.  
  537. WinCron Stealth Control Program (32-bit version only)
  538. ===============================
  539.  
  540.   The WinCronSC program is an additional 32-bit program that enables
  541. or disables WinCron's "stealth" mode. When stealth mode is enabled
  542. WinCron will run entirely in the background with NO user interface.
  543. This can be useful for public access workstations that must perform
  544. periodic tasks but remain invisible to the user. In order to be useful
  545. all tasks and preferences should be set BEFORE enabling stealth mode.
  546. To make WinCron's operation invisible while in stealth mode you should
  547. set the State for all tasks to "Icon" so that they are not visible and
  548. not the focus (the program that receives input).
  549.  
  550.   To change settings you must disable stealth mode before running
  551. WinCron. If WinCron is already running you can shut down WinCron
  552. using the Task Manager (CTRL-ALT-DEL).
  553.  
  554.   If you do not want WinCron's stealth mode to be changed simply
  555. remove WinCronSC.exe from the machine after setting the stealth mode
  556. to the desired state.
  557.