Julian Thomas' Utilities for ICE
File name |
Description |
| AUTOICE.ZIP
|
Autoice.cmd is a parameter-driven (autoice.prm) rexx program that
periodically dials up your ISP, and runs mr2i to collect (and send any
queued) mail, then disconnects. Useful for vacations or to have your mail
collected before you start work for the day.
Julian Thomas July/November 1997.
To use:
1. Copy all the files into a directory (I use c:/automail).
2. Using the DIALLER.HOW file, build a process for connecting
to your ISP, or use one you have already.
3. Edit autoice.prm to fit your environment and preferences.
4. If you want to do anything else while connected (for instance,
rc5 client updating), edit automail.cmd file to fit (search for
rc5).
5. While not connected to your ISP, and with ICE not active, open a text
window, cd to the automail directory, and run:
automail 2>&1 > logfile
If it fails, the logfile should help determine the problem.
Once it works in test mode and you want to go for real, edit the params
file to set test=0 and the times for invocation to suit your needs.
Again, open a text window, and run automail. It uses the rexx sleep()
function, so will not use cycles except while actually doing work. |
| MSGUTIL.ZIP |
Notes on the use of "On-demand REXX" in mr2ice - msgutil.cmd.
Julian Thomas - October 1997
MR2ICE ships with a useful but almost undocumented (outside of
history.txt) MSGUTIL.CMD facility that allows invocation of an arbitrary
rexx (or other) program when viewing (or composing) a message, by using
Ctrl-F keys. As it ships, 3 of these keys are implemented:
Ctrl-F1: Mime unpack attachment, activate appropriate viewer
Ctrl-F2: Run E.EXE on the msg file
Ctrl-F3 Open the file in netscape (for messages in html).
However, the MSGUTIL.CMD file is meant to be customized by the user. It is
possible to set the default editor, browser, mime viewers by changing
variable definitions near the beginning of the file, and it is also
possible to define additional functions to be invoked in the same fashion.
Much of this does not require a great deal of proficiency in REXX.
I have defined several such additional functions in my own msgutil.cmd
file. There is a section of the original file that reads as follows:
when FKey = 4 then
do
nop
end
when FKey = 5 then
do
nop
end
... F6 - F11 are similar ....
when FKey = 12 then
do
nop
end
This is where you can add your own functions, which can read (and
optionally rewrite) the message file, whose name is in the rexx variable
filename.
For example, I have the following defined:
when FKey = 7 then
do
call "cpymsg" "h:archiv" filename
end
when FKey = 10 then
do
call "namchang" filename
end
cpymsg.cmd is a utility that copies (appending) selected header lines and the
message body to a specified file (in my case, h:archiv); it is useful
invoked either this way or from a demand filter.
namchang.cmd is a utility that I use for outgoing messages to replace my
own name in the "From:" line and the sig with that of my wife. We still
have a single email account, but this way hers appears to come from her and
not from me. The program is available here, but will need to be modified
to reflect your own needs.
There is a general mechanism that is usefil for both filters and msgutil
programs, particularly those that modify a message file and then rewrite
it. I have based this copy mechanism on code by William H. Geiger III
(whgiii) who developed it for use in some of his mr2ice PGP addon
utilities available for those who don't need the full power of his
ESECURE product.
The code follows:
------------------------start code----------------------------
/* Rexx Script to copy and replace an mr2i message */
/* for use by filters and msgutil */
/* adapted by jt from code by William H. Geiger III */
/* whgiii@users.invweb.net */
parse arg msg_filename
'@echo off'
/* define any other useful constants here */
yy1='To:'
yy2='CC:'
yy3='BCC:'
blank=''
outfile='tempiii.out'
st4=SysFileDelete(outfile)
nxy=1
nxz=stream(outfile,'c','open write')
nzz=stream(msg_filename,'c','open read')
/* this block copies the header. It can be modified if header changes are
desired */
do forever while (length(linein(msg_filename))>0) /* pull info from header */
nxx=stream(msg_filename,'c','seek +0') /* get read pointer */
nxx_rs=stream(msg_filename,'c','seek =' nxy) /* reset read pointer */
lin=linein(msg_filename)
lo=lineout(outfile,lin)
nxy=stream(msg_filename,'c','seek +0')
/* examples of looking for specific lines */
xx1=pos(yy1,lin,1)
xx2=pos(yy2,lin,1)
xx3=pos(yy3,lin,1)
If xx1=1 then to=lin
If xx2=1 then cc=lin
If xx3=1 then bcc=lin
end
lo=lineout(outfile,blank)
/* this block copies the msg body */
do forever while lines(msg_filename)
lin=linein(msg_filename)
lo=lineout(outfile,lin)
end /* do */
st1=stream(msg_filename,'c','close')
st3=stream(outfile,'c','close')
st4=SysFileDelete(msg_filename)
'copy' outfile msg_filename
st4=SysFileDelete(outfile)
exit
------------------------end code------------------------------
ENVIRONMENT VARIABLES for filters and msgutil
Nick has defined a number of environment variables that are set when a
message is being processed (either by a filter or when being viewed and
msgutil is active). These are described in the msgutil.org file
distributed with mr2ice:
env = 'OS2ENVIRONMENT' /* Access environment init variables */
/**********************************************************************/
/** Parameter Section - Message Information Passed from MR/2 ICE **/
/**********************************************************************/
/* The section below is COMMENTED OUT to save resources. If you */
/* wish to use one or more of these variables, just uncomment them */
/**********************************************************************/
/*
Subject = value("MR2I.SUBJECT",,env)
ReplyTo = value("MR2I.REPLYTO",,env)
To = value("MR2I.TO",,env)
From = value("MR2I.FROM",,env)
MessageID = value("MR2I.MESSAGE-ID",,env)
InReplyTo = value("MR2I.IN-REPLY-TO",,env)
Editor = value("MR2I.EDITOR",,env)
SerialNumber = value("MR2I.SERIALNUMBER",,env)
Line = value("MR2I.CURRENTLINE",,env)
Column = value("MR2I.CURRENTCOLUMN",,env)
Browser = value("MR2I.BROWSER",,env)
FTPClient = value("MR2I.FTPCLIENT",,env)
CurrentWord = value("MR2I.CURRENTWORD",,env)
Account = value("MR2I.ACCOUNT",,env)
Version = value("MR2I.VERSION",,env)
MarkedBlock = value("MR2I.CURRENTBLOCK",,env)
*/
/*
NOTE that if markedBlock = "@rexx$txt.tmp", then the block was
too big to pass in the environment, and it was instead saved to
the file "rexx@txt.tmp".
*/
|
| CPYMSG.ZIP |
From: "Julian Thomas"
Date: Wed, 09 Jul 97 19:35:36 -0500
Subject: Re: CPYMSG question
In reply t a query:
::last night I received a copy of your CPYMSG.CMD. However, I have some
::doubts about how to implement this function. Could you please give me
::some details? (I'm no REXX nor filter guru!!!)
::I would like to move older messages from f.ex. my MR2ICE folder, and
::append these to an external file, - and strip part of the headers. The
::same will be true for some of my other folders, as well.
::All this will be done manually. I *don't* want it to take place
::automatically on incoming messages.
::As far as I can see, your program will do this trick. The question is,
::how do I setup the filter(s), and how do I initiate the process?
What I would suggest is the following:
1. Edit msgutil.cmd (in yr mr2ice directory) to define one of the unused
keys so that the action changes from:
when FKey = 7 then
do
nop
end
to:
when FKey = 7 then
do
call "cpymsg.cmd" "archiv.fil"
end
be sure that cpymsg.cmd is in your mr2ice directory, and that the
archiv.fil will be ok if it is built there.
2. Now select a msg that you want to archive, open it, and press Ctrl-F7.
3. Verify that it has been copied (with a somewhat stripped header) to
archiv.fil
Once this works to your satisfaction, you can repeat the process for all
msgs you want to archive, and delete them after they have been copied.
Some versions of mr2i have a problem with multiple invocations of msgutil
in a session; Nick is aware of this and hopefully is coming up with a fix
"real soon now".
No filtering is involved. Hope this helps. |
| ICE4WARD.ZIP |
ICE4WARD mail forwarder. Julian Thomas (jt@epix.net) April 1997
To use this you need:
1. Set up a filter to copy all the mail you want to forward into a
dedicated folder. Here's the one I use:
---------- Filter 11 FIF-level 1.1 ----------
f1.1 1 +\enabled
f1.2 * copy after first screen\Filter description
f2 * copy4auto\Filter alias
f3 # 24\search mode[s] :: Body Header
f4 * \search expression or text
f6 * F046\folder directory for copy:: screened for autoforward to jt
f13.1 1 I \filter type :: Inbound
f13.2 1 S \search type :: Simple
f13.3 1 A \match type :: Always
f13.7 1 Y \Copy to Folder
f13.13 1 N \Disposition is delete :: No delete
2. Create a .cmd file (I keep mine in c:\tcpip) to dial up your ISP.
dialler.how explains how I was able to do this; you will need to
adapt it to whatever works with your isp. Note that you will
hardcode the phone number, your ID and password in the scripts.
3. Meet the dependencies:
/* dependencies: (all must be reachable by the PATH except for mailto.exe)
zip.exe infozip zip utility
mailto.exe (in mr2ice directory; need one later than 1.26 that
doesn't have a length limitation)
killem.exe kills process by name of executable (orprocess #)
uuencode.exe standard utility available from various sources
tee.exe standard utility available from various sources
(there's an IBM EWS one around); for capturing output
for debug, etc.
*/
4. Put this script in its own directory.
5. Edit ice4ward.prm with your parameters. To check everything out, set
test to 1.
6. Try it out. use this incantation in an os2 text window:
cd \ice4ward (or wherever you have it)
ice4ward 2>&1 | tee ice4ward.log
7. When running it for real, be sure to set test to 0.
When you get back home, highlight the window and use Ctrl-C to
terminate |
| NAMCHANG.ZIP |
/* apply to outgoing mail from msgutil to change the "From" and the sig */
/* */
/* based on code from William H. Geiger III */
/* whgiii@amaranth.com */
/* usage: 1. Edit the lines to reflect the changes you want to make
It changes the "From:" line in the header to what you set
"newfrom" to [be careful not to mismatch quotes here!]
and one line in the message (presumably in the sig)
which must match exactly the contents of oldsig;
this line will be changed to newsig.
To bypass this test set oldsig= ""
2. Edit msgutil.cmd (in the mr2ice directory) to have
an unused Ctrl-Fkey invoke this cmd file as follows:
call "namechang" filename
3. To use, when composing a message, press Ctrl and the
selected Fkey.
*/
/* edit these three lines to reflect the changes you want to make */
newfrom='From: "Mary Jane Thomas" '
oldsig= " Julian Thomas (and/or if appropriate, Mary Jane Thomas)"
newsig=" Mary Jane Thomas"
/* you shouldn't need to edit anything after this */
parse arg msg_filename .
'@echo off'
blank=''
from="From:"
outfilename="namchang.tmp"
nxy=1
nxz=stream(outfilename,'c','open write')
nzz=stream(msg_filename,'c','open read')
do forever while (length(linein(msg_filename))>0) /* pull file header */
nxx=stream(msg_filename,'c','seek +0') /* get read pointer */
nxx_rs=stream(msg_filename,'c','seek =' nxy) /* reset read pointer */
lin=linein(msg_filename)
/* test to see if we change the FROM */
if pos(from,lin)=1 then lo=lineout(outfilename,newfrom)
else lo=lineout(outfilename,lin)
nxy=stream(msg_filename,'c','seek +0')
end
lo=lineout(outfilename,blank)
do forever while lines(msg_filename)
lin=linein(msg_filename)
if (lin=oldsig) & (oldsig<>"") then lo=lineout(outfilename,newsig)
else lo=lineout(outfilename,lin)
end
st1=stream(msg_filename,'c','close')
st3=stream(outfilename,'c','close')
'erase' msg_filename
'rename' outfilename msg_filename
exit |
| VACATION.ZIP |
/* Julian Thomas November 1997 */
/* Include OS/2 Rexx utilities */
if RxFuncQuery('SysLoadFuncs') then
do
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
end
env = 'OS2ENVIRONMENT' /* Access environment init variables */
arg msg_filename .
fromfile='acklist.fil'
magicfile='mr2_rexx.$$$'
xxx=SysFileDelete(magicfile)
/* define any other useful constants here */
yy1='FROM:'
nxy=1
nzz=stream(msg_filename,'c','open read')
/* this block reads the header. It can be modified if header changes are
needed */
do forever while (length(linein(msg_filename))>0) /* pull info from header */
nxx=stream(msg_filename,'c','seek +0') /* get read pointer */
nxx_rs=stream(msg_filename,'c','seek =' nxy) /* reset read pointer */
lin=translate(linein(msg_filename)) /* upper case everything */
nxy=stream(msg_filename,'c','seek +0')
/* examples of looking for specific lines */
xx1=pos(yy1,lin,1)
If xx1=1 then from=lin
end
parse var from . from /* get rid of "FROM: " */
st1=stream(msg_filename,'c','close')
/* now we see if we've seen this ID before or not */
st2=stream(fromfile,'c','open read')
hit=0
do forever while lines(fromfile)
lin=linein(fromfile)
if from=lin then hit=1
if hit=1 then leave
end
st2=stream(fromfile,'c','close')
if hit=0 then do
/* first time for this from ID */
/* make the filter succeed so that the autoreply will go */
xxx=lineout(magicfile,'xxx')
st1=stream(magicfile,'c','close')
/* add to the fromfile to log this ID */
st2=stream(fromfile,'c','open write')
st2=stream(fromfile,'c','seek <0')
st2=lineout(fromfile,from)
st2=stream(fromfile,'c','close')
end
exit |