🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
3 messages
3 total messages Started by MR BRI FAWTHROP Thu, 27 Aug 1992 09:20
Keyboard Interrupt
#331
Author: MR BRI FAWTHROP
Date: Thu, 27 Aug 1992 09:20
34 lines
1537 bytes
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

Barry Fawthrop.
g89f2900@giraffe.ru.ac.za
  
Re: Keyboard Interrupt
#335
Author: DAVID SCOTT PASCHAL
Date: Thu, 27 Aug 1992 21:02
85 lines
3889 bytes
In article <g89f2900.4.714907231@giraffe.ru.ac.za>, g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP) writes:
|> Path: taco!rock!stanford.edu!ames!haven.umd.edu!uunet!zephyr.ens.tek.com!psgrain!hippo!bs-pc3-06.ru.ac.za!g89f2900
|> From: g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP)
|> Newsgroups: alt.msdos.programmer
|> Subject: Keyboard Interrupt
|> Message-ID: <g89f2900.4.714907231@giraffe.ru.ac.za>
|> Date: Thu, 27 Aug 92 05:20:31 GMT+5:00
|> Sender: news@hippo.ru.ac.za
|> Organization: Rhodes University, Grahamstown, South Africa
|> Lines: 34
|> 
|> 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
|> 
|> Barry Fawthrop.
|> g89f2900@giraffe.ru.ac.za
|>   
|> 

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
Re: Keyboard Interrupt
#339
Author: Don Graves
Date: Fri, 28 Aug 1992 16:40
105 lines
4879 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads