UiPath Activities

The UiPath Activities Guide

Create and Override Files

The example below explains how to create a new notepad file, edit it, and save it. It presents activities such as Send Hotkey, Click, Type Into, or Element Exists. You can find these activities in the UiPath.UIAutomation.Activities package.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.
    • Create the following variable:
Variable Name
Variable Type
Default Value

FileAlreadyExists

Boolean

-

  1. Drag a Send Hotkey activity inside the Sequence container.
    • Select the check box for the Win option and add the value r in the Key field. This specifies the command that needs to be executed by the automation process.
    • Inside the activity, click the Indicate on screen option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
  1. Place a Type Into activity below the Send Hotkey activity.
    • Inside the activity, click the Indicate on screen option and select the desired area. The GIF below shows all the steps you need to follow:
      5
    • Add the expression "notepad.exe" in the Text field. This indicates what text should be written in the selected field.
    • Select the check box for the SimulateClick option. This option simulates the click using the technology of the target application and it works in the background.
  2. Drag a Click activity below the Type Into activity.
    • Inside the activity, click the Indicate on screen option and select the Ok button. The GIF below shows all the steps you need to follow:
      1
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application, and it works in the background.
  3. Place a Type Into activity below the Click activity.
    • Inside the activity, click the Indicate on screen option and select the Ok button. The GIF below shows all the steps you need to follow:
      2
    • Add the expression "This is a UiAutomation example" in the Text field.
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application and it works in the background.
  4. Drag a Click activity below the Type Into activity.
    • Inside the activity, click the Indicate on screen option and select the File option. The GIF below shows all the steps you need to follow:
      3
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application, and it works in the background.
  5. Place another Click activity below the Click activity.
    • Inside the activity, click the Indicate on screen option and select the File option. The GIF below shows all the steps you need to follow:
      4
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application, and it works in the background.
  6. Place a Type Into activity below the Click activity.
    • Inside the activity, click the Indicate on screen option and select the field where the file's name should be introduced. The GIF below shows all the steps you need to follow:
      5
    • Add the expression "This is a UiAutomation example" in the Text field.
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application and it works in the background.
  7. Place another Click activity below the Type Into activity.
    • Inside the activity, click the Indicate on screen option and select the File option. The GIF below shows all the steps you need to follow:
      6
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application, and it works in the background.
  8. Drag an Element Exists activity below the Click activity.
    • Inside the activity, click the Indicate on screen option and select the pop-up message. The GIF below shows all the steps you need to follow:
      7
    • In the Properties panel, add the variable FileAlreadyExists in the Exists field.
  9. Place an If activity below the Element Exists activity.
    • Add the variable FileAlreadyExists in the Condition field.
  10. Drag a Click activity inside the Then container.
    • Inside the activity, click the Indicate on screen option and select the File option. The GIF below shows all the steps you need to follow:
      8
    • In the Properties panel, select the check box for the SimulateClick option. This option simulates the click using the technology of the target application, and it works in the background.
  11. Run the process. The automation process opens a new Notepad document, writes some text inside it and saves it as a new file. If a file with the same name is already present, it overwrites it.

Updated 2 months ago


Create and Override Files


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.