(****************************************************) (* Askme Version 2.0 Written by Gary Bouchard *) (* SysOp - The Computer Store BBS *) (* St. Augustine, Florida (904)794-0063 *) (* Copyright(c) 1992....All Rights Reserved *) (* Released July 3, 1992 Modified *) (****************************************************) A simple program that will count from XX to 0 where XX= the user defined time out, or the default of 10 seconds, then exit with an errorlevel set to a number based upon your answer or keyboard input. The program defaults to an affirmative (Yes) answer with errorlevel set to Zero (0) after a countdown from XX. Valid keys are 'Y', 'N', , or . On the command line you can place your question right after the program name, along with the time in seconds to countdown, and if you want a default answer set to NO, you can use a command line switch to change the default answer. Whatever the default answer is set to by you, the program will always exit with a 1 for NO, and a 0 for YES. The calling syntax is like this; C:>askme "question" [/Y /N] [/Txx] The parameters in [brackets] are optional, and allow you to modify the default values. If you want to use an optional value, do not use the brackets. The /Y switch is the default, but it does not hurt to place it on the command line. The /N switch is to change the default answer to NO. The /Txx switch is the time in seconds the program should delay...example; /T15 would make the program countdown from 15 to zero seconds. The default timeout is 10 seconds. You can use either or both switches at the same time if desired. To use the program in a batch file, place a line like so anywhere you desire to get the errorlevel set; @echo off askme Is this a Test? /t20 if errorlevel 1 goto quit echo Hello World! :Quit This example would wait 20 seconds, then exit with errorlevel set to zero (unless the or N keys were pressed). @echo off askme Is this a Test? /t5 /n if errorlevel 1 goto quit echo Hello World! :Quit This example would wait 5 seconds, and the default answer would be NO (errorlevel 1), so the program would jump to the label :QUIT. The program will pass the parameters to ASKME in proper case for simplicity, and start the count. This program is copyrighted(c) 1992, and is being distributed as *FREEWARE* in a non-commercial application. I maintain the rights to the source code, and will continue to support this program and enhance it, as long as there is interest in it. Call my BBS at the phone number above, for many more *FREEWARE* utilities. History: Ver 1.0 - My first Turbo Pascal program Released to Public! Ver 1.1 - July 13, 1990, Corrected a typo, and turned off the DEBUG code to make the program smaller and faster. Cosmetic change, and fixed the counter...It was changing the system clock. Fixed! Changed the logic of the counter to countdown instead of up. Took out unused code to make it smaller and faster, though you cant run much faster when you depend on the timer function. Ver 2.0 July 3, 1992 - Completely rewritten in Turbo C++ 3.0, and options added to make it more flexible. My First C program!