Contents:
The Quoteriser's random signature generator is a powerful utility for inserting random quotes into e-mail and Usenet signatures, or, indeed, any other (plain text) file the user cares to use it for.
(It can also be used as a text-based quote-of-the-day facility - though the PM-based qotd.exe program looks a lot better, and Unix 'fortune' is probably easier to use for this purpose.)
The program is a command-line utility that works by taking a template file as input that describes the layout of the signature, inserting random quotes where specified and writing the output to a file.
After unzipping the quot210x.zip
package (or compiling the source
in the quot210s.zip
package, for do-it-yourselfers), the
sig
application will be present in the 'bin' sub-directory.
This is the executable the user will need to run to generate random signatures.
As the OS/2 version uses the Quoteriser DLLs (quoter1.dll
,
quoterdb.dll
and quoterla.dll
), either it must be run
in this directory or the Quoteriser DLLs must be in a directory on the system
LIBPATH statement in CONFIG.SYS
.
To set the databases used for choosing random quotes, set the QUOTER_QDB and QUOTER_ADB environment variables. The former must be set as the name of the quote database - without extension - from which to choose random quotes. The QUOTER_ADB variable is optional; if not set, no authors will be associated with the quotes. Otherwise, it should be name of the author database - again, without extension - from which to draw author information. Under OS/2, these variables can be set with the following two lines, either in the system's CONFIG.SYS file, or in a batch file that runs the sig program:
SET QUOTER_QDB=D:\APPS\QUOTERISER\DATA\CYNICISM SET QUOTER_ADB=D:\APPS\QUOTERISER\DATA\STANDARD
This will choose quotes from a database called 'cynicism' in the
D:\APPS\QUOTERISER\DATA
directory, and get author information from
a database called 'standard' in the same directory. As usual, any changes made
to CONFIG.SYS
will require a re-boot to take effect. Other systems
are similar.
Next, the reader will probably want to create at least one template file. See the template file section below for details on how template files are formatted.
Finally, the reader may want to automate the running of sig. There are a
variety of ways in which this could be done. E.g. the reader could put it into
a batch file to run every time his or her e-mail program runs, or put it in
STARTUP.CMD
(OS/2) to choose a new signature at every boot, or use
a scheduling application to choose a new signature every five minutes (say).
There are some examples in the Using sig section
below.
The command-line format for sig is:
sig [options] <template> [<signature1>] [<signature2>] ...
where <template>
is the name of the (input) template file,
and the <signatureN>
's are the names of the (output)
signature files. If there are no signature files specified, the result will be
printed to standard output (i.e. on the screen, or to a pipe or re-director if
present on the command line); otherwise, a signature will be randomly generated
for each signature file using the specified template.
Valid options are:
Not all combinations of options make sense, though the program will come up with some result that makes sense to it, anyway.
See the template file section below for details on how to create template files.
The following sections give some instructions for how to use sig with various
OS/2 applications, and some examples of using sig in different ways. Unless
otherwise noted, the template file is assumed to have the name
C:\ETC\TEMPLATE.TXT
- of course, it can be any valid file. The
Quoteriser is assumed to be installed in C:\APPS\QUOTER
, with
quote database 'QUOTES' and author database 'AUTHORS' in the
C:\APPS\QUOTER\DATA
directory. The examples are not intended to
be blindly copied, only to give an idea of what can be done. Similar ideas can
be used for other systems.
NewsReader/2 stores its signature in a different place depending on how its
connected to the news server. If it's connected via a LAN, it stores them in
the <etc>\sig
directory, where <etc>
is the value of the ETC environment variable. If the connection is via a PPP
connection, they are in <etc>\rnspool\<isp>\sig
,
where <isp>
is the name of the connection. There are
three signature files:
MAIL.SIG
NEWS.SIG
POST.SIG
Therefore, use something like sig c:\etc\template.txt *.sig
to generate random NewsReader/2 signatures, where *
is one of
MAIL
, NEWS
or POST
, as required.
Example: Suppose the ETC variable is 'C:\ETC', we want to
generate new random signatures every time NewsReader/2 is started, and
we want a different quote for our mail and news signatures. The environment
variables have not been set in CONFIG.SYS
.
Create a batch file, nr2.cmd
, say, in the C:\TCPIP\BIN
directory (or wherever NewsReader/2 is), with the following:
@ECHO OFF SET QUOTER_QDB=C:\APPS\QUOTER\DATA\QUOTES SET QUOTER_ADB=C:\APPS\QUOTER\DATA\AUTHORS CD \APPS\QUOTER\BIN SIG C:\ETC\TEMPLATE.TXT C:\ETC\SIG\MAIL.SIG C:\ETC\SIG\POST.SIG CD \TCPIP\BIN NR2 %1Then replace
NR2.EXE
in the NewsReader/2 desktop object properties
with NR2.CMD
.
Pine allows the user to define the name of his or her signature file
either by entering configuration from the main screen, or by editing
the signature-file
field in pinerc
. If our
our signature file is C:\TCPIP\PINE\SIG.TXT
, for example,
we can use sig c:\etc\template.txt c:\tcpip\pine\sig.txt
to generate a random signature.
Example: Suppose we want to generate a new signature every five
minutes, using our favourite scheduling program. The environment
variables have been set in CONFIG.SYS
. This author can't tell
the reader how to use his or her favourite scheduling program, of course, and
assumes the reader knows how to get it to run a program every five minutes.
Create a batch file, c:\tcpip\bin\newsig.cmd
, say, containing
the following:
CD \APPS\QUOTER\BIN SIG C:\ETC\TEMPLATE.TXT C:\TCPIP\PINE\SIG.TXT
Then put newsig.cmd
into the scheduling program.
Err... don't know. Ultimail appears to store its signature in the
As OS/2 .INI files are binary files, no amount of processing through sed, pipes
and what-have-you, will be able to sort it out; some programming skill is
necessary. As the author doesn't use Ultimail, he isn't inclined to spend a lot
of time trying to figure it out. Read the .INI file section in the
other applications section and have a go.
For other applications, the reader is on his or her own. The simplest case is
for applications like Pine and NewsReader/2, where the signature is just a text
file somewhere; quite a few applications use this method. In this case, once
the signature file has been identified, it should be easy to set up sig to
write its output to this file.
Some applications might store the signature in a text-based file with some
other things (like a Windows .INI); in this case, some clever use of pipes,
re-direction and possibly REXX, Perl or awk should suffice.
Some applications (like Ultimail) store the signature in an .INI file. This
requires some programming skill. Use IniMaint or something to examine the
.INI file and determine the application name and key for the signature.
Then write a program to put the output from sig into the .INI file. In
C, something along the lines of the following fragment:
... then pipe the output from
Similarly, in REXX:
... and pipe the output from
Finally, some applications might keep the signature in a binary file
of their own format (though the author has never seen such a thing, and
there's no need with the Prf...() API). This requires real tenacity - the
reader will have to decode the binary file and write a program to insert
the signature.
If the reader has developed a solution for any applications not listed here
- even if it's just the name of the file to overwrite - or knows the solution
to Ultimail, he or she is more than welcome to submit the solution to the
author at nps@zeta.org.au. For the
reader's effort, he or she will receive a mention in the credits and the usual
warm, fuzzy feeling that he or she gets from helping the world out.
In case the reader didn't read the introduction, the author will repeat here
that
Create a template file that just prints a quote across the whole screen, e.g.
Then running Using sig with Ultimail
<etc>\TCPOS2.INI
file, where <etc>
is
the contents of the ETC environment variable. The CR/LF pairs seem to have
been replaced with ASCII characters 1 (smiley faces). Don't be fooled by
the \TCPIP\UMAIL\UMAIL.PRO
file - it looks like a nice, text-based
configuration file, but Ultimail appears to create this every time it starts it
from what is in TCPOS2.INI
(no, the author doesn't understand,
either).
Using sig with other applications
hini = PrfOpenProfile(hab, "PROFILE.INI"); // or whatever the .INI is called
pszString = strfromf(stdin); // strfromf() is from quoter1.dll
PrfWriteProfileString(hini, "App", "Key", pszString); // or whatever IniMaint found
free(pszString);
sig c:\etc\template.txt
into this program.
/* don't forget the comment at the top */
call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
sig = ''
do while lines()
sig = sig || linein() || x2c('0d 0a')
end
SysIni('PROFILE.INI', 'App', 'Key', sig)
sig c:\etc\template.txt
into
it, as before.
Using sig as a quote-of-the-day
Still, maybe the reader managed to compile sig for a system which doesn't have
a 'fortune' port, doesn't like the quotes in 'fortune', doesn't want to download
1.3 Mb worth of 'fortune' or something.
sig
.
<tr>
<quote colspan=79>
sig c:\etc\template.txt
will show a quote of the day.
If sig
is in the path, and, for OS/2, quoter1.dll
,
quoterdb.dll
and quoterla.dll
are in the LIBPATH, it
won't even be necessary to change to the Quoteriser directory before running.
Template Files
The format for template files is based on HTML tables, taking some liberty with the meaning of tag attributes. The control elements are:
<tr> | Start a new row |
<td colspan=n> | Put the following block of text into a cell n characters wide. |
<quote colspan=n> | Insert a random quote, typeset into a cell n characters wide. |
No other HTML tags are supported; text inside <td> is treated as if it were in a <pre> tag. Only <br> and <p> tags are interpreted in the quote; others are ignored.
Each row will have enough lines in it to accomodate the longest of the cells in it, and be of a width equal to the sum of the colspan attributes of the <td> and <quote> items in that row. There is no limit to the number of rows, or the width of each row (though one supposes that the reader will eventually run out of disk space and/or memory). There is a limit of eighty cells per row, however.
There can be as many random quotes in the signature as the user wishes; each quote will be chosen separately (but there is no safeguard against choosing the same one twice, which looks a bit silly).
E.g. at the time this document was written, the author's template file was
<tr> <td colspan=40>-- Location: Sydney, Australia | / Email: nps@zeta.org.au | / WWW: http://www.zeta.org.au/~nps | -- ----> Cynicism & Negativity | <quote colspan=39>
which will produce an output something like
-- Location: Sydney, Australia | HAMLET: To be or not to be: that is / E-mail: nps@zeta.org.au | the question / WWW: http://www.zeta.org.au/~nps | -- ----> Cynicism & Negativity | - William Shakespeare, Hamlet
Maybe the reader prefers to the quote to be appended to his or her details. In this case, he or she might try something like:
<tr> <td colspan=79>James Hacker (jhacker@yoyodyne.com) - author of Gnomovision Make a pass at your compiler today! - http://www.yoyodyne.com/gnomovision <tr> <quote colspan=79>which will give an output something like
James Hacker (jhacker@yoyodyne.com) - author of Gnomovision Make a pass at your compiler today! - http://www.yoyodyne.com/gnomovision Ask not what your country can do for you, but what you can do for your country. - John F. Kennedy
We could put our quote inside a box:
<tr> <td colspan=79>+-----------------------------------------------------------------------------+ <tr> <td colspan=2>| | | | <quote colspan=75> <td colspan=2>| | | | <tr> <td colspan=79>+-----------------------------------------------------------------------------+
(Making sure that the two side cells are high enough to make the box join up for any quote in our database). The output will be something like:
+-----------------------------------------------------------------------------+ | Well may we sing 'God Save the Queen', because nothing will save the | | Governor-General. | | | | - Gough Whitlam | +-----------------------------------------------------------------------------+
We can increase our wit/wisdom-per-mail rate by having two (or more) random quotes:
<tr> <td colspan=11>He said: <quote colspan=68> <tr> <td colspan=11>So I said: <quote colspan=68>Which gives us (using -a- -s- to keep it brief):
He said: I have nothing to declare but my genius. So I said: And therefore never send to know for whom the bell tolls; It tolls for thee.