Learn Desktop Automation with These Script Samples

4 min read
Desktop Automation

We have previously shared some web automation script samples that you can use to learn automation faster and see the web capabilities of RPA in practice. Now, let’s see some RPA examples that can help you learn desktop automation capabilities with WorkFusion’s Intelligent Automation Cloud.

We have divided the samples into two groups, based on what application is primarily used in the automated task:

However, most of them also work with other applications. Note the field “Automated actions” to learn more.

All RPA examples below have been created using actions available in the Actions Library in RPA Recorder without custom coding, or with minimal coding required. Depending on the script size and number of actions used, the scripts are divided into three categories: simple, medium and complicated.

SAP RPA examples

Automating SAP desktop client is implemented in WorkFusion through native SAP GUI support, which means the application can see UI elements of SAP and interact with them just like a person does. There are two SAP RPA examples in the library which demonstrate how this approach works.

Creating and posting an incoming invoice in SAP

Complexity: Simple

Automated actions: Application actions, mouse clicks, keyboard actions

What it does: This script sample demonstrates how an RPA bot can log in to the SAP application and create a MIRO transaction with predefined parameters using a standard SAP interface. 

How it helps: This is a vivid example of using credentials to log in to a desktop application in a secure way. By adding some steps to extract the invoice data from original documents (using OCR or other applicable actions), you can make the script more robust and use it to automate invoice posting in SAP.

Note: There are a variety of SAP configurations and versions, some of which have different UI elements. This sample was created using SAP GUI v. 7.40-7.50, so it might not work out of the box for other SAP versions. To adapt it to your SAP environment, you might need to change the selectors of UI elements in the Mouse and Window actions.

Invoice registration in SAP (MIRO)

Complexity: Medium

Automated actions: Optical character recognition (OCR), keyboard actions, mouse clicks, web, exception handling

What it does: This example shows a simple case: The RPA bot extracts information from two invoices using different approaches and saves that data in SAP.

How it helps: The script sample shows two approaches to extracting information from invoices in PDF format, via optical character recognition (OCR) and through XPaths. You can use them in your own automated workflows with minimal customization, as well as the part of the script that registers an invoice in SAP using the extracted information.

Note: As with the previous sample, you might need to adjust the script to your SAP environment and screen resolution (for OCR actions).

Excel automation examples

Excel automation examples below demonstrate how to use two main approaches to automating Excel files: built-in Excel actions from the Actions Library and object-based automation.

Sending emails based on condition

Complexity: Medium

Automated actions: Excel, Outlook, keyboard actions, mouse clicks, logical condition, exception handling

What it does: The RPA bot reads the data about invoices stored in a spreadsheet and, based on the invoice status, it either sends an email to the customer in Outlook or adds the customer to the list of debtors and sends the file to the account manager.

How it helps: This is an excellent example of combining Excel and Outlook automation in one workflow, and some parts of the script can be reused in your processes (reading the data from Excel, sending an email in Outlook). It also shows how conditions can be applied to provide for several scenarios in the workflow.

Note: You need to be logged into your account in Outlook for the script to work.

Report generation and dissemination

Complexity: Complicated

Automated actions: Excel, web, keyboard actions, mouse clicks, loops, actions with local files and folders, text parsing, exception handling

What it does: This Excel automation example gathers several JSON log files, extracts data from them, creates a report in Excel, and sends it to several recipients. 

How it helps: The use case used for this script sample is unique, but it demonstrates a general approach that can be used for all similar instances in which one needs to extract data from multiple files and combine them in a single report. The script also demonstrates how to use an object-based automation approach in Excel.


Complexity: Complicated

Automated actions: Excel, optical character recognition (OCR), keyboard actions, mouse clicks, automating local files and folders, loops, logical conditions, text parsing, exception handling

What it does:  The RPA bot uses Adobe Reader to convert .pdf files to .txt, extracts the data from the files, and creates a reconciliation report in Excel.

How it helps:  The sample demonstrates how you can convert .pdf files into .txt and parse the data extracted from the text files. The script also uses simple coding to implement custom functionality in the workflow.

We hope these script samples will help you learn desktop automation faster. If you would like to get more formal training on RPA, “Automating the Business Task” is made for you! This course offers video tutorials, documentation, and small samples for learning specific actions that you can download and run. And it’s free!

Want to learn more about desktop automation?