Skip to main content

Example - Notepad Automation

In this example, we will create automation to perform the following actions:

  1. Open the Notepad application and load a specified text file
  2. Insert a line of text at the end of the text file
  3. Save the text file
  4. Close the Notepad application

Prerequisites

  • Create a text file Sample.txt on your desktop
  • Open Notepad and load the above text file
  • Open Process Designer and create a blank process. Give a name to that Process.

Process Designing

  1. Drag and drop Start Process Activity. Configure the following properties:
  • File Name: assign "notepad.exe"
  • Arguments: assign "<change-to-your-desktop-folder>/sample.txt"
  • ** Process**: create a new variable of type ** Process** and provide the name of that variable here. For example: npprocess
  1. Create a string variable and assign some text value to be written into sample.txt
  2. Drag and drop Send Keys activity. Configure the following properties:
  • Process: assign npprocess
  • ** Text to send**: assign the variable name created in the previous step.
  • Click on Element Selector and select the Notepad process from the dropdown. Select the text area UI element and press the [F2] key
  1. Type some text inside sample.txt opened in Notepad
  2. Drag and drop Mouse Click activity. Configure the following properties:
  • Click Type: select Left_Click
  • Process: assign npprocess
  • Click on Element Selector and select the Notepad process from the dropdown. Select the File menu element and press [F2] key
  1. Drag and drop Mouse Click activity. Configure the following properties:
  • Click Type: select Left_Click
  • Process: assign npprocess
  • Click on Element Selector and select the Notepad process from the dropdown. Select the File > Save menu element and press [F2] key
  1. Drag and drop Mouse Click activity. Configure the following properties:
  • Click Type: select Left_Click
  • Process: assign npprocess
  • Click on Element Selector and select the Notepad process from the dropdown. Select the Close [X] menu element from top-right corner and press [F2] key
  1. Save the Process
  2. Click Run to execute the Process

notepad_example

Download Example