How to use the attachment processor within an array of attachments?

I have also edited my intial question.