[Solved] SysEmail "Attachment" Cmd to include multiple files

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
User avatar
alf50
Posts: 131
Joined: Sun Jun 13, 2010 2:55 pm

[Solved] SysEmail "Attachment" Cmd to include multiple files

Post by alf50 »

I Need the SystemEmail "Attachment" Command format to include multiple files in one email?

The Code I am using in Windows 7 and the Windows Live Mail, allows me to attach one file to the email, but I cannot figure out how to attach Multiple files.

The Code to attach one file that works is:

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf")))

I have tried several variants of &, comas, semicolons, nested Array(convertUrl(...) but when I run the macro, nothing works.

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf; " & sPath & "2.pdf; " & sPath & "3.pdf")))
Last edited by alf50 on Sat Feb 26, 2011 9:50 pm, edited 1 time in total.
OpenOffice 4.1.14 on Mac Catalina(10.15.7), RasPi4B (TwisterOS-8/2023update) & MS Wnds10
FJCC
Moderator
Posts: 9563
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Need SystemEmail "Attachment" Command to include multipl

Post by FJCC »

The method setAttachment takes an array of URL's as its argument. If you want to do it in one line, I think what you need is

Code: Select all

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf"), convertToURL(sPath & "2.pdf"), convertToURL(sPath & "3.pdf")))
It is probably cleaner to do it in multiple lines

Code: Select all

URL1 = convertToUrl(sPath & "1.pdf")
URL2 = convertToUrl(sPath & "2.pdf")
URL3 = convertToUrl(sPath & "3.pdf")
ArrayOfURL = Array(URL1, URL2, URL3)
eMessage.setAttachement(ArrayOfURL)
I didn't actually test the code. I hope there are no typos or silly mistakes.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Locked