home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!walter!att!rutgers!news.cs.indiana.edu!nstn.ns.ca!dragon.acadiau.ca!890491g
- From: 890491g@dragon.acadiau.ca (Don Graves)
- Newsgroups: alt.msdos.programmer
- Subject: Re: Keyboard Interrupt
- Message-ID: <1992Aug28.164046.744@dragon.acadiau.ca>
- Date: 28 Aug 92 16:40:46 GMT
- References: <g89f2900.4.714907231@giraffe.ru.ac.za> <1992Aug27.210232.5967@ncsu.edu>
- Organization: Acadia University
- Lines: 105
-
- dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL) writes:
-
-
- >In article <g89f2900.4.714907231@giraffe.ru.ac.za>, g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP) writes:
- >|> Hi
- >|>
- >|> I am trying to write program which reads the keyboard buffer, before the
- >|> command.com interrupter does.
- >|> In other words
- >|> I want to write a program that if certain keywords are typed in it will go
- >|> and do some function.
- >|> otherwise it must act as normal.
- >|>
- >|> eg
- >|> enter CLS
- >|> I want it to first do the normal clearscreen
- >|> but afterwards it must print my name and time and other tings on the top
- >|> of the screen.
- >|> ( I will write the program that prints my name and other things )
- >|> ( But I need to know how to link in the keyboard interrupt so )
- >|> ( that when it reads CLS if first does CLS and then comes and )
- >|> ( executes my program. )
- >|>
- >|> OR
- >|> enter TIME
- >|> I want it to ask me if I want to change the time or just display it.
- >|> THEN it must go and do the NORMAL time function.
- >|> ( same applies here I will write the program but how do I )
- >|> ( link it into the keyboard interrupt )
- >|>
- >|> Does anyone know if this is possible ???
- >|>
- >|> PLEASE I HAVE BEEN TRYING FOR +/- 4 mths. BUT no-one I have asked knows
- >|> what to do or even how to HELP
- >|>
- >|>
-
- >Hi. This seems rather difficult to do with a keyboard intercept, partly because
- >it would be difficult to determine whether or not you're sitting at a
- >COMMAND.COM C:\> prompt or in an application program. What I would suggest is
- >this: take a disk editor and "hack" up COMMAND.COM -- find where in the file it
- >stores its command table, and replace maybe the first letter of each command
- >you want to change with an underscore (or whatever character you want to use --
- >just be sure it's some character allowed in a filename). So let's say you've
- >changed "TIME" and "CLS" to "_IME" and "_LS". Now create some batch files
- >called "TIME.BAT" and "CLS.BAT" that say something like the following:
-
- >CLS.BAT:
- >_ls
- >echo Hi. This is my computer. Hope you enjoy it.
-
- >TIME.BAT:
- >echo Hi. Do you want to change the time? (Y/N)
- >yesno
- >if errorlevel 1 goto settime
- >_ime<newline.txt
- >goto end
- >:settime
- >time
- >:end
-
- >In addition, you'll need to create a file with a single blank line called
- >"newline.txt" (or whatever you want to call it) that when fed into the standard
- >input of the _IME command will do the same thing as pressing <Enter> at the
- >"Enter new time" prompt. You'll also need to find or write a short program
- >that waits for a Y or N to be pressed on the keyboard and returns exit code 1
- >if Y or y pressed, otherwise exit code 0. But this shouldn't be too hard to
- >write. (I suppose a lot easier than writing a keyboard interrupt handler to
- >do all this!) :-)
-
- >Hope this helps.
-
- >Tschuess,
- >David Paschal
-
- Another thing that you might try is adding time and date variables in your
- prompt statement. For example,
- prompt $t $d $P$G
- will give you the prompt:
- <time> <date> C:\>
- There is a way to make it so that you time and date always appears at the top
- of the screen (or anywhere on the screen) by issuing the proper strings within
- your prompt statement. Your DOS manual has all of the possible strings, but
- I do remember using them in the form
- prompt $e[
- or something like that. I really can't remember any particular command string
- (escape sequence is what they're called) and I wish I could because it would be
- more of a help to you. But at least it's something you could check out.
- I remember there being a sequence that allows you to put the cursor anywhere
- on the screen. When I made my time prompt, all I did was add strings that
- saved the current cursor position, moved the cursor to the desired location,
- display the time/date/my name (in whatever color I wanted), then a command t
- o put the cursor back where it was in the first place. You can make some
- nice prompt displays this way (make the whole screen color, display the path
- and drive at the top of the screen, but use a > as the user prompt, etc.)
- Anyway, give it a try.
- -Sorry for the vague description, but my manuals and DOCs (and memory) are not
- here to help me.
-
-
- --
- --
- Don Graves
- Acadia University, Wolfville, N.S. Canada
- don.graves@dragon.acadiau.ca || 890491g@ace.acadiau.ca
-