Code VBscript to insert image in Email - C1ReportDesigner

Posted by: eduardo.cardia on 15 June 2023, 10:10 am EST

  • Posted 15 June 2023, 10:10 am EST - Updated 15 June 2023, 10:15 am EST

    Dear Collegues

    I need help with my Code (VBscript) to load and insert a picture automaticly.

    I’m working with ERP System (base Sql) integrated with C1ReportDesigner. Some tools of ERP execute scritps, for example to send directly email from the system, as the code below.

    Dim conn
    Dim prm
    
    Public Sub main (prm)
        prm.ExecutionResult = prm.Constants.EXECUTION_RESULT_FALSE        
        
        Set Me.prm = prm
        Dim bytAccessType, avParameters
        prm.TranslateNewToOldModelControl bytAccessType, avParameters
        
        Dim inFoEmail
        Dim strMessage, strSUbject, strCc, strSignature, strTo
         
        Set ocnADO = CreateObject ("ADODB.Connection")
        ocnADO.Open "DSN=" & Trim (prm.Database.Dsn) & ";Persist Security Info=true;Uid=" & Trim (prm.Database.UserName) & ";Pwd=" & Trim (prm.Database.Password) & ""
        ocnADO.CommandTimeout = 0
    
        'Before Send
        If (UCase (avParameters(0)) = "B") Then
            
     
            inFoEmail = prm.inFoEmail
            
            ' array
            strMessage   = inFoEmail(0)
            strSubject  = inFoEmail(1)
            strCc        = inFoEmail(2)
            strSignature = inFoEmail(3)
            strTo      = inFoEmail(4)
            '
            '... personalization
            '
            strMessage = "Dear Customer </br></br>  text  : </br><br>" & inFoEmail(0) & "</br><br> text" 
            strSubject = "Signature Test"
            strCc      = "picture@gmail.com"
            strSignature = ""
            strTO      = "image@gmail.com"
          
            'Return info
            inFoEmail(0) = strMessage
            inFoEmail(1) = strSubject
            inFoEmail(2) = strCc
            inFoEmail(3) = strSignature
            inFoEmail(4) = strTo
         
         
            prm.inFoEmail = inFoEmail
            
            prm.ExecutionResult = prm.Constants.EXECUTION_RESULT_TRUE
            
            'After Send
        ElseIf (UCase (avParameters(0)) = "E") Then
             prm.ExecutionResult = prm.Constants.EXECUTION_RESULT_TRUE
     End If

    How to load an image through this script?

    With Private Sub … Public Property … or just with a variable.

    Which object and class do I have to use

    Tks

    Eduardo

  • Posted 16 June 2023, 7:31 am EST

    Hi,

    Thanks for reaching out to us with your query.

    Your code doesn’t seem related to our product.

    Could you please provide more information?

    1. How you are using C1ReportDesigner in your application?
    2. Where do you want to set an image?
    3. Are you using scripts in C1ReportDesigner?

    Also provide a C1Report, if you are facing any issues with it.

    Regards,

    Nitin

  • Posted 20 June 2023, 10:31 am EST

    Hi Nitin

    Tks for your reply

    Maybe I could be wrong.

    All the system reports uses C1reportDesigner, so I thought it could be a C1 tool for send emails, the image in screen.

    I will check it out again.

    Tks

    Eduardo

  • Posted 20 June 2023, 4:35 pm EST

    Hi Nitin,

    When I load the screen for emails send the C1.win.4.dll file is also loaded in OS memory.

    As I explained, the system execute a VB Script to insert automatic information.

    Example: To, subject, message, other things seted in the array list.

    I need to insert an image in the Signature, but the variable is a string I can’t to replace.

    But in the system screen, I have a button option to select folder and picture file manualy.

    I would like include a function in the code to insert auto.

    Regards

    Eduardo

  • Posted 21 June 2023, 7:40 am EST

    Hi,

    It seems like the issue is not related to our product. We are not sure how you are actually using the C1ReportDesigner.

    Also, If you have referenced C1.Win.4.dll in your project then it would load in the OS memory.

    If you are actually doing this using C1 dlls, then we request a small sample. So, that we can investigate this scenario and assist you better.

    We didn’t see any C1 tool that is used with your application as per the image you provided earlier.

    Some more information needed from your side.

    Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels