RPA script preparation – Manual vs Automated Record

To implement Robotic Process Automation, a feasibility study has been performed using the UiPath and AutoIT. I’ve used the community edition of UiPath and Freeware of AutoIT to kick-start the feasibility study task. The following information is about to cover the end-user action specific script preparation and execution without Robot. In the forthcoming post, I will be covering the Robot specific execution using different RPA tools available in the market. I’ve used Windows x64 bit machine with Win10 OS in this dry run.

Tried to prepare script for a simple scenario of open a pdf file using Adobe Reader (Open Adobe Reader, Open pdf file, Close Adobe Reader). UiPath is a pure Robotic Process Automation tool, which was used to prepare the script using the Automated Record option and I’ve tried to do the same task using the AutoIT under the manual mode of script preparation (Writing script in IDE)

Before getting into the action items, I would like to share some important information as specified below;

What is Robotic Process Automation?

Robotic Process Automation (RPA) is the application of technology that allows employees in a company to configure computer software or a “robot” to capture and interpret existing applications for processing a transaction, manipulating data, triggering responses and communicating with other digital systems.

What is UiPath?

UiPath is a leading Robotic Process Automation vendor providing a complete software platform to help organizations efficiently automate business processes.

https://www.uipath.com/community

What is AutoIT?

AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks.

https://www.autoitscript.com/

Coming to the script preparation task using AutoIT, please find the below script which has been prepared (typed) using the AutoIT user defined functions; Please refer the comments before each user-action triggered ones;

#include <Constants.au3>

#include <ScreenCapture.au3>

#include <Date.au3>

#include <MsgBoxConstants.au3>

;

; AutoIt Version: 3.0

; Language:       English

; Platform:       Win x86/x64

; Author:         gopekanna@gmail.com

;

; Script Function:

;   Open Adobe Acrobat application, open the pdf file in the adobe acrobat application and close the ;adobe acrobat application.

;

; Location of the HTML test report

Local $location = “\Test\Adobe_Test_Report.html”

AdobeTest()

If @error <> 0 Then Exit MsgBox(16, “Adobe Acrobat”, “Error while accesing the pdf. Please read the user manual. @error = ” & @error)

Func AdobeTest()

; Run Adobe Reader

Run(“C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe”)

If @error <> 0 Then Exit MsgBox(16, “Adobe Acrobat”, “Error while opening the pdf Application. Ensure Adobe Acrobat installed in this computer. @error = ” & @error)

; Wait for the Adobe application to become active.

WinWaitActive(“[CLASS:AcrobatSDIWindow]”)

; Maximize the window

WinSetState(“[CLASS:AcrobatSDIWindow]”, “”, @SW_MAXIMIZE )

; Open the pdf file

WinActivate(“[CLASS:AcrobatSDIWindow]”,”Adobe Acrobat Pro”)

Send (“!f”)

Send (“{ENTER}”)

WinWaitActive(“Open”)

Sleep(2000)

;Send (@MyDocumentsDir & “\Test\Certificate.pdf”)

Send (“C:\Temp\Certificate.pdf”)

Send (“{ENTER}”)

Sleep(2000)

; Get the title of the screen

Local $sText = WinGetTitle(“[ACTIVE]”)

Sleep(2000)

;Ensure the expected window is displayed

If StringInStr ($sText, “Certificate.pdf”)  Then

; Take screenshot

_ScreenCapture_Capture(@MyDocumentsDir & “\Test\Pdf_File_Screenshot_Success” & @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC & “.jpg”)

Sleep(2000)

; Generate the HTML Report for success

FileWrite(@MyDocumentsDir & $location, “<b>PASS:</b> PDF file successfully opened. ” & “Date:” & @MDAY &”/”& @MON &”/”& @YEAR & ” ” & “Time:” & @HOUR & “:” & @MIN &”:”& @SEC & “<br/>”)

Else

; Take screenshot

_ScreenCapture_Capture(@MyDocumentsDir & “\Test\Pdf_File_Screenshot_Failure” & @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC & “.jpg”)

; Generate the HTML Report for failure

FileWrite(@MyDocumentsDir & $location, “<b>FAIL:</b> Error while open the PDF file. ” & “Date:” & @MDAY &”/”& @MON &”/”& @YEAR & ” ” & “Time:” & @HOUR & “:” & @MIN &”:”& @SEC & “<br/>”)

EndIf

; Close the Adobe Reader application

WinClose(“[CLASS:AcrobatSDIWindow]”)

; Wait till the application closed

WinWaitClose(“[CLASS:AcrobatSDIWindow]”)

MsgBox(64, “Message Box”, “Execution successfully completed!”,5)

EndFunc

; Finished

Please find the below video to visualize the execution part using AutoIT;

 

AutoIT_Adobe_Reader

Now UiPath coming into action based on the below script preparation steps using automated record option.

Please refer the below link for Video tutorials and User Guide to try UiPath community edition in your machine;

https://www.uipath.com/tutorials

https://studio.uipath.com/

  1. Download and Install the UiPath Studio using the below URL;

https://www.uipath.com/community-edition-download

  1. Open the UiPath Studio
  2. Create a new blank project “TestRun”
  3. Create a new sequence “TestRun” à xaml file
  4. Drag and drop “Open Application” and select Adobe Reader exe
  5. Open the Adobe Reader Application
  6. Start recording
  7. Click “Open” option under File menu
  8. Select the file location (Used Manual Recording option of “click by text”)
  9. Select the pdf file “Certificate.pdf”
  10. Wait for 5 seconds
  11. Close the pdf file

Please find the below video file to visualize the execution part in UiPath Studio;

 

UiPath_Adobe_Reader

Thank you!!!

Looking forward to move towards the Business Process use cases in the forthcoming posts…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s