Short: Adds support for .mht files to IBrowse via an external viewer and YAM Author: Alexander Niven-Jenkins Uploader: Alexander Niven-Jenkins Type: comm/www Requires: IBrowse 1.2+, YAM 2.4+, CRLF stripper Architecture: m68k-amigaos Why was it written? ~~~~~~~~~~~~~~~~~~~ Michael Malyshev posted a message to the IBrowse (http://groups.yahoo.com/group/ibrowse/) mailing list asking if it would be possible to add support for such files. Never one to turn down a challenge, an arexx script seemed the perfect solution, so here it is in all of it's glory. Requirements ~~~~~~~~~~~~ IBrowse (1.2+) The script has been fully tested with both IBrowse 2.2 and 2.3, but it should work equally as well with IBrowse 1.2. YAM (2.4) .mht files are effectively large email messages. Although we could have written a seperate program to decode these files -- which can be extremely complicated, having multiple parts all encoded differently -- it made more sense to utilise an existing email client to do the hard work. As we use YAM and it has a very powerful arexx port YAM was chosen. Note: due to various bugs present in YAMs arexx port for versions below 2.4 we can not guarantee that the script will work correctly with versions of YAM that are below the latest developer version. CRLF stripper As with everything that Micro$oft touch, .mht files are not 100% legal email messages, the standard dictates that they should use single LFs. As such YAM does not support email messages using CRLF. To work around this the script uses a 3rd party stripper program to convert the .mht files before they are imported into YAM. Note: any CRLF stripper program will do, although we recommend: CRLF2LF (http://us.aminet.net/text/misc/crlf2lf.lha) Installation ~~~~~~~~~~~~ Copy the script to somewhere on your computer. See the scripts header for setting up IBrowse. Copy CRLF2LF to C: If you intend to use a different CRLF stripper program or wish to use a different temporary directory etc. you will need to alter the relevant parts of the script accordingly. What does it do? ~~~~~~~~~~~~~~~~ The .mht file as well as being passed through the CRLF stripper program is given a header so that it MBOX compatible. This new file is imported into YAM where it is decoded and all the necessary file attachments are saved using the filenames defined within the "Content-Location" fields of the .mht file. Any "text/html" type files are parsed line by line making sure that any links which reference the attachments are changed to local equivalents. The main html file is then passed back to IBrowse. Bugs ~~~~ Below are currently known bugs. Unfortunately they are out of our control because they are bugs still present in YAMs arexx port which can affect the operation of the script. These bugs have been logged onto SourceForge but for the time being you will need to bare them in mind. 1. Some attachments will not be saved if their filenames contain certain characters. This is a bug/flaw with the READSAVE command and is being investigated by ourselves and the YAM development team. Notes ~~~~~ If YAM is not iconified while the script is running the message import window will be displayed for a short period of time while the file is being imported. Although this is not a bug a QUIET switch is missing from the MAILIMPORT command, again this has logged onto SourceForge. The script does not truncate any filenames. .mht files can contain parts with filenames that are greater than the standard 30 characters allowed by FFS. By default the script uses "T:" for it's temporary directory -- with OS3.5/9 the ram-handler was improved to add support for filenames upto 107 characters long, therefore if you are using OS3.5/9 and keep the temporary directory in "RAM:" there will not be a problem. If you are not using OS3.5/9 change the temporary directory to point to a disk using a different filesystem like PFS or SFS. If this is not possible contact us, it is possible to modify the script so that it will handle truncating any filenames, we just didn't see the need to do this initially as most people should be running the newer OS. IBrowse returns immediately after running the script, therefore there is no visual indication that the script is running. Be patient the script can take quite a while to finish, especially if the .mht file contains some large html files because they are all parsed line by line. IBrowse will eventually update with the new page. IBrowse's GOTOURL command returns immediately. This introduces a possible situation where the script could start deleting temporary files before IBrowse has actually had a chance to load them. To work around this the script pauses for 10 seconds before it starts deleting any temporary files. This pause in no way affects IBrowse or the system ;) Why text/x-mht? IBrowse does not currently support multiple mime types with different extensions, by this we mean two "text/plain" entries. You can enter them but it generates unpredictable results -- you may find text files being passed to the script rather than being displayed etc. For the time being you must prefix the extension with a "!" so that IBrowse will ignore the mime type sent by the server and use the mime type with the matching (prefixed) extension. History ~~~~~~~ Version Date Comments 1.00 09/11/2002 · First public release. 1.01 12/02/2003 · SETMAIL was failing for empty folders.