home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / n / notebk1f.zip / EXCODE10.ZIP / EXITCODE.TXT < prev   
Text File  |  1993-02-10  |  2KB  |  82 lines

  1. Exit Code
  2. by Mark Berlinger
  3. Version 1.0 2/10/93
  4. Copyright(c)1993 Mark Berlinger
  5.  
  6. This variable delay program sets the exit code to the code of the key that
  7. was pressed before the normal timeout.  Pressing a key before the normal
  8. timeout immediately ends the program.  The timeout is from one to ninety-
  9. nine seconds with five seconds being the default.  The user can customize
  10. a batch file to test the exit code to make a conditional branch.
  11.  
  12. The last character or last two characters of the command tail are
  13. normally numbers.  The numbers determine the timeout.  The command tail
  14. is output to the monitor along with the count.  If there is no command
  15. tail, or if the last two characters of the command tail are not numbers,
  16. or if the last two characters are not numbers between one and ninety-nine,
  17. then the default timeout is five seconds.
  18.  
  19. The hexadecimal return code is shown in place of the count when a key is
  20. pressed before the normal timeout.
  21.  
  22. This example uses a command tail string.
  23.  
  24.     C:\>EXITCODE Run Windows in 15
  25.      Run Windows in 12_
  26.  
  27. This demonstrates using only numbers in the command tail.
  28.  
  29.     C:\>EXITCODE 10
  30.       7_
  31.  
  32. Without a command tail the delay defaults to 5 seconds.
  33.  
  34.     C:\>EXITCODE
  35.      2_
  36.  
  37. Here is an example that uses EXITCODE in a batch file to bypass Windows
  38. when any key is pressed before the five second timeout.
  39.  
  40.     C:\BATCH\EXITCODE Run Windows in 5
  41.     if errorlevel 1 goto bypasswin
  42.     win
  43.     :bypasswin
  44.  
  45. Here is a more complex example of how EXITCODE can be used to control the
  46. batch file program flow.  The numbers after errorlevel are decimal.  Note
  47. in this example that the errorlevel 13 line is true if the enter key is
  48. pressed which enables an immediate jump to the windows label.
  49.  
  50.     @echo off
  51.     .
  52.     .
  53.     .
  54.     D:\BATCH\EXITCODE Run Windows or w = WordPerfect or x = Xtree 15
  55.     if errorlevel 121 goto dosprompt
  56.     if errorlevel 120 goto xtree
  57.     if errorlevel 119 goto wordperf
  58.     if errorlevel 14 goto dosprompt
  59.     if errorlevel 13 goto windows
  60.     if errorlevel 1 goto dosprompt
  61.     :windows
  62.     rem Set 500 locks for ACCESS:
  63.     c:\dos\share.exe /L:500
  64.     win
  65.     goto done
  66.     :wordperf
  67.     wp
  68.     goto done
  69.     :xtree
  70.     xtg
  71.     :done
  72.     c:\dos\chkdsk
  73.     :dosprompt
  74.  
  75. If you find this program to be useful, then please send six dollars US to:
  76.  
  77.   Mark Berlinger CIS 70134,3016
  78.   1317 N. San Fernando Blvd. #133
  79.   Burbank, CA 91504
  80.  
  81. I'll return the source code and a registered version on a 3-inch diskette.
  82.