[comp.sys.mac] e-mail database for the Mac

jdm@boulder.Colorado.EDU (James D. Meiss) (10/15/89)

	I'm looking for a database that I can use to store my e-mail
messages in. What I envision is a program that will strip all the extraneous
lines from a downloaded mail file, putting each message in a record but
keeping only the "from", "subject" and "date" lines (deleting the
sometimes ridiculously long chain of transfers for the messages).
It should store these and the message body itself as separate fields.
Of course I would like sorting by name, date, searches on subjects etc.
Display could be 1) like the usual unix "h" list,2) then if you double
click on a message a new window could open displaying the message. I
guess this is kind of like endnote's method of displaying a bibliography.

	Of course if I could send and receive mail from the Mac too...
I guess this is what UUPC is for.
	Such a nice display exists for Sun's I think....if it doesn't exist
for the Mac, I may write it....given the time...

									
		Jim Meiss	
		jdm@euclid.Colorado.edu

nobody@network.ucsd.edu (Unprivileged User) (10/30/89)

> From article <12767@boulder.Colorado.EDU>
> by jdm@boulder.Colorado.EDU (James D. Meiss)
>
>	I'm looking for a database that I can use to store my e-mail
>messages in. What I envision is a program that will strip all the extraneous
>lines from a downloaded mail file, putting each message in a record but
>keeping only the "from", "subject" and "date" lines (deleting the
>sometimes ridiculously long chain of transfers for the messages).
>It should store these and the message body itself as separate fields.
>Of course I would like sorting by name, date, searches on subjects etc.
>
From: jon@HP-UX.ucsd.edu (Jon Matousek)
Path: HP-UX!jon

I know that people normally would not consider a word processor to
handle such a task as the one described above but I have been
using Nisus to do some interesting things with e-mail.

Table of contents:
-DELETING UNWANTED E-MAIL HEADER FIELDS:
-CHARACTER STYLE MODIFICATIONS OF E-MAIL FIELDS:
-REFORMATTING comp.sys.mac.digest:
-FILE MANAGEMENT with comp.sys.mac.digest:
-SEARCHING E-MAIL FIELDS:
-SEARCHING BY "KEY WORD IN CONTEXT" (KWIC):
-SOME IDEAS ON SORTING:


DELETING UNWANTED E-MAIL HEADER FIELDS:
One thing that I do is remove fields in my e-mail that I do not really 
care about. (The following example will actually delete the field, if
you only want to hide the field from view then see the CHARACTER STYLE...
section below.) The way to do this in Nisus is to use GREP and the
Find/Replace command. For example, if you wanted to remove ALL of
the e-mail transfer fields from a file then the following line in a
Nisus Macro will work:

Find/Replace "Received\:.:*\r\(:^\t.:*\r\)*" "" "gaWo"

NOTE: The Find/Replace... dialog will work as well with the same
regular expression (GREP stuff) and clicking the Replace All button.
In other words you don't have to use a macro to accomplish this.
(QUED/M users can use the Change dialog.)

In short, the regular expression between the first set of quotes finds
the first line of the "Received:" field followed by 0 or more tab indented
lines. Since the second set of quotes contains nothing the match is
replaced with nothing, removing it from the document. The final set of
quotes are options for Find/Replace: g-use GREP, a-all occurrences,
W-wrap around search, o-enforce search for text only (ignores character 
style attributes of text.)

A somewhat simpler example would be to delete the Return-Path field. The
following line in a Nisus Macro will work:

Find/Replace "Return\-Path\:.:*\r" "" "gaWo"



CHARACTER STYLE MODIFICATIONS OF E-MAIL FIELDS:
Something else I like to do with fields that I want to keep is make them
stand out from the rest of the text. I do this by changing the character
style of the fields to a larger point size and making the text BOLD. The
Find/Replace command is used again to accomplish this. The first step is to
enter the following line in a Nisus Macro:

Find/Replace "Subject\:.:*$" "&" "gaWo"

The ampersand in the second set of quotes is a metacharacter that means
replace what was found by what was found (keep reading) with the 
addition of adding all the character styles of the ampersand to the
replaced text.

So, the second step is to select the ampersand (in the above macro line) and
go to the menus and select the font, size and styles you want to impart
on the found text. (If you select the Invisible Text style then the
field would become hidden from view, but not deleted.) The ampersand
will now be in the style you want the matched fields to be in and when 
the line above is executed every field matched will have the same
character styles as the ampersand.



REFORMATTING comp.sys.mac.digest:
Using the above approach I have developed a Nisus Macro for
comp.sys.mac.digest.  In addition to changing the character style
attributes of certain fields, the macro makes a marker out of every
"Subject:" field. Since markers are placed directly on the Search menu
in Nisus, articles can be easily accessed--the insertion point jumps to
where the marker is in the document when a marker is selected from the
search menu. At the same time markers are being created a contents selection
is done on the "Subject:" field of each article so that a table of
contents can be made that contains the actual page numbers the articles
appear on. The old table of contents is then removed and the new one
with the page numbers replaces it. One header is created 
that appears on every page, containing the page number and the
title of the digest.

And as a final touch,...

FILE MANAGEMENT with comp.sys.mac.digest:
After the article has been reformatted the macro renames the digest to
its volume and issue number, and saves it in a folder named with the month and
year the article was posted. The Nisus Macro lines that accomplish
this are the following:

Find Next ":^Info\-Mac Digest.:*:#+.:*\(:a+.:*:#+\).:*\(:a.:*\)\:\(.:*\)$" "gWo"
Save ':\1:\2-\3'

The "Find Next" above will find the line in a digest article that looks
like this:

"Info-Mac Digest             Wed, 27 Sep 89       Volume 7 : Issue 170"

The "Save" will save the article in a folder named "Sep 89" under the
name "Volume 7 - Issue 170". If the folder named "Sep 89" does not
already exist Nisus will create it!



SEARCHING E-MAIL FIELDS:
Another Nisus Macro I have is one that searches on the subject field.
It first prompts the user for a word to look for in the subject field
and then uses the find next command to accomplish the search. This macro
is the following:

#Select Clipboard 9
Clipboard 9
#Ask what word to search for. Automatically records the response
#in the current clipboard--in our case clipboard number 9.
:1 "Search for what word?" ""
#execute the search with the Find Next command. (Notice the single quotes.)
Find Next 'Subject\:.:*\C9.:*$' "igWo"

In short, the Find Next searches for the "Subject:" field, followed by 0 or
more characters (.:*), followed by the contents of clipboard 9 (\C9),
followed by 0 or more characters and finally followed by the end of a line ($).
The "i" in the options field (second set of quotes) specifies a case
independent search.

Since Nisus allows you to search unopened documents as well, this can
be a very powerful utility.



SEARCHING BY "KEY WORD IN CONTEXT" (KWIC):
The final set of macros that I will discuss are my KWIC Nisus macros. These
macros are similar in functionality to the hypercard stack Texas, by
Scott Zimmerman.

The following describes the actions of my KWIC Nisus macros:
To make a KWIC for a single keyword one presses the
command (clover key) modifier and double-clicks on the keyword. A macro
with the name "Command" is executed. This macro finds every occurrence
of the selected keyword, extracting 30 characters and one word of
context on each side of the keyword; all of the extractions are appended
to a clipboard. A Nisus Stationary file that was previously created for
displaying KWICs is then opened and the contents of the clipboard is
pasted into this new document. Each line of KWIC in the document has all
of its original formatting (tabs, carriage returns, etc.) placed in invisible
text so they do not appear in the KWIC display document, all you see is
a single line for every KWIC, with every keyword aligned to the center
of the document and the context appearing to the left and right of the
center.  The following two lines of KWIC is how a KWIC display might look
for the keyword "macro":

   Nisus has fully editable, integrated macros that can be recorded as well.
              InitInit is the name of a macro that executes on start up of
                                       ^^^^^^^

Also, each line of KWIC contains the full path, in invisible text,
to the document where they were extracted from so when one presses the option
modifier key and double clicks on a KWIC line, a macro named "Option" is
executed and the full path of the document is used to open the document.
A literal search with the text of the KWIC is used to find the reference in the
document. 



SOME IDEAS ON SORTING:
Nisus has a Sort Paragraphs command that can be used for limited types
of sorting (it uses a modified quick sort). I imagine that one could create
a macro to extract information from fields and arrange the information 
for sorting purposes. I will have to try it to be sure but I don't think
that it would be to hard to make a permuted arrangement of the "Subject:"
field, append the full path to the file where the permute was
extracted and do a sort on it. The interface for retrieval would be
something like what I described above when the option-double-click was
used to retrieve a KWIC reference.



Let me know if there are any questions about anything in this article,
I would be more than happy to discuss it.

-jOn

========================================================================
The preceding posting, with all of its truths or otherwise, is do
entirely to my mischievous undertakings and has nothing whatsoever to do with
Paragon Concepts, Inc.
========================================================================