Create a simple DLL

Perform this task to create a simple dynamic link library (DLL) that is used to build an advanced bot.

Prerequisites

Ensure you complete the following requirements:

  • Basic understanding and experience with programming
  • Access to an Integrated Development Environment (IDE) to develop code examples as a DLL that supports C#.

    An example IDE: Microsoft Visual Studio Community Edition

  • Access to the Automation Anywhere Enterprise Client
  • Bot Creator permission
  • A decent understanding of the Automation Anywhere RPA platform, including basic understanding of Task Bots, MetaBots, and what they do.
    Tip: Review this topic to understand how to build a bot: Build a basic bot using the Enterprise Client.

The examples in this task are based on Microsoft Visual Studio Community Edition.

Procedure

  1. Create a New Project in C#.
    In Microsoft Visual Studio, create a project and a solution that use the following names:
    1. Project name: MyApp4Lib
    2. Solution name: MyApp4MetaBot
    The Project is part of the Solution. This provides the flexibility to add other projects to the solution. In the code that follows, MyApp4Lib will be the Namespace. A namespace in C# is used to organize programs.
  2. Create a public class called VisibleBotMethods.
    Methods that are created in DLLs for use by bots can perform tasks, such as making a REST call, integrating with other DLLs, or running a database SQL call. The following is a basic code example.
  3. Copy the following code and paste it into your project.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace MyApp4Lib
    {
        public class VisibleBotMethods
        {
            public String SayHiTo(String Name)
            {
                String MyMessage = "Hi There, " + Name;
                return MyMessage;
            }
    
            public String SayByeTo(String Name)
            {
                String MyMessage = "Goodbye " + Name;
                return MyMessage;
            }
        }
    }
    

    This code example has two methods in the VisibleBotMethods class. Both methods take a string name and return another string. One method returns a string with "Hi there" plus a name. The other returns "Goodbye."

  4. Compile the code to create a DLL.
    Important: Name the DLL "MyApp4Lib.dll". The DLL created in this task is used in the Enterprise 11: Create a basic MetaBot task.

Next steps

Add the DLL you created in this task to a MetaBot: Add Logic and local variables to a basic MetaBot.