GrabText, Version 1.0, April 1991
A Mouse Cut-And-Paste Utility for IBM-PC's and compatibles
Copyright (C) 1991 Scott Drellishak
All Rights Reserved
From perusing other programs' documentation, I gather that
I should say that IBM and IBM-PC are registered trademarks
of International Business Machines, Inc. If I've missed any
other trademarks, I hope that whoever owns them forgives me.
GrabText is a TSR program which allows you to grab text from
the screen and then send it as if you had typed the characters
from the keyboard. It was inspired by the cut-and-paste
abilities of the xterm terminal emulator (which is part of
the X Window System, which is probably a registered trademark
of either MIT or DEC). This program is the answer to a long-
standing question for most PC users with mice: "What good
is my mouse when many programs don't support one?"
GrabText is free, and freely distributable. However, if
you use the program a lot and like it, please consider sending
a donation to the address below (read the section "Begging
The "GrabText.com" program, when run, loads itself into memory,
and you're all set. It uses about 6k of memory (this would
be less if I had written it in assembly language rather than
C. Maybe in a future version). It has two command-line options:
GrabText [-safe] [-off]
"GrabText -safe" turns off the text-mode mouse cursor during
highlighting. This assures that reverse-video junk is not left
on the screen when the user moves the mouse while selecting a
region of text, a probelm which occurs on slower machines.
If you see this mess on your screen when using GrabText with
no command-line options, use the -safe option.
"GrabText -off" starts up GrabText with the mouse cursor off,
rather than on. This is useful if your autoexec.bat startup
file prints out enough stuff to make the screen scroll (see
below for a note about the mouse cursor and scrolling).
"GrabText -safe -off" and "GrabText -off -safe" do exactly
what you think.
GrabText will only work in text modes. When the computer
enters a graphics mode, GrabText will not operate. This is
necessary because (a) I didn't want GrabText to interfere
with programs which actually use the mouse, many of which
run in graphics modes, and (b) there's no way to grab text
off the screen when the text is in fact a bunch of pixels.
Pattern matching fonts is a little beyond the scope of a
After GrabText is running, the mouse buttons perform the
Left Button: Select text
Right Button: Paste text into the keyboard buffer
Middle Button: Toggle cursor on an off
For those of you without a middle button, what were you thinking
when you bought your mouse? In any case, you can toggle the
cursor on and off by pressing the left and right buttons
simultaneously. Note that if the cursor is off and you press
the left button to select some text, the cursor automatically
comes back on.
To select text, position the mouse cursor at one end of the text
you want to highlight, press the left button, and drag the cursor
until the section of text you wish to select is highlighted.
When you release the left button, the selected text will flash
several times, and the highlighting will disappear. If you wish
to select a single word (made up of alphanumeric characters),
double-click on the word with the left button. Now, you can
paste the selected text into the keyboard buffer, just as if
you had typed the text in from the keyboard, by pressing the
right button. Note that you can paste the selected text any
number of times, until you select another block with the left
For those of you who worry, yes, you can select a block of text
bigger than the keyboard buffer without overflowing, as long
as the program running is reading keystrokes. For instance,
if you're in the terminal mode of your favorite communications
program, you can select a big block of text and send the whole
thing at once, since GrabText only sends a few characters of the
selected text every clock tick (an 18th of a second, if I recall).
All but the most cheesily written programs should read characters
faster than this, so, no overflow. However, GrabText's internal
buffer is 512 bytes long, so you can never grab more that 512
characters, even if more that 512 are highlighted.
And there you have it.
versions [0.0, 1.0) -- Didn't work right.
version 1.0 -- Works fabulously well
Interesting Stuff, and Caveats
Rather than have the usual "answers to frequently asked (but
really simple minded) questions" list here, I'll give you a
quickie overview of how GrabText works, so you can answer
the questions yourself.
GrabText reads characters directly from the frame buffer of
the screen. This means that you get exactly what you see on
the screen. Among other things, this means you can't have
GrabText send function key combinations (unless you get really
clever, and put NULs into the frame buffer directly, or some-
thing). If you try to pick up more that one line of text, you
also get all the spaces on the beginning and end of the lines,
and there is no newline put in if you wrap around the edge of
the screen. Perhaps in a future version I'll fix it so that
it stops at the end of each line and inserts a newline, like
GrabText inserts characters directly into the keyboard buffer
currently in use by the BIOS, which is pointed to by two
pointers in low memory whose exact addresses escape me.
Look it up in that book with that "Look, my arms are folded"
guy on the cover. Since it only pastes one character per
clock tick, you can hold down a key and paste a chunk of
text, and have the keyboard characters in between the
pasted text. I consider this a big feature, and so should
Since the mouse cursor in text modes is created by reverse-
videoing a character cell, the highlighting can interfere
with the cursor in cases where you move the cursor faster
than the highlight updates (this is pretty fast, even on
a slow machine). But, if you time it just right, you can
make the cursor leave highlight-garbage on the screen.
If you use the -safe option, this problem goes away, but
be aware that the cursor is no longer visible when you
select text, so the size of the highlighted area will be
one character cell different when the -safe option is
used. This isn't too much of a problem if you either
use or don't use -safe consistently, but it can be dis-
concerting if you switch it on and off.
It turns out that if the screen scrolls while the mouse
cursor is visible, the visible cursor gets moved up one line,
and this never gets erased (try it yourself to see what I
mean). I could find no solution to this problem, except
to catch the BIOS screen scrolling call, and turn the mouse
cursor off during a scroll. Unfortunately, scrolling is
one of the things handled by screen device drivers like
ANSI.SYS, so this solution only works when no such device
driver is loaded. If anyone has a solution to this problem
(specifically, how can I know when the screen is scrolling
regardless of whether it's due to a BIOS call, or a device
driver?), you can contact me at either of the addresses
below. Help is greatly appreciated.
Begging and Stuff
I originally wrote this program to pass the time and
learn how to do TSRs in C, but I liked it so much that
I debugged it and made it not crash (which is no small
task when you can't even send a printf message to the
screen for debugging). I'm releasing this as "begware".
That is, I worked quite a bit on this program, and if
you like it, I'd appreciate it if you'd send cash or check
827 Santa Anita Ave.
San Marino, CA 91108
Internet mail: [email protected]
I suggest 10 dollars, but it's up to you. You are under
no obligation to do so -- the donation is purely voluntary.
I put that "Copyright...All Rights Reserved" at the top
because it seemed like a good idea, but you are free to
distribute this by any means you like, as long as you
(a) include this documentation file with the program when
you distribute it, (b) do not, in any way, alter this
file or the GrabText program (GRABTEXT.COM), and (c) do
not charge more than the cost of packaging the program,
if you are distributing it on disk or other media. I'd
really appreciate it if you'd spread this program around,
either on bulletin boards, networks, or by sneakernet.
This is the first released version of GrabText, so
expect bugs. The likelihood of there being more versions
without those bugs, and more features, depends on the
generosity of users like you (hint, hint). If no one
expresses an interest, I probably won't spend the time
(unless I get really bored).
Finally, please be aware that GrabText has NOT been tested
extensively, because I don't have the machines or the software
to test all sorts of odd permutations and combinations. If
you use the program, you run the risk of it, say, getting
confused by the network driver you have running, and erasing
the contents of your harddisk at an innopportune time.
I AM NOT RESPONSIBLE FOR ANY DAMAGE CAUSED BY THIS PROGRAM.
Be especially careful when using other TSR programs that use
the timer interrupt, other programs that play games with the
keyboard buffer, and other programs that use the mouse.
You should also be aware that there are bad people out there
who will ignore part (b) above and put a virus into this program
-- if you don't check the program for viruses, logic bombs,
trojan horses, etc. before you run it, don't blame me if
there is one. Basically, run this program at your own risk.
GOOD LUCK! GOOD GRABBING! SEND MONEY!