Design a Bot Using File Operations Automation Activities

This tutorial shows you how to design a simple File Operations Automation bot and run it on your computer. The bot opens the desktop notepad application, overwrite the text, move the file to a different location, and then rename the file.

Background

You will use only the activities available in File Operations Automation activities to create the bot.

Prerequisites

  • Access to ASG Studio Manager.
  • Check the availability of notepad application on your computer. We have used the Notepad application for Windows 10.

Design the Bot

In this section, you design the RPA Model for automating a Notepad related task.

  1. Launch the Notepad application and type the following text: Hello.
    • On the File menu, click Save As, select the %userprofile%\Desktop folder (Desktop folder in the current user profile), enter Notes in the File name field, and then click Save.
  2. Launch ASG-Studio.
  3. 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.
  4. In the visual designer, drag Start Event from the element tool and drop it on the visual designer. Keep the default activity name.
  5. In the Activity Panel, expand File Operations Automation, then drag the following activities and drop the onto the visual designer.

    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.

    Action Name

    Other Properties

    Connect From

    Connect To

    Read File

    • File Path: C:\Users\%userprofile%\Desktop\Notes.txt
    • Enter a variable name to store the read text: test1

    Start

    Read File

    Write File

    • Enter File path: C:\Users\%userprofile%\Desktop\Notes.txt
    • Enter text to be written: Hi
    • Action: Select Override

    Read File

    Write File

    Copy/Move

    • Name: Move
    • File path: C:\Users\%userprofile%\Desktop\Notes.txt
    • Move/Copy: Select Move File
    • Directory to move: C:\Users\%userprofile%\Documents\Doc
    • Create folder if not exist: Move the slider to enable this option.
    • Delete file if already exist: Move the slider to enable this option.

    Write File

    Move

    Rename File

    • Enter File Name: C:\Users\%userprofile%\Documents\Doc\Notes.txt
    • Enter New File Name: C:\Users\%userprofile%\Documents \Doc\Notes1.txt

    Move

    Rename File

  6. Drag End Event from the Element Toolbar and drop it on the visual designer. Keep the default activity name. Connect Rename File to End Event.
  7. Navigate to the C:\Users\%userprofile%\Documents folder and open the Doc folder. If you have defined a different destination folder in the Directory to move field, open that folder.
  8. 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.
    • When the execution is completed, open the Notes1.txt file to review the updated text.