Skip to main content
Question

How to use VBScript in A360

  • July 28, 2023
  • 1 reply
  • 292 views

Forum|alt.badge.img+11

Hello, I have a script that will find the email body in a html message.

Here is the vbs:

Option Explicit

Function FindFirstEmailBody(htmlMessage)
    Dim regEx, bodyPattern
    Set regEx = New RegExp
    
    ' Regular expression pattern to match the first occurrence of HTML body
    bodyPattern = "<body[^>]*>(.*?)</body>"
    
    ' Ignore case and multiline
    regEx.IgnoreCase = True
    regEx.MultiLine = True
    
    ' Execute the regular expression
    Dim matches
    Set matches = regEx.Execute(htmlMessage)
    
    ' Check if a match was found
    If matches.Count > 0 Then
        FindFirstEmailBody = matches(0).SubMatches(0)
    Else
        FindFirstEmailBody = ""
    End If
End Function

 

 

' Find the first email body
Dim emailBody
emailBody = FindFirstEmailBody(htmlMessage)

' Output the first email body
MsgBox emailBody

 

 

 

Here S_emailMessage is email message of the email in the loop for each mail action.

 

It says “bot error”

1 reply

AWilson
Forum|alt.badge.img+5
  • Navigator | Tier 3
  • 12 replies
  • July 31, 2023

Unfortunately Automation Anywhere doesn’t give descriptive feedback from scripts, so if something causes your script to stop, you will be returned ‘bot error’.

 

There are two things I have done to work with these error messages:

 

  1. Implement error handling within the script so that it outputs something useful when an error occurs.
  2. If step one still doesn’t fix the issue, then comment out lines of your code run the bot, slowly uncomment lines to find the offending one.

 

Good Luck!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings