Should you haven’t completed the previous lab, you can import the solution into your RPA Builder. This way, you’ll make sure to continue the module from the right step.
Lab 4: Implementation - Automate Data Entry into Legacy App
Prerequisites
Start from previous lab solution
Create process to overwrite
-
First of all you need to locate the category to use when creating your process, please follow instructions in Lab 1: Step 1: Locate the workshop’s Process Category if you do not know how do it, then continue with following steps.
-
You have now to create a new process named
<your name and surname/initials>-Module 1-Automate Data Entry into Legacy App
, please follow instructions in Lab 1: Step 2: Create the Process if you do not know how do it, then continue with following steps. -
Last but not least you have to move the process to the
Build
phase, this in order to have it showing up in RPA Builder. Please follow instructions in Lab 1: Step 4: Move Process to the Build Phase if you have no idea how do it.
Import process from previous lab solution
-
Connect to your Windows EC2 Instance
If you need help connecting to the Windows EC2 Instance, please follow instructions in Lab 2: Step 1: Connect to Windows EC2 Instance, then continue with following steps.
-
Open RPA Builder.
If this is your first time opening RPA Builder, then you need to configure it as explained in Lab 2: Step 2: Configure RPA Builder and Open the Process until you see your process in the Repository Explorer.
-
Open the project you want to overwrite with the lab solution. Make sure you open YOUR project not to overwrite other’s.
-
From the Windows VM, download the
Module_1_Lab_3_completed.crpa
file referred to the solution of the previous lab.You should have the Google Drive link sent to you along with the credentials and other workshop material. This drive contains the solution for all Labs. If you do not have access, ask the instructor.
-
Once opened, click the
Import Project
option under theFile
menu: -
Click
Yes
in the confirmation dialog, locate your just downloaded.crpa
file and clickOpen
to import it.
You can now continue with the lab.
Step 1: Set up the basics
-
Open the
Insert Data in the system
existing activity. Configure all the Activity Parameters that will be used: -
Drag and drop three
Group
steps and name them as follows:Start Legacy Application
Login
Go To New Invoice Form
Step 2: Start the Legacy Application
We will be working on the Start Legacy Application
group.
-
Drag and drop a
Run Program
step and open its wizard. -
Name it as
Open Legacy Application
and click on theSelect File path
dropdown menu option on theFile name
field:Navigate to the
Desktop\LegacyApps\Java
folder and select thestart.bat
file.Expand the Insert Environment Variable dropdown list and select the
%USERPROFILE%
one. It will be added at the beginning of the just populatedFile name
path. Remove theC:\Users\workshop
entry to leave the path as follows:%USERPROFILE%\Desktop\LegacyApps\Java\start.bat
-
Set the
Start mode
toMinimized
. Expand theWait on Creation
section, check theWait for window to appear
option and set theWindow Title
exactly toNTO Login
:Click
OK
to save and close. -
Let’s test everything works as expected. Click the activity’s
Run
button and see what happens:The Legacy App is opened and once the login window (with title
NTO Login
) is displayed, the execution finishes andRPA Builder
is restored to the foreground.
Step 3: Login
We will be working on the Login
group.
-
For the login we will use the
systemLogin
activity parameter which is of typeuser account
.user account
type contains user credentials and are always encrypted at rest. The only way to use the underlying data (username and password) in an activity is by first decrypting them at runtime.Drag and drop a
User Account Decrypter
, name it assystemLogin
and select theActivity Parameters.systemLogin
variable for theUser account
:Click
OK
to save and close. -
Bring the Login window to the foreground.
You can notice that the
Username
input box is already focused (a blinking cursor is on it). We could inject the credentials right away, but we’re going to ignore that and pretend the focus is not yet there. Why?, to show you how you can make sure to set the focus on the field of your election for future use cases.Drag and drop an
Image Search
step and open it. Name it asSearch for Username
.Click the
Start from scratch
button to capture your pattern image.Move and resize the capture window to select the
Username
label as follows:Press
F10
to validate the capture window.Click the
Full Screen
button andCapture
to confirm the selection. -
Back in the wizard, select the
Contour Plus
algorithm, check theWait until image is steady
option and clickOK
to save and close: -
Now that we locate the
Username
label in the application, we want to left-click on the input box that is located slightly on its right, to set the focus on it.To do so, drag and drop a
Mouse Actions
step and open it. Name it asClick on Username input box
.Notice how the
Relative To
setting is automatically set to the X/Y coordinates of the previous Image Search. This means that any click captured will always be based on such coordinates.Click on the
Start
button to capture the mouse actions:When the Login window appears, simply left-click anywhere on the Username input box as follows:
Press
F10
to end the capture. The mouse event will have been saved. ClickOK
to save and close. -
We’re now ready to inject the username and password and perform the login.
Drag and drop a
Keystrokes
step and name it asPerform Login
. The Keystrokes activity allows you to simulate keyboard entries.In the wizard window, click on the
+
button to enter a number of keystrokes as follows:Keystroke type Value Script Variable
systemLogin.Username
Special Character
TAB
Script Variable
systemLogin.Password
Special Character
TAB
Special Character
SPACE
Click
OK
to save and close. -
Let’s test what we have done so far.
First close the Legacy Application.
Then, click the
Run
button and see what happens:Login is performed,
RPA Builder
is restored in the foreground and you can see how the main application window is then loaded. We will be doing the rest of the operations on such main window, but it takes some time to get loaded. We do need to wait until it gets loaded before entering the invoice data! -
Going back to
RPA Builder
drag and drop aWindow Wait
step still in theLogin
group.Name it as
Wait for main Window
.As the legacy application main window is already loaded as we did the previous test, we can click on the
Collect window titles
to get all the current window titles in our Windows box. Once clicked, you can open theWindow title
dropdown list and locate theNTO Financial Module (normal)
one.Leave the rest of the settings as default and click
OK
to save and close.If you do a new test (remember to first close the existing instance of the app), you will see how
RPA Builder
is not restored to the foreground until the main window is displayed and detected by this lastWindow Wait
step. -
The
Login
group is now fully completed and this is how it should look like:
Step 4: Go to New Invoice Form
We will be working on the Go to New Invoice Form
group.
-
This one is easy. To move from the current tab to the New Invoice one, we just need to press
ALT-3
and an additional TAB to set the focus to the first input field.Do so using a single
Keystrokes
step. Dreag and drop one, name it asMove to New Invoice Form and set focus
and add anALTDOWN
,3
andALTUP
keystokes followed by aTAB
: -
Close the legacy app first and then click on
Run
once again to see everything works as expected. Notice how the cursor is moved to the first input field at the very end.
Step 5: Insert Data
-
Now that we have the focus on the first input field (Invoice Number), we can proceed to enter the data.
Drag and drop a new Group and name it as
Insert Data
.Within a single Keystokes step, you will be adding all data and moving the focus between all the input boxes. Again, all in a single step.
-
Drag & drop a Keystrokes step inside. Name it as
Enter All Data
.Double-click on it to open the wizard window. Click on the
+
button to start adding data/keystrokes:First, you need to enter the Invoice Number data.
In the Keystrokes Editor expand the Insert Script Variable dropdown list and locate and select the
Activity Parameters.invoiceNumber
variable.Expand the Insert Special Character dropdown list and locate and select the
TAB
entry.This is how it should look like so far:
Click OK to finalise. See how the invoiceNumber variable and TAB keystroke looks like:
-
Repeat the previous operations to add the following:
${Activity Parameters.invoiceDate}{TAB}
${Activity Parameters.invoiceDueDate}{TAB}
${Activity Parameters.invoicePurchaseOrder}{TAB}
${Activity Parameters.invoiceTotals}
(no{TAB}
is needed here)
Step 6: Save and Close
We have entered all data however we haven’t saved it yet!
-
Drag and Drop a new Group and name it as
Save and Close
. -
Add a Keystrokes step and name it as
TAB to Save button and click
.Add the following keystrokes one after the other:
TAB
,SPACE
andSPACE
(this last one to close the informative dialog box) -
Finally, we need to close the Legacy application.
There are many ways to close an application: use keyboard shortcut, mouse clicking, ask window to close or kill the app… all these can be done with MuleSoft RPA. On this case, we’ll use the
ALT-F4
keyboard shortcut.Drag and drop a new Keystrokes step and name it as
Close the app
.Add an
ALTDOWN
,F4
andALTUP
keystokes:This is how the activity should look like now:
-
If you want run a last test on the Activity and see how everything is working, including the application closure:
Please proceed to Lab 5 - Implementation - Clean Up & Share