Design a Bot Using Word Automation Activities

This tutorial shows you how to design a simple bot to automatically perform specific word processing tasks in a Word Document. The bot writes specific text in an existing Word document, adds a picture, and then replace the text written in the previous step with new text.

Background

You use all the activities available in Word Automation and one activity from Desktop Automation to create the bot.

Prerequisites

  • Access to ASG Studio Manager.
  • Check the availability of Microsoft Word application on your computer.

  • Add an image file (image.jpg) in the following location:

    C:\Users\%userprofile%\Pictures\image.jpg.

    You can also use .PNG and .GIF file extension.

Design the Bot

In this section, you design the RPA Model for performing the Excel automation task.

  1. Launch ASG-Studio.
  2. Create an RPA Model. See Create and Design RPA Model.
    Alternatively, you can open an existing RPA Model. If you are using an existing RPA Model click Clear in the Element Toolbar to remove any activities that have been previously added to the visual designer.
  3. In the visual designer, drag Start Event from the element toolbar and drop it on the visual designer. Keep the default activity name.
  4. In the Activities Panel, expand the Desktop Automation, Generic Actions, and then drag and drop Open Word Document on the visual designer. Define the following properties:
    • Name: Default activity name
  5. Connect Start Event to Open Word Document.

    To connect the activity shapes, select the first activity shape, click and hold the Sequence Flow or Association arrow icon, drag the arrow to the other shape, and then click the second activity shape.

  6. Expand Word Automation, then drag the following activities and drop them onto the visual designer.
  7. Action Name

    Name

    Other Properties

    Connect From

    Connect To

    Append Text

    Default activity name

    • Append at: (Select)
    • Enter text to send: Hello

    Open Word Document

    Append Text

    Find and Replace

    Default activity name

    • Enter Find Text: Hello
    • Enter Replace Text: Hi
    • Choose Action Type: (Select) Replace All

    Append Text

    Replace

    Add Picture

    Default activity name

    Path of Picture: C:\Users\%userprofile%\Pictures\image.jpg

    Change the extension based on the image file extension in the Pictures folder.

    Find and Replace

    Add Picture

    Export to PDF

    Default activity name

    Enter Filename: C:\Users\%userprofile%\Desktop\TestWordBot

    Add Picture

    Export to PDF

  8. Drag End Event from the Element Toolbar and drop it on the visual designer. Keep the default activity name. Connect Export to PDF to End Event.

  9. In the Element Toolbar of the visual designer, click Run to execute the RPA Model.
    • A message is displayed in the visual designer after successful completion of the RPA Model execution.
    • Navigate to the %userprofile%\Desktop folder and open the TestWordBot.pdf file.