How to Create and Use the DLL file in Automation Anywhere V11

Introduction :

A Dynamic Link Library (DLL) is library that contains function and codes that can be used in Automation anywhere by crating the logic in the Meta bot.

Creating DLL File :

Step 1: Open Visual Studio then select File -> New -> Project.. Create a new project -> Select Class library (Class Library .Net Framework) -> Next... Enter Project Name (eg. "Calculation")-> Create.



Step 2: Change the Class name (Class1.cs) to Calculate.cs



Step 3:  In the Calculate class, write the two method for addition and subtraction.
(please refer below)



Step 4: Build the solution(Ctrl+Shift+B). now you can see the "Calculation.dll" file in the bin/debug project directory.

we have crated the dll file, now we will use it in AA by creating the logic for this dll in the meta bot.

*********************************************************************************
Using DLL File:

Step 1: Open AA Client -> Meta Bot -> New -> Meta bot Name (Calculate) -> Select All Application -> Create.



Step 2:  Add the DLL file from respective folder (get the dll file from c# project repos and place it in Automation anywhere files -> Automation anywhere -> My Exes folder) in Assets.

should look like as below -



Step 3: Click on Logic -> Add Logic 

Create 4 variables -
                                 1. v_FirstNumber  (Input Parameter type)
                                 2. v_SecondNumber(Input Parameter type)
                               
                                 3. v_AddResult(Output Parameter type)
                                 4. v_SubResult(Output Parameter type)

Now click on first Add method and pass the input & Output parameter as below.



follow the same steps for Sub method and pass the parameters respectively.

Note : Input variable for both function(Add & Sub) to be v_FirstNumber & v_SecondNumber.
Output variable for Add select "v_AddResult" and for Sub select "v_SubResult".

Step 4: Save the Logic (eg. Calculate).

Step 5 : Now to run the meta bot ("Calculation.mbot") in task editor follow as below.

       Create the  4 variable v_FirstNumber, v_SecondNumber, v_AddResult, v_SubResult".

       use Variable operation assign the value for v_FirstNumber = 10 & v_SecondNumber = 5

Step 6 : Drag and Drop the Calculation.mbot From meta tab list and pass the variable for Input & Output parameters and click on Save.



Step 7 : Use a Message Box and get value for v_AddResult & v_SubResult

Step 8 : Save the Task and Run.
               
                    Output :  Add Result : 15     Sub Result : 5

Download Code
find the below atmx code screenshot for reference.


Happy Learning!! 😊

Post a Comment

0 Comments