home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2283 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  4.7 KB

  1. Path: sparky!uunet!walter!att!rutgers!news.cs.indiana.edu!nstn.ns.ca!dragon.acadiau.ca!890491g
  2. From: 890491g@dragon.acadiau.ca (Don Graves)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: Keyboard Interrupt
  5. Message-ID: <1992Aug28.164046.744@dragon.acadiau.ca>
  6. Date: 28 Aug 92 16:40:46 GMT
  7. References: <g89f2900.4.714907231@giraffe.ru.ac.za> <1992Aug27.210232.5967@ncsu.edu>
  8. Organization: Acadia University
  9. Lines: 105
  10.  
  11. dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL) writes:
  12.  
  13.  
  14. >In article <g89f2900.4.714907231@giraffe.ru.ac.za>, g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP) writes:
  15. >|> Hi
  16. >|> 
  17. >|> I am trying to write  program  which reads the keyboard buffer, before the 
  18. >|> command.com interrupter does.
  19. >|> In other words
  20. >|> I want to write a program that if certain keywords are typed in it will go 
  21. >|> and do some function.
  22. >|> otherwise it must act as normal.
  23. >|> 
  24. >|> eg
  25. >|>  enter CLS
  26. >|>    I want it to first do the normal clearscreen 
  27. >|>    but afterwards it must print my name and time and other tings on the top 
  28. >|>    of the screen.
  29. >|>         ( I will write the program that prints my name and other things )
  30. >|>         ( But I need to know how to link in the keyboard interrupt   so )
  31. >|>         ( that when it reads CLS if first does CLS and then comes and   )
  32. >|>         ( executes my program. )
  33. >|> 
  34. >|>  OR
  35. >|>  enter TIME
  36. >|>    I want it to ask me if I want to change the time or just display it.
  37. >|>    THEN it must go and do the NORMAL time function.
  38. >|>           ( same applies here I will write the program but how do I )
  39. >|>           ( link it into the keyboard interrupt )
  40. >|> 
  41. >|> Does anyone know if this is possible ???
  42. >|> 
  43. >|> PLEASE I HAVE BEEN TRYING FOR +/- 4 mths. BUT no-one I have asked knows
  44. >|> what to do or even how to HELP
  45. >|> 
  46. >|> 
  47.  
  48. >Hi.  This seems rather difficult to do with a keyboard intercept, partly because
  49. >it would be difficult to determine whether or not you're sitting at a
  50. >COMMAND.COM C:\> prompt or in an application program.  What I would suggest is
  51. >this: take a disk editor and "hack" up COMMAND.COM -- find where in the file it
  52. >stores its command table, and replace maybe the first letter of each command
  53. >you want to change with an underscore (or whatever character you want to use --
  54. >just be sure it's some character allowed in a filename).  So let's say you've
  55. >changed "TIME" and "CLS" to "_IME" and "_LS".  Now create some batch files
  56. >called "TIME.BAT" and "CLS.BAT" that say something like the following:
  57.  
  58. >CLS.BAT:
  59. >_ls
  60. >echo Hi.  This is my computer.  Hope you enjoy it.
  61.  
  62. >TIME.BAT:
  63. >echo Hi.  Do you want to change the time? (Y/N)
  64. >yesno
  65. >if errorlevel 1 goto settime
  66. >_ime<newline.txt
  67. >goto end
  68. >:settime
  69. >time
  70. >:end
  71.  
  72. >In addition, you'll need to create a file with a single blank line called
  73. >"newline.txt" (or whatever you want to call it) that when fed into the standard
  74. >input of the _IME command will do the same thing as pressing <Enter> at the
  75. >"Enter new time" prompt.  You'll also need to find or write a short program
  76. >that waits for a Y or N to be pressed on the keyboard and returns exit code 1
  77. >if Y or y pressed, otherwise exit code 0.  But this shouldn't be too hard to
  78. >write.  (I suppose a lot easier than writing a keyboard interrupt handler to
  79. >do all this!)  :-)
  80.  
  81. >Hope this helps.
  82.  
  83. >Tschuess,
  84. >David Paschal
  85.  
  86. Another thing that you might try is adding time and date variables in your
  87. prompt statement.  For example, 
  88. prompt $t $d $P$G
  89. will give you the prompt:
  90. <time> <date> C:\>
  91. There is a way to make it so that you time and date always appears at the top
  92. of the screen (or anywhere on the screen) by issuing the proper strings within
  93. your prompt statement.  Your DOS manual has all of the possible strings, but
  94. I do remember using them in the form
  95. prompt $e[
  96. or something like that.  I really can't remember any particular command string
  97. (escape sequence is what they're called) and I wish I could because it would be
  98. more of a help to you.  But at least it's something you could check out.
  99. I remember there being a sequence that allows you to put the cursor anywhere
  100. on the screen.  When I made my time prompt, all I did was add strings that
  101. saved the current cursor position, moved the cursor to the desired location,
  102. display the time/date/my name (in whatever color I wanted), then a command t
  103. o put the cursor back where it was in the first place.  You can make some
  104. nice prompt displays this way (make the whole screen color, display the path
  105. and drive at the top of the screen, but use a > as the user prompt, etc.)
  106. Anyway, give it a try.
  107. -Sorry for the vague description, but my manuals and DOCs (and memory) are not
  108. here to help me.
  109.  
  110.  
  111. -- 
  112. --
  113. Don Graves
  114. Acadia University, Wolfville, N.S. Canada
  115. don.graves@dragon.acadiau.ca || 890491g@ace.acadiau.ca
  116.