In this video I show how to upload a video from Libreoffice using BASIC. The video is for Calc, but can be used for all Libreoffice applications. The BASIC script can be found here:
https://github.com/snikolaj/libreoffice_calc_basic_tutorial
under the name email.bas
There's also more resources there for learning BASIC. You can also watch my videos as well for that. The previous 2 are an introduction to BASIC. If you have any issues please write them in the comments!
The code for the script:
REM ***** BASIC *****
Sub SendEmail
Dim eMailAddress as String
Dim eSubject as String
Dim eMailer as Object
Dim eMailClient as Object
Dim eMessage as Object
eMailAddress = "[email protected]"
eSubject = "Spreadsheet email"
eMailer = createUnoService("com.sun.star.system.SimpleSystemMail")
eMailClient = eMailer.querySimpleMailClient()
eMessage = eMailClient.createSimpleMailMessage()
eMessage.body = GetBody()
eMessage.setRecipient(eMailAddress)
eMessage.setSubject(eSubject)
eMessage.setAttachement(Array(convertToUrl(GetCurrentFile())))
eMailClient.sendSimpleMailMessage(eMessage, com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE)
End Sub
Function GetCurrentFile
Dim path as String
path = ThisComponent.getURL()
GetCurrentFile = path
End Function
Function GetBody()
GetBody = InputBox("Enter the body of the email", "Input Box")
End Function