[Libreoffice-bugs] [Bug 124251] New: Basic script error after update from LO 6.1.X to LO 6.2.X

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Mar 21 20:59:05 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=124251

            Bug ID: 124251
           Summary: Basic script error after update from LO 6.1.X to LO
                    6.2.X
           Product: LibreOffice
           Version: 6.2.2.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: theimer at seznam.cz

Description:
I get err message "Type: com.sun.star.lang.IllegalArgumentException
Message: Invalid attachment file URL." on line"
eMailClient.sendSimpleMailMessage( eMessage, nFlag)" I cant attache screenshot

the script works correctly in LO 6.1.X







REM  *****  BASIC  *****

Sub Main

End Sub


Sub SendMail 'this is solution for button (variables in czech language)
        doc = thisComponent
        list = doc.getCurrentController.getActiveSheet
        adresa = list.GetCellRangeByName("A1").string
        predmet = list.GetCellRangeByName("A2").string
        telo = list.GetCellRangeByName("A3").string
        priloha = list.GetCellRangeByName("A4").string

        Mailer (adresa, predmet, telo, priloha)
end sub



Sub HyperSendMail (sURL$) 'this is solution for function HYPERLINK in the sheet
(variables in czech language)
        adresa = getArgumentFromURL(sURL,"MailAddress")
        predmet = getArgumentFromURL(sURL, "Subject")
        telo = getArgumentFromURL(sURL, "Body")
        priloha = getArgumentFromURL(sURL, "Attach")

        Mailer (adresa, predmet, telo, priloha)
End Sub


Sub Mailer (eMailAddress as String, eSubject as String, eBody as String,
Attachment as String)
        Dim eMailer as Object
        Dim eMailClient as Object
        Dim eMessage as Object
        Dim nFlag as integer

        nFlag = 0
        eMailer = createUnoService( "com.sun.star.system.SimpleSystemMail" )
        eMailClient = eMailer.querySimpleMailClient()     
        eMessage = eMailClient.createSimpleMailMessage()
        eMessage.setRecipient(eMailAddress)
        eMessage.setSubject(eSubject)
    if Attachment <> "" Then 
                eAttachmentURL = convertToUrl(Attachment)
                eMessage.setAttachement (Array(eAttachmentURL))
        end if   
        eBody = Replace(eBody,"*",chr(10))
        eMessage.body = eBody
        eMailClient.sendSimpleMailMessage( eMessage, nFlag)
End Sub


REM returns "" if no value was found for name.
Function getArgumentFromURL(sURL$,sName$) as String
        on error goto exitErr:
        Dim iStart%, i%, l%, sArgs$, a()
        iStart = instr(sURL, "?")
        l = len(sName)
        if (iStart = 0) or (l = 0) then exit function
        ' sArgs behind "?":
        sArgs = mid(sURL, iStart +1)
        a() = split(sArgs, "&")
        for i = 0 to uBound(a())
                ' not case sensitive:
                if instr(1, a(i), sName &"=", 1) = 1 then
                        getArgumentFromURL = mid(a(i), l +2)
                        exit for
                endif
        next
        exitErr:
        ' return ""
End Function

Steps to Reproduce:
1.run script

Actual Results:
the script stops and write error message

Expected Results:
the script finish as in LO 6.1.X


Reproducible: Always


User Profile Reset: Yes



Additional Info:
[Information automatically included from LibreOffice]
Locale: cs
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190321/bb023c4a/attachment.html>


More information about the Libreoffice-bugs mailing list