system.agents.attachmentCleanup


File: attachmentCleanup.sit.hqx
Server: www.orange-road.com
Modified: 9/10/97; 7:24:09 PM
Size: 3K
Owner: khagler@orange-road.com
Attachments: user.mail.prefs.garbage

This agent only works with Claris Emailer!

The attachmentCleanup agent was written to deal with the proliferation of "garbage" e-mail attachments. These are attachments added by certain inferior e-mail applications (notably Netscape) that are completely useless to any other mail client.

attachmentCleanup works by scanning your Emailer attachment folder every five minutes. It compares the name of every file it finds there to a list of known "garbage" names, which is stored in user.mail.prefs.garbage. If the name of an attachment begins with one of the strings in the prefs table, that file is deleted. You may add or remove names as you see fit.

Currently, attachmentCleanup removes attachments with the following names:

  1. Enclosed
  2. vcard.vcf
  3. WINMAIL
  4. smime
  5. MIME file
«Wed, Sep 10, 1997 at 7:24:08 PM by KGH
	«This script checks Emailer's attachment folder (as located by the user) every five minutes. If it finds a file
	«that looks like a garbage attachment, it will delete it.
	«The location of the attachement folder is stored at user.mail.prefs.attachmentFolder.
	«The list of what constitutes a "garbage attachment" is in the table at user.mail.prefs.garbage
local ( theFile, ct = 0, i );
if ( not defined ( user.mail.prefs.attachmentFolder ) ) || ( not file.exists ( user.mail.prefs.attachmentFolder ) ) {
	«make sure the attachment folder location is set and valid
	if not file.getFolderDialog ( "Where is you attachment folder?", @user.mail.prefs.attachmentFolder ) {
		return ( false )}}; « user canceled
fileloop ( theFile in user.mail.prefs.attachmentFolder ) {
	for i = 1 to sizeof ( user.mail.prefs.garbage) {
		if file.fileFromPath ( theFile ) beginsWith user.mail.prefs.garbage.[i] {
			file.delete ( theFile );
			ct++}}};
bundle { « show a message telling how many attachments were deleted on the last run
	case ct { « decide which message to show
		0 {
			msg ( "No attachments were deleted." )};
		1 {
			msg ( "One attachment was deleted." )}}
	else { « lots of garbage
		msg ( ct + " attachments were deleted." )}};
clock.sleepFor ( 300 ) « sleep for five minutes

Site scripted with Userland Frontier
This page was last built on Mon, Jun 15, 1998 using the Sysop Suite (V1.0f1) on a PowerWave running Frontier.