/ Forums / Advansys Formativ / Creating Solutions with Formativ / Handling multiple attachments / Reply To: Handling multiple attachments
Thank you for the prompt response!
I’m actually communicating FOR our developer, so the next question is:
The developer found the error and handled it in a different manner. I’ve cut and pasted the script below. Are there any inherent dangers in THIS script?
——————————————————————————-
‘ Insert your comments here
‘——————————————————————————-
Sub Main(Client, GWEvent)
Dim objAddressBooks
Dim objAddessBook
Dim objAddressBookEntry
Dim objSubject
Dim objMessage
Dim objMsg
Dim objAttach
Dim objAttachs
Dim iAttachCounter
Dim iMsgID
Dim iFilter
Set objMsg = GroupWise.ComposingItem
objSubject = objMsg.Subject
objMessage = objMsg.BodyText
‘ iFilter = GroupWise.FilterReset()
‘ msgBox(iFilter)
‘ Get the composing message ID through TOKEN
iMsgID = GroupWise.ItemMessageIDFromView
‘ Make sure we have a composing message selected
iAttachCounter = GroupWise.ItemAttachmentGetCount(iMsgID)
if (iAttachCounter > 0) then
for x = 0 to (iAttachCounter -1)
objAttach = objAttach & GroupWise.ItemAttachmentGetName(iMsgID, x) & “;”
next
objAttachs = Split(objAttach, “;”)
end if
‘ Get the AddressBooks object
Set objAddressBooks = GroupWise.Account.AddressBooks
‘ Locate the address book called ‘Address Book’
Set objAddressBook = objAddressBooks.Item(“Contacts for Newsletter”)
‘ Display the email address of each entry in the book
For Each objAddressBookEntry In objAddressBook.AddressBookEntries
if objAddressBookEntry.emailaddress <> “” Then
‘ Create new mail message
Call GroupWise.NewMail
‘ Enter the recipient
Call GroupWise.FocusSet(fcsTo, “”)
Call GroupWise.TypeText(objAddressBookEntry.emailaddress)
‘ Enter the subject
Call GroupWise.FocusSet(fcsSubject, “”)
Call GroupWise.TypeText(objSubject)
‘ Enter the message body, first insert the greeting from contact comment field
‘ after that enter the text as type in the previous window
Call GroupWise.FocusSet(fcsMessage, “”)
Call GroupWise.TypeText(objMessage)
‘ Add attachment if any
if (iAttachCounter > 0) then
‘ Loop through attachments to get the names
for x = 0 to (iAttachCounter -1)
call GroupWise.ItemAttachmentAdd(“X00”, itcAttachClassFile, objAttachs(x), “”)
next
end if
‘ Send the message
Call GroupWise.ItemSend(False)
Utilities.doevents
end if
next
Set objAddressBook = Nothing
Set objAddressBooks = Nothing
Set objMsg = Nothing