Processing attachments with lotusscript agent

Hi!

A database I’m making is suppose to receive emails with 3 attachments that are of the type “.CSV”, “.BBB” and “*.???”.

  1. The .CSV file is a CSV-file with data intended for several fields.

  2. The .BBB file is a text file where all the text in the file is intended for one field.

  3. The .??? file can be anything (PPT, JPG, XLS, BMP etc.) and is intended to be copied (as an attachment) to a richtextfield.

I want to make an agent that creates a new document and automatically processes the 3 attachments into the new document as described above.

Is this even remotely possible?

My lotusscript is not very good so any help or pointing in the right direction is highly appreciated.

Regards

Frank

Subject: Processing attachments with lotusscript agent

It certainly is possible, and not very complicated. Use these pieces of code and let Help help you.

  1. define the field that will contain the attachements as RichText

If ( rtitem.Type = RICHTEXT ) Then

  1. loop through all the attachments

Forall o In rtitem.EmbeddedObjects

If ( o.Type = EMBED_ATTACHMENT ) Then

  1. get the name of the attachment

name=Lcase(o.name)

  1. look at the last 3 characters to see what yupe

if right$(name,3)=“CSV” then - do this

Call o.ExtractFile ( location_of_file )

do something

elseif right$(name,3)=“BBB” then - do this

Call o.ExtractFile ( location_of_file )

do something else

else

copy the object into the new document

End if

Subject: RE: Processing attachments with lotusscript agent

Hi Rampisad and thank you!

I finally managed to get an agent to do what I wanted. Thanks once again!

Regards

Frank