Anda di halaman 1dari 56

Surface Automation

ADVANCED TRAINING GUIDE


Version: 6.0

For more information please contact:


info@blueprism.com | UK: +44 (0) 870 879 3000 | US: +1 888 7577476
www.blueprism.com
Contents
Introduction ..................................................................................................................................................................... 5
Exercise 1.1.1 Application Familiarisation ............................................................................................................ 5
Exercise 1.1.2 Object Model ................................................................................................................................. 6
Exercise 1.1.3 Launch ........................................................................................................................................... 6
Exercise 1.1.4 Window Title wildcard................................................................................................................... 7
Exercise 1.1.5 Log In ............................................................................................................................................. 8
2 Data Output ............................................................................................................................................................. 9
Exercise 2.1.1 Get Account Details ....................................................................................................................... 9
Exercise 2.1.2 Radio Buttons .............................................................................................................................. 10
Exercise 2.1.3 Checkboxes .................................................................................................................................. 11
3 Data Input .............................................................................................................................................................. 12
Exercise 3.1.1 Text Boxes.................................................................................................................................... 12
Input Validation...................................................................................................................................................... 12
Exercise 3.1.2 Radio Buttons and Checkboxes ................................................................................................... 13
Exercise 3.1.3 Drop Down Lists .......................................................................................................................... 13
Exercise 3.1.4 Drop Down Input - method 1 ...................................................................................................... 13
Exercise 3.1.5 Drop Down Input - method 2 ...................................................................................................... 13
Exercise 3.1.6 Drop Down Input - method 3 ...................................................................................................... 14
4 Navigation .............................................................................................................................................................. 16
Exercise 4.1.1 Wait for Image – part 1 ............................................................................................................... 16
Exercise 4.1.2 Wait for Image – part 2 ............................................................................................................... 17
Exercise 4.1.3 Child Windows and Dialog Messages.......................................................................................... 17
Exercise 4.1.4 Tabs.............................................................................................................................................. 18
5 Tabulated Data ....................................................................................................................................................... 19
Reading with Dynamic Regions.............................................................................................................................. 20
Exercise 5.1.1 Dynamic Region – part 1 ............................................................................................................. 20
Exercise 5.1.2 Dynamic Region – part 2 ............................................................................................................. 22
Exercise 5.1.3 Dynamic Region – part 3 ............................................................................................................. 23
Exercise 5.1.4 Dynamic Region – part 4 ............................................................................................................. 24
Exercise 5.1.5 Dynamic Region – part 5 ............................................................................................................. 26
Clicking a Dynamic Region ..................................................................................................................................... 27
Exercise 5.1.6 Global Mouse Click ...................................................................................................................... 27

Commercial in Confidence Page 2 of 56


Paging and Scrolling ............................................................................................................................................... 29
Exercise 5.1.7 Control Familiarisation ................................................................................................................ 29
Exercise 5.1.8 Using the Scroll Button ................................................................................................................ 29
Exercise 5.1.9 Using the Down Key .................................................................................................................... 30
Exercise 5.1.10 List Regions ................................................................................................................................ 32
Exercise 5.1.11 Combining List Region Results .................................................................................................. 35
Exercise 5.1.12 Detecting Column Position........................................................................................................ 37
Exercise 5.1.13 Determining Column Width ...................................................................................................... 39
6 Advanced Topics .................................................................................................................................................... 40
6.1 Fonts ............................................................................................................................................................ 40
Identifying Fonts .................................................................................................................................................... 40
Qualifying Fonts ..................................................................................................................................................... 40
Creating a Font via Region Editor .......................................................................................................................... 40
Creating a Font via System Manager ..................................................................................................................... 42
Font Files ................................................................................................................................................................ 43
Character Conflicts................................................................................................................................................. 43
6.2 Performance ................................................................................................................................................ 44
7 Further Exercises ................................................................................................................................................... 45
Exercise 7.1.1 SA Training – Log In ..................................................................................................................... 45
Exercise 7.1.2 SA Training – Find Account.......................................................................................................... 45
Exercise 7.1.3 SA Training –Account Details ...................................................................................................... 45
Exercise 7.1.4 SA Training –Account Notes ........................................................................................................ 45
Exercise 7.1.5 SA Training – Note ....................................................................................................................... 45
8 Utilities ................................................................................................................................................................... 45
9 Summary ................................................................................................................................................................ 46
10 Appendix ................................................................................................................................................................ 47
10.1 Object Model ............................................................................................................................................... 47
SA Training – Log In ................................................................................................................................................ 47
SA Training – Find Account .................................................................................................................................... 47
SA Training – Account Details ................................................................................................................................ 47
SA Training – Account Notes ................................................................................................................................. 48
SA Training –Note .................................................................................................................................................. 48
10.2 Send Keys ..................................................................................................................................................... 49
Global Send Keys .................................................................................................................................................... 49
Global Send Key Events.......................................................................................................................................... 50

Commercial in Confidence Page 3 of 56


The training materials and other documentation (“Training Materials”) provided by Blue Prism as part of the training course are Blue
Prism’s Intellectual Property and Confidential Information. They are to be used only in conjunction with the Blue Prism Software which
is licensed to your company, and the Training Materials are subject to the terms of that license. In addition, Blue Prism hereby grants to
you a personal, revocable, non-transferable and non-exclusive license to use the Training Materials in a non-production and non-
commercial capacity solely for the purpose of training. You can modify or adapt the Training Materials for your internal use to the
extent required to comply with your operational methods, provided that you shall (a) ensure that each copy shall include all copyright
and proprietary notices included in the Training Materials; (b) keep a written record of the location and use of each such copy; and (c)
provide a copy of such record to Blue Prism on request and allow Blue Prism to verify the same from time to time on request.

For the avoidance of doubt, except as permitted by the license or these terms, you cannot (a) copy, translate, reverse engineer, reverse
assemble, modify, adapt, create derivative works of, decompile, merge, separate, disassemble, determine the source code of or
otherwise reduce to binary code or any other human-perceivable form, the whole or any part of the Training Materials; (b) sublease,
lease, assign, sell, sub-license, rent, export, re-export, encumber, permit concurrent use of or otherwise transfer or grant other rights in
the whole or any part of the Training Materials; or (c) provide or otherwise make available the Training Materials in whole or in part in
any form to any person, without prior written consent from Blue Prism.

© Blue Prism Limited, 2001 - 2017

All trademarks are hereby acknowledged and are used to the benefit of their respective owners.
Blue Prism is not responsible for the content of external websites referenced by this document.

Blue Prism Limited, Centrix House, Crow Lane East, Newton-le-Willows, WA12 9UY, United Kingdom
Registered in England: Reg. No. 4260035. Tel: +44 870 879 3000. Web: www.blueprism.com

Commercial in Confidence Page 4 of 56


Introduction
This course is intended for Blue Prism users who have successfully completed both the Blue Prism Foundation
Training and the Surface Automation – Basic Training course. The topics in this course are advanced and are not
suitable for novices.

This course will cover the advanced principles of an integration method called Surface Automation. Surface
Automation is a technique for working with images and although primarily used on thin-client applications, it can
also be applied to any application with a user interface.

For the exercises in this document we will employ Blue Prism’s Surface Automation Training thick-client
application to simulate the effect of a thin client. And some of the exercises here will be deliberately less
prescriptive than in the basic training course.

Key Point

• Although we can spy the Surface Automation Training application as normal (i.e. using Win32 and AA), for
these exercises we are going to pretend that we can’t and work with it using Region mode.

Exercise 1.1.1 Application Familiarisation


• Launch the Surface Automation training application you used in the basic training course (not the Image
Loader application).
• Recall that to log in you can use any user name, as long as the password is the same as the user name.
Leave the System drop-down with its default value of ‘Account’.
• Navigate around the application to familiarize yourself with the functionality. Note that changes to data are
not preserved in the underlying database but the application will respond as if they are.
• Use the Find button and Find Account dialog to search for records. Some Account IDs you could use are:
24064631484213, 96463268719814 or 60273292295243.
• When in an account, click on the Notes tab and double-click on any row in the table to show the View Note
dialog (notes courtesy of Shakespeare, W).

Commercial in Confidence Page 5 of 56


Exercise 1.1.2 Object Model
A number of template Business Objects have been prepared for you and we will build upon these during the
course. Tables describing the object model are provided in the Appendix of this document.

• Import the Surface Automation Training - Base Objects.bprelease file to load the 5 Business Object
Templates.

• Open one or two of the Business Objects to see how they have been set up.

Exercise 1.1.3 Launch


We developed a basic Log In page during the basic training course and we’ll recreate that logic to reacquaint
ourselves with Region Editor.

• Open the SA training – Log In object.


• Open Application Modeller, change the path to Surface Automation Training.exe to suit your folder
structure and press Launch.
• Spy the main window element using Region Mode (press ALT twice) and create an image region around
Surface Automation Training Log In label.

Commercial in Confidence Page 6 of 56


• Close Region Editor and complete the Launch page in basic fashion with a Navigate and a Wait stage doing
‘check exists’ with the region.
Key Point

• The Surface Automation Training application has been designed to make things a little difficult by
displaying the current date in the title bar.

• As you know, a region is an area of a Win32 element, and as such the Window Text attribute can play a role
in identifying the region. Today the default attribute will work but tomorrow it will not.

Exercise 1.1.4 Window Title wildcard


The remedy to the Window Title problem is to use the wildcard match type, i.e. ‘Blue Prism Training*’.

• Change the Match Type of the Window Text attribute of your region to * (Wildcard) and change the Value
to Blue Prism Training*
• Now select the W32 element above your region and change the Window text attribute in the same way.
Importantly, this will ensure that any new region you create under this element will carry the same
wildcard setting.

Commercial in Confidence Page 7 of 56


Exercise 1.1.5 Log In
• Return to Region Editor by pressing the Regions button.

• Create image regions for the User Name labels and the Log In and Reset buttons. Use the default
properties for all. If you recall from the previous course, the run time image search starts in the design time
position, so here reducing the padding won’t make the search more efficient.
• Create coordinate regions for the User Name and Password fields. Position the regions neatly just inside
the bounds of each field.
• Relate the coordinate regions to their respective labels.

• Recreate the logic from the basic training course to populate the Log In screen and press the button.
Remember to use the Pause After Each Step field to introduce pauses between Navigate actions. Note that
a set of global data items are available on the Initialise page.

Commercial in Confidence Page 8 of 56


• Also experiment with the Interval input to Global Send Keys. For this application an interval is probably not
required but on some it’s necessary to send keys at a slower speed.
• In Application Modeller, create a new element and spy the Account Details screen with Region Mode.
• Create an image region around the Find button and use it in the Wait stage at the end of your Log In page.

• Run the page to check it works. Remember what we learnt in the basic training course about obscuring the
target app.
• Once you are happy with your Log In page, save and close your object.

2 Data Output
Exercise 2.1.1 Get Account Details
In this exercise we’ll concentrate on reading from the application, which by default uses Arial 9.5 as its font.

• In System Manager, create a font definition for Arial 9.5


• In the training application, manually find an account of your choice.
• Open the SA Training – Account Details object, attach and spy the main window with Region Mode.
• Create an image region around the Account ID label, name the region appropriately, and press OK to close
Region Editor.
• As before, modify the Window Title attribute match type of the region element and the Win32 element
above it. Check that both can be highlighted.
• Return to Region Editor by pressing the Regions button.
• Create a coordinate region just inside the Account ID field. Assign Arial 9.5 as the font and make the region
dependent on its label (i.e. the image region).
• Confirm that the new region will highlight and close Application Modeller.
• Go to the Get Details page of your object and add a Wait stage to perform ‘Check Exists’ on the Account ID
label region. Use one of the global data items for the time out value – the medium one should be enough.
• Connect the wait condition to the End and add an Exception stage to the other end of the Wait stage.

Commercial in Confidence Page 9 of 56


• Run the page to check it works, and then add a Read stage before the End stage. Link the Wait stage to the
Read and the Read to the End.
• Set up the Read stage to apply Recognise Text on the Account ID field. The field background colour is
F8F8FF, so use this as the Background Colour input. Remember you don’t specify both foreground and
background colours.
• Run the page to conform that the Account ID is read as expected. If it is not, then check the position of the
coordinate region, it could be that it is too tight around the text.
• Continue to model all the other fields apart from the Gender radio buttons and the Verified checkbox.
There is no need to add Wait stages for each field, just add more Read stages. Note that the background
colour of the Title drop-down is F0F0F0.

Exercise 2.1.2 Radio Buttons


Evidently a radio button does not contain text and therefore we cannot use Recognise Text. We can however, with
careful modelling, we can use a Wait stage to tell us if a radio button is selected.

• Go back to Application Modeller, select one of your region elements and press the Regions button to open
Region Editor.
• Zoom the image to 500% and scroll one of the radio buttons into view.
• Create a coordinate region that sits precisely inside the radio button, without touching the sides.

• Then create an image region around the label that is the parent of the coordinate region.

Commercial in Confidence Page 10 of 56


• Back in Object Studio, add a Wait stage and set it up with two rows, both using the Uniform Colour
condition. The first should be Uniform Colour = True and the second Uniform Colour = False.

• Connect the branches of the Wait stage to two Calculation stages, one to set a flag to False and the other
to True.

Exercise 2.1.3 Checkboxes


Checkboxes can be treated in the same way as radio buttons.

• Create a coordinate region just inside the Verified checkbox.


• Create an image region around the label and make it the parent of the checkbox.

Commercial in Confidence Page 11 of 56


• Then use a Wait stage to decide if the coordinate region contains a uniform colour or not. If it doesn’t then
we know it is checked.

3 Data Input
Exercise 3.1.1 Text Boxes
You have already dealt with entering values into textboxes on the Log In screen and populating the Account Details
screen is no different.

• Manually press the New button to prepare the Account Details screen.
• At the start of the Set Details page of your object, place a Wait stage that checks for the Account ID field.
• After the Wait stage place a Navigate stage that populates the field. Recall from the Log In page that you
can send keys like {HOME}{DELETE 20} to make sure the field is empty before you enter your value.
Remember also that Global Send Keys requires that the target application is active and that the cursor is in
the right place.

• Once you have Global Send Keys working, try the ‘paste from clipboard’ method we used in the basic
training course.

Input Validation
In very rare circumstances, which are wholly dependent on the target application, you may see inconsistencies with
Send Keys, where the characters arrive in a different order, e.g. ‘12435’ instead of ‘12345’. Increasing the Interval
input value is likely to cure this problem, but it may also be necessary to read back the data entered to confirm the
input is correct.

Commercial in Confidence Page 12 of 56


Key Points

• It is only recommended that this method of validating all text entry is used if a reliability issue has been
found with Send Keys during your testing.

• Even where testing has shown that such validation is not required, it may be deemed prudent to read back
any critical text entry (e.g. financial transactions) as a means of mitigating risk.

Exercise 3.1.2 Radio Buttons and Checkboxes


Input for these types of controls is simply a case of sending a Global Mouse Click to the centre of the region. The
slight complication is that we need to read the control first to make sure we know whether a click will select or
unselect.

• Add a two-branch Wait stage to the Set Details page as before, so that you can detect whether the Verified
checkbox is ticked or not. On the ‘not ticked’ branch add a Navigate stage to click the checkbox.
• The Gender input is a little more work because it has wo radio button, but the same principle applies –
check the current state and then click if necessary.

Exercise 3.1.3 Drop Down Lists


Now things will start to get a little more difficult because will have to pay close attention to the synchronisation of
our Surface Automation and the behaviour of the training application. Drop-down lists (also known as combo-
boxes) don’t all behave in the same way, and a degree of experimentation will be required to work out the best
input technique. In the following exercises we’ll try some different options.

Exercise 3.1.4 Drop Down Input - method 1


This method is essentially the same as a text box input but it’s effectiveness depends on the target application – on
some drop down lists it will not work.

• Manually prepare the Account Details screen in readiness for a new account.
• In your diagram, add a Navigate stage to focus the Title field with a Global Mouse Click Centre.
• Then use Global Send Keys to enter ‘Mr’. You should see that the correct list item is automatically selected.

Exercise 3.1.5 Drop Down Input - method 2


As with any input that relies on Global Mouse Click and Global Send Keys, it can be prudent to also read the field to
check that the value has been entered correctly. In this method we will combine input and output to arrive at the
correct selection

• Manually Press the New button to reset the Account Details screen.
• Use a Navigate stage to open the Title list with a Global Mouse Click aimed at the button on the right-hand
end of the combo box. Coordinates x=190 and y=10 should work.
Key Point

• A Global Mouse Click can use coordinates outside the bounds of a region or element.

• Then use Global Send Keys to enter {DOWN} for the down arrow key.

Commercial in Confidence Page 13 of 56


• Add a Read stage after the navigate to read the Title field. Note that the font colour will be white, FFFFFF.
• After the Read stage place a Decision stage with the expression [Screen Text]=[Title]
• Link the No branch of the decision back to the down key Navigate stage and the Yes branch to an End
stage.
• Run the page and you should see the list open and the down key move through the list of items.

Evidently this method assumes that the target item is below the current item. Where this is not the case, then it
may be necessary to use {UP} to travel up the list, or maybe use {HOME} to travel back to the first item and then
move down from the top. As awkward as this sounds, sometimes it is the only way to manage a combo box via
Surface Automation.

Exercise 3.1.6 Drop Down Input - method 3


This method is a combination of the two previous methods. If a combo box doesn’t allow you to select an item by
simply typing the value, it may allow you to type the first letter of your item to jump down the list, instead of
moving through every item.

• Reset the Account Details with the New button as before.


• Introduce a new Navigate to send the first letter of your Title value via Global Send Keys. The Left function
will be ideal here.
• Then move your ‘down key’ Navigate stage to the ‘No’ branch of the decision.

Commercial in Confidence Page 14 of 56


Note that when using this technique, the combo box will only partially highlight the selected text in blue. This gives
us a problem because Recognise Text is expecting a white font. How could this be resolved?

A simple solution would be to modify the expression in the Decision stage to compare the part of the Title that
Recognise text will see, e.g. [Screen Text]=Mid([Title], 2, Len([Title]))

Key Point

• The methods described above are examples of how a combo box might be handled. These techniques may
require adjustment to suit the combo boxes you will encounter in the real world.

Commercial in Confidence Page 15 of 56


4 Navigation
As with navigation of Windows, mainframe, Java or web application, Surface Automation navigation follows the
same dependable pattern.

1. Confirm current state is as expected.


2. Initiate navigation.
3. Wait for predicted change of state.

Exercise 4.1.1 Wait for Image – part 1

Already you will have noticed the icon indicating the locked status of the account record and that it’s change of
state is not instantaneous. You will also be aware that the speed of execution in Control Room is far higher than in
Object Studio and that simply clicking the icon without waiting will not work. As always, we have to make our
object keep pace with the state of the target application.

• Press the Regions button in Application Modeller to open Region Editor.


• Create an image region around the padlock icon and name it as ‘Locked Icon’.
• Close Region Editor and press Add Element in Application Modeller to create a new element.
• Press New to reset the Account Details screen and then click the icon to unlock.
• Return to Application Modeller and press Identify to spy the main window with Region mode.
• When Region Editor opens, create an image region and call it ‘Unlocked Icon’.
• Close Region Editor and adjust the Window Text attribute to use a wildcard match, as we did previously to
account for the current date used in the window title. Make the same change to the Win32 element and to
the new region element.
Now we have regions for both possible states of the icon, let’s use then in our Business Object.

• Go to the Unlock page and add a Navigate and a Wait stage.


• Have the Navigate click the locked icon and the Wait stage wait for the unlocked icon.

• Run the page to check that it works. Remember to add in an Activate Application and to use the Pause
After Each Step field.
• If you wish, you could create an Unlock page to do the opposite operation.

Commercial in Confidence Page 16 of 56


Exercise 4.1.2 Wait for Image – part 2
You may have noticed that when you press Save a spinning icon appears to the right of the New button. This to
simulate the data being saved to a back-end database. The problem for Surface Automation here is that no
indicator appears when the save is complete, and so we will have to wait for the absence of the spinning icon.

• Create a coordinate region to the right of the New button where the spinning icon appears. Don’t worry
about the accuracy, the region only need to be approximate.
• Create another image region for the Save button.
• On the Save page of your Business Object use a Navigate to click the Save region.
• After the Navigate use a Wait stage with the Uniform Colour = False condition.
• Then add a second Wait that has the Uniform Colour = True condition.

Here the first Wait stage tells us that the save is in progress and the second tells us when it is complete.

Exercise 4.1.3 Child Windows and Dialog Messages


In this exercise we’ll deal with the Find Account window.

Commercial in Confidence Page 17 of 56


• Press the Find button to make the Find Account window appear.
• In Application Modeller create a new element and spy the main window (not the Find Account window)
with Region Mode. Even though we can spy the Find Account Window, for this exercise we’ll pretend we
can’t.
• Create an image region around the Find button and another around the Find Account window title.
• Close Region Editor and check that Highlight works as expected.
• On the Navigate to Find page of the SA Training - Account Details Business Object, add a Navigate and a
Wait stage. By now you’ll know the Navigate is to click the button and the Wait is to check for the
appearance of the window.
• Run the page to check it works, then manually close the Find Account window.

Exercise 4.1.4 Tabs


There are two tabs on the Account Details screen, one for the account and one for the notes. The tab buttons have
two states, selected and unselected.

Navigating between tabs is very much like the lock/unlock logic we created previously.

• Spy the tab buttons as coordinate regions.


• Look closely at the buttons and see how the background of a selected button contains white and the
unselected button background is grey. As with the checkbox earlier, with a carefully positioned region we
can use this visual difference to determine the state of the button.

Commercial in Confidence Page 18 of 56


• On the Navigate to Notes page of the SA Training - Account Details Business Object use a Navigate to click
the Notes tab button. In the Wait stage that follows, use the Contains Colour condition with FFFFF (white)
as the colour input.

• Run the page to check that it works. Add an Exception stage to the time out of the Wait to finish off the
page.
• Then copy the Navigate, Wait, End and Exception stages from the page and paste onto the Navigate to
Details page.
• Adjust the Navigate and Wait properties to use the Account button region and then run the page to check
that it works.

5 Tabulated Data
As you will have seen, the Notes tab presents a large table of notes. In these next exercises we will learn how to
make a coordinate region move from row to row so that we can read the table.

Commercial in Confidence Page 19 of 56


Reading with Dynamic Regions
A ‘dynamic’ region is simply a coordinate region that uses the Dynamic Match Type for some of its coordinate
attributes. As you will remember from your Foundation Training, the value of an attribute with the Dynamic Match
Type is not fixed in Application Modeller; instead, the value is supplied from Object Studio at run time. This enables
us to adjust and reset the attribute value while the Business Object is in motion.

Exercise 5.1.1 Dynamic Region – part 1


When using a dynamic region to read a list, it is imperative to know the exact spacing of the rows. In this training
application the distance between one row and the next is 25 pixels. Make a mental note of that number and take
care to follow the following steps closely.

• Close your SA Training - Account Details Business Object and open SA Training - Account Notes.
• Create a coordinate region that fits inside the first Agent cell around the text.

• Close Region Editor and set the Window Text attribute to wildcard, as we have done before. Remember to
change the region element and the Win32 element above it.
• Apply the Dynamic Match Type to the Start Y and End Y attributes of the region.
• Make a note of the Start Y value, which in this example is 161. Your value might be a little different.

• Return to Region Editor and create an image region on the Agent column header. As below, note that this
region does not need to sit perfectly around the word ‘Agent’ as we won’t be reading text from it. The role
of this region is to anchor the cell region, so it is enough that the header region is visually unique and has
enough padding to be found.
• Make the cell region position relative to the header region.

Commercial in Confidence Page 20 of 56


• Close Region Editor and make a note of the Start Y attribute of the header region. In the example depicted
here the value is 144 but it doesn’t matter if yours is slightly different.
• Calculate the vertical height between the two regions. In this example it is 161-144=17 but again, your
answer might be a little different. Make a mental note of the result.
• Close Application Modeller and add Read stage that applies the Get Bounds method to the header region.
Create an undefined collection called Bounds to use as the Store In value. Recall from your training that an
undefined collection is one with no predefined fields.

• Now add three number Data Items called Start Y, End Y and Row Height. Set the initial value of Row Height
as 25.
• After the Read stage, add a Multi-calculation stage to work out the values of Start Y and End Y. At run time
the Bounds collection will have a field called Top, and we will add the 17 (remember you might have a
slightly different value) to it to calculate the position of the top of cell region. We’ll assume a region height
of 20 and use that in the second calculation.

• After the calculation, add a Read stage that applies Read Image to the cell region. And because the cell
region has dynamic attributes, you will need to press the Params button to supply values for them.

Commercial in Confidence Page 21 of 56


• Finally, as we have done before, add a Navigate stage to the start of the page to activate the target
application.
• Run your page and it should look something like this.

Exercise 5.1.2 Dynamic Region – part 2


Admittedly, at this stage the result may not seem impressive, given the number of steps it’s taken to get here.
However, let’s continue and introduce a loop to make the cell region move down the rows.

• Add a new number Data Item called Row and set its initial value to zero.
• Drag the End stage away from the Read stage and introduce a Calculation stage to increment the Data Item
by one.
• Note that the training application displays thirteen rows at a time, but the thirteenth row is not fully visible.
With the Surface Automation mantra of ‘if you can’t see it then neither can Blue Prism’ in mind, for now
let’s concentrate on the first twelve rows only.
• Add a Decision stage after the Multi-calculation that uses the expression [Row] >= 12. Link the Yes branch
to the End stage.
• Create another Multi-calculation and add in the following expressions.

Commercial in Confidence Page 22 of 56


• Link the No Branch of the Decision to this Multi-calculation and then link back around to the Read stage.
Your diagram should now look something like this.

• Run the page and then look at the image Data Item. You should see an image of the Agent cell from the
twelfth row. The cell border should not be visible.

Exercise 5.1.3 Dynamic Region – part 3


Again, you may still be wondering what we are doing here. The previous exercises are intended to show you that
‘pixel perfect’ precision is required when moving a dynamic region down a list. Inaccuracies may not be evident at
first, but at as we move further down the rows, a small inaccuracy can develop into a significant error.

• As an example, change the initial value of the Row Data Item to 24 and re-run your page.

Commercial in Confidence Page 23 of 56


• Your page did not yield any exception, so what is the problem? Take a look at the image Data Item, you
should see that it is badly misaligned, and that Recognise Text would have no chance of success.

• Put the Row Data Item back to 25.

Exercise 5.1.4 Dynamic Region – part 4


Now that we know our coordinate calculations are accurate, let’s use Recognise Text to capture the table values.

• Open the properties of the Notes collection and see that it has been set up with three fields.
• Add a new row to the cell Read stage and use Recognise Text to store a value in the Agent field of the
Notes collection.

• Press the Params button to supply the Start Y and End Y dynamic attributes.

• For the Font, you have the option of providing the font name in the Read stage or setting it in Region
Editor. In practice we would probably do the latter but here we will do the former. The font is Arial 9.5 and
because the application text is black, we don’t need to provide a foreground colour (or a background
colour).

Commercial in Confidence Page 24 of 56


• Now place an Action stage above the cell Read stage and set it up to add a new row to the Notes collection.
Make sure to link the loop to the Action stage instead of the Read stage.

• Run the page and then look at the current values in the Collection. You should see that the twelve cells
have been read.

Commercial in Confidence Page 25 of 56


Exercise 5.1.5 Dynamic Region – part 5
Now we have a mechanism for reading the first column, adding more columns will be easier.

• Open Application Modeller and press the Regions button to open Region Editor.
• Create a new coordinate region inside the first Date cell and relate it to the Agent header region. We could
create a new Date header region, but here we can simply reuse the Agent header region.
• Close Region Editor and use Copy Element Mask to copy the attribute selection from the Agent cell region
and paste it onto the Date cell region. This is a quick way to apply the same Match Type settings.

• Edit the Read stage properties to use Recognise Text to read the Date cell. Remember to set the dynamic
attributes Start Y and End Y, and to provide the font name Arial 9.5

Commercial in Confidence Page 26 of 56


• Run the page again and you should find that the dates are read into your collection.
Key Point

• When reading character data from an application, it is usually better to use the Text data type, even for
values like dates. The reason for this is that it avoids any potential casting errors at the read stage and
provides the opportunity to resolve problems after the data has been captured.

• This principle applies to any read technique, not just Surface Automation.

Clicking a Dynamic Region


At this point we have a mechanism for reading the first page of the Notes table. We’ll look at reading past the first
page in later exercises, but now let’s see how to send a mouse click to a row, so that we can open an individual
note.

Exercise 5.1.6 Global Mouse Click


To click a row in the table we could just work out where the coordinates in relation to the table position and the
row height. That method would certainly work, provided the table position was constant. This exercise reuses the
header-cell relationship we developed in the previous exercises and as such provides a more flexible mechanism.

• Copy the Navigate, Read, Multi-calculation and Data items from the start of the Get Details page of your SA
Training - Account Notes Business Object.

Commercial in Confidence Page 27 of 56


• Paste them on to the Navigate to View Note page.
• Add a new Multi-calculation called target Row and another Navigate stage called click, as shown below.

• Add two expressions to the new Multi-calculation stage to calculate the Start Y and End Y Data Items.

• Use these Data Items as dynamic attribute values for a Global Mouse Click Centre in the new Navigate
stage.

Commercial in Confidence Page 28 of 56


• Set the initial value of the Row Data Item to 7 and then run your page. You should see the mouse click
select the seventh row.
• For a double click, add a second row to the Navigate stage with a small pause between.

• As with any navigation, in practice we would use a Wait stage to confirm that the expected effect took
place, but for the purpose of this exercise we will do without.

Paging and Scrolling


As mentioned previously, Surface Automation is about interpreting an image, i.e. what you can see. Elements that
scroll out of view, such as our Notes table, require more effort because we have to force the hidden elements into
view. Synchronising this movement with our regions is the challenge we will tackle in these next exercises.

Exercise 5.1.7 Control Familiarisation


As with combo boxes, not all tables and lists have the same behaviour when it comes to scrolling. Some respond to
keystrokes like the Down and Page Down, one some you can do things like CTRL+END to jump to the bottom, and
on some the only option is click the scroll bar.

• Take a moment to experiment with the Notes list and try different (manual) keystrokes and mouse clicks to
learn about how this list behaves.

Exercise 5.1.8 Using the Scroll Button


Usually the most fool proof method of traversing rows is to click the scroll down button As we have seen, there
are twelve rows on full display with one on partial display, and one press of the button moves the rows up one
place.

Commercial in Confidence Page 29 of 56


• Go back to the Get Details page and recall that we make a decision to stop when the row counter reaches
12. Change that limit to 20.
• Add a new Decision stage to the right of the stop Decision and move the Multi-calculation up. This new
Decision stage should have the expression [Row]<=12
• Open Region Editor and create an image region for the scroll down button.

• Add a new Navigate stage to do a Global Mouse Click Centre on the button region.
• Connect your new pieces to make you diagram look like below. The idea is that after reading the 12 row we
stop incrementing Start Y and End Y, so that our regions stay in the twelfth position. We then start to click
the button on each iteration.

• Run your page and you should see that table scrolls and that 20 rows of data are captured in the collection.

Exercise 5.1.9 Using the Down Key


In this exercise we’ll see how the Down key can be used for scrolling elements row by row.

• Create a duplicate of the Get Details page y right-clicking on the page tab.

Commercial in Confidence Page 30 of 56


• Go to the Navigate to View Row page that we worked on previously, and copy the Navigate stage used to
click the row.
• Return to the Get Details (Copy) page and paste the Navigate stage, positioning it before the Action stage.

• Open the Navigate stage and delete one of the Global Mouse Click Centre lines, as we only need one here.
Add a new line and drag in the root element to send the {ESCAPE} key. On this training application the
mouse click has the effect of putting the cell into ‘edit mode’, which we don’t want, and the Escape key is
used to undo it.

• Change the other Navigate stage that was used to click the scroll down button. Change it so that it sends
{DOWN} via Global Send Keys.
• Now rearrange the loop so that the Down key is sent on every iteration, like this.

Commercial in Confidence Page 31 of 56


• Run your page and you should see the highlighted row move down the table and your collection should
contain 20 rows of data.

Exercise 5.1.10 List Regions

You may have been wondering what the List Region button is for. A list region is basically a repeating coordinate
region and it can make short work of reading a list.

• Create a new element in Application Modeller and spy the main window with Region mode.
• In Region Editor create a list region within the first Agent cell, much in the same way as we have done
before. Notice how when you hover over the region, a repeating series of regions is displayed.

Commercial in Confidence Page 32 of 56


Notice that the region has properties we haven’t seen before, List Direction and Padding.

List Direction is easy to understand, and almost always you will use the default, Top Down. The Padding property
however is not quite the same as the image region padding we’ve worked with before. Here, Padding controls the
spacing between the repeating regions.

• Change the Padding property to 5 and then hover over the list region and notice the difference. You should
see that the repeating regions are now separated and sit better over the other rows.
• Like the measurements of a dynamic region, a list region requires precision to work properly. Take time to
adjust the location, the size and the padding of your list region until the repeating regions sit neatly over
the other rows, like this.

Commercial in Confidence Page 33 of 56


• Once you are happy with your list region, set the font to Arial 9.5 and close Region Editor.
• Back in Object Studio, create a new page and add a Read stage. Select the Recognise Text In Range option
and use 1 and 12 as the First and Last Element inputs.

Commercial in Confidence Page 34 of 56


• Copy an ‘Activate Application’ Navigate stage from one of your other pages and link it into your new page.
Run the page and you should see twelve rows read into your collection.
You’re now probably wondering why we did the previous dynamic region exercises. The answer is that as good as
the List Region is, it’s effectiveness depends on the target application. Applications often, as this one does,
highlight the selected row in a different colour; fortunately, here the table font is black in both the highlighted and
un-highlighted rows. If the highlighting had been blue with a white font then we would have had to read the
highlighted row separately, perhaps by using First Element = 1 and Last Element = 1.

And as mentioned earlier, the paging behaviour of an application may not work as neatly as you might expect; note
how in the training application the first Page Down key press does scroll a full page, whereas the subsequent pages
do. Again, dynamic adjustment of the First Element and Last Element inputs might be an ideal solution.

Exercise 5.1.11 Combining List Region Results

Adjoining Columns
The previous exercise showed the potential for a List Region to read a single column. In this exercise we see how to
join collection columns together.

• Create another List Region for the Date column.


• Add a new line to your Read stage to read this column into a new collection.
• Run the page and then look at the Current Values of the Dates collection and the Agents collection. Notice
how they use the same generic column name ‘Text’. This will create conflict of we try to join these
collections together.
• Add two new Action stages and use the Rename Field action of the Utility – Collection Manipulation
object to change the columns names of your collections.

• Add another Action stage and use the Merge Collection action to generate a third collection.

Commercial in Confidence Page 35 of 56


Appending Rows
Adding rows from one collection on to the end of another is a very similar technique. The Append Rows to
Collection action appends the rows of one collection to another, provided both collections have the same
structure. So, after reading a page of rows and before moving to the next page, this action could be used to build
up a collection of all rows.

Commercial in Confidence Page 36 of 56


Exercise 5.1.12 Detecting Column Position
As we have seen, a table with a fixed structure is a challenge in Surface Automation, but sometimes applications
give us the added problem of variable column widths. This next exercise uses the Image Loader application from
the basic training course, and although quite complex, it is a consolidation of the techniques we have already
learnt.

• Launch Image Loader and open the 5.1.22a.png image.

• Either reuse your Business Object from the basic training course or create a new one.
• Create an image region around the MPRN column header with an exaggerated Right padding.

• Create a list region around the first MPRN cell, and make the left-hand edge align with the header region
(the Region Editor ‘snap’ feature should help you do this). Adjust the list region so that the repeating
regions site over the rows correctly. Make a mental note of the region’s width (it should be about 75).

Commercial in Confidence Page 37 of 56


• Assign the Courier New 8pt system font to the list region.
• In Application Manager, make the Start X and End X attributes of the list region dynamic.

• In Object Studio, add a Read stage to extract the run time location of the MPRN Header region (i.e. Get
Bounds).

• Add another Read stage to perform Recognise Text in Range on the MPRN Cell region. Use the Bounds
collection output of the first Read as input to the second Read.

• Run the page, and you should find that the 9 cells in the column are read.

Commercial in Confidence Page 38 of 56


• If you notice that some of the values in your collection don’t look quite right, we’ll look at this specific
problem in the next chapter.

• Now load the 5.1.22b.png image and note that the columns are slightly different. Run the page again and
you should find that the column can still be read.

Exercise 5.1.13 Determining Column Width


The technique of using padding to locate a column header can be used to determine the width of a column at run
time. The only difference is that you would find the location of the adjacent header, as well as the target header,
and calculate the horizontal difference between them.

• Create a list region for the Name column.


• Use the run time location of the MPRN header to determine the width of the Name list region.

Commercial in Confidence Page 39 of 56


6 Advanced Topics
6.1 Fonts

Identifying Fonts
When identifying system fonts, we have used the Automatic tab that allows Blue Prism to return the best matches.
From this you can select and test the returned fonts to determine the most appropriate. If no fonts are returned,
you can use the Manual tab to return samples from all available system fonts and manually select one.

Qualifying Fonts
Irrespective of whether the font was found automatically or manually, an important part of the interface
configuration is to qualify the font. This means proving all upper and lower case letters, numbers and symbols
match correctly. This may not always be possible, and workarounds may be required (see Character Conflicts
below).

Key Points

• Read as much text from labels as you can to provide a wide selection of alphanumeric characters and
symbols.

• Find an area of the application where you can enter text (e.g., note field or large input box) and read it
within Blue Prism to confirm values.

Creating a Font via Region Editor


Where a font can’t be identified or successfully qualified you can create a font. Consider the following screenshot.
We have navigated the process to the Note screen and entered a range of characters.

Commercial in Confidence Page 40 of 56


We have created a region to wrap some of the text on the application. From the Font property we select Create
Empty Font. After supplying a name for the font, we click the Show Characters button at the foot of the Region
Editor.

Blue Prism separates the distinct values and presents them to you so that you can set the characters. Above each
character is an input box for you to type the character and then click Merge Into Font.

Commercial in Confidence Page 41 of 56


You could repeat the exercise for further characters and symbols. Notice how we put spaces between each
character. If we hadn’t, the font kerning would have provided the following results:

Blue Prism has been unable to distinguish the VvWwX characters.

Creating a Font via System Manager


Fonts can also be edited in System Manager – System – Fonts as well as in Region Editor.

Commercial in Confidence Page 42 of 56


The interface is like Region Editor but allows you to select font color and adjust the whitespace around each
character.

Font Files
Once a font has been qualified, it can be exported to other Blue Prism Resources via a Blue Prism font file. You can
export a font to a font file in System Manager or as part of a Blue Prism Release. This allows your font to be
migrated to other Blue Prism Resources.

Character Conflicts
As you may have seen in the table reading exercises, Recognise Text can yield strange results. This occurs when the
application font contains characters that are visually identical. Commonly upper case ‘i' and lower case ‘L’ are
represented by and identical vertical line of pixels, although in our previous example it is the number 1 and the
lower case ‘L’ that are indistinguishable.

Although this is no problem for a human to interpret, a robot needs rules. The rules you implement to resolve
character conflicts will depend entirely on the context of your character recognition. For instance, if you know that
a field can only contain digits, then you can replace any misplaced letters with their conflicting digits. But if the field
does not have any such inbuilt restriction, it becomes harder to be certain what substitutions are required. You
could ‘clean’ the Recognise Text result using regular expressions, but you would need to be sure of the rules you
apply. Below is an example from a code stage to apply English rules.

‘l at the start of an upper-case word probably I


Unclean = Regex.Replace(Clean, "(\b)l([A-Z]+)(\b)", "$1I$2$3")

‘l after upper case at end of a word probably I


Unclean = Regex.Replace(Unclean, "([A-Z])l(\b)", "$1I$2")

‘l after two upper case probably I


Unclean = Regex.Replace(Unclean, "([A-Z]{2})l", "$1I")

‘II in a word probably ll


Unclean = Regex.Replace(Unclean, "([a-z,A-Z])II", "$1ll")

‘I after upper case and before small case probably l


Unclean = Regex.Replace(Unclean, "([A-Z])I([a-z])", "$1l$2")

‘I after small case probably l


Unclean= Regex.Replace(Unclean, "([a-z])I", "$1l")

‘A single l is probably an I
Unclean= Regex.Replace(Unclean, "(\b)l(\b)", "$1I$2")

Commercial in Confidence Page 43 of 56


Key Point

• There are no universal rules for resolving character conflicts, and you will need to thoroughly test any logic
you implement.

6.2 Performance
As mentioned at the start of this course, Surface Automation is all about interpreting images at pixel level. As such,
it is beneficial to understand that the choice of image can have an impact on performance. Blue Prism locates a
smaller image within a bigger image by moving from pixel to pixel in both images, looking for a match, so it can be
useful to imagine how many pixels will need to be compared.

Recall from the basic training course we imagined an application with a single button. We used padding around an
image region to define an area where the run time location of the button might be found.

But if all we want to do is click the button, could we economise on the number of pixel checks Blue Prism will need
to make? For example, does the region need to surround the whole button? Could it not be tighter around the
word OK to make the image (and the number of pixels to compare) smaller? Does it even need to cover the whole
word?

Consider the Notes table, and suppose we wanted to know which row was currently selected? We could simply
make an image region in the orange highlighting and then select the ‘Anywhere’ padding option. Again, that would
work but we’d be making the search algorithm work unnecessarily hard (and slower). It would be more economic
to create a 1x1 region with a 1-pixel wide padding left and right and maximum padding top and bottom. We are
only interested in the vertical position of the highlighted row, so we need only ask Blue Prism to search in a narrow
vertical strip for the first orange pixel it can find.

Commercial in Confidence Page 44 of 56


7 Further Exercises
Exercise 7.1.1 SA Training – Log In
Complete the Business Object according to the object model in the appendix. If you have time, enable your object
to recognise an incorrect password or warning message.

Exercise 7.1.2 SA Training – Find Account


Complete the Business Object according to the object model in the appendix. If you have time, enable your object
to find an account using first and last name.

Exercise 7.1.3 SA Training –Account Details


Complete the Business Object according to the object model in the appendix.

Exercise 7.1.4 SA Training –Account Notes


Complete the Business Object according to the object model in the appendix.

Exercise 7.1.5 SA Training – Note


Complete the Business Object according to the object model in the appendix.

8 Utilities
There are a couple of utility Business Object that it is useful to be aware of, although the new functionality of Blue
Prism version 6 has made them less vital to a Surface Automation project.

• Utility - Image Manipulation This object comes as standard in your local VBO folder.
• Utility - Image Search This object is available for download from the Portal.

Commercial in Confidence Page 45 of 56


9 Summary
This is the end of this Further Surface Automation course and here is a summary of the main points we have
learned.

• Regions take on some of the attributes of the parent Win32 element, and these attributes may need
adjustment from the default. We did this with the Window Title attribute to make it a wildcard match.
• Radio Buttons and Checkboxes cannot be read as text, but a Wait stage can be used to detect their
condition.
• Wait stages can also be used to detect, and wait for, a difference between a design time image and it’s run
time equivalent. This is how Surface Automation can keep pace with the state of an application.
• There are many varieties of combo box and drop-down lists, each with their own behaviour. As such there
is no single method of integration and the developer must be prepared to find the ideal technique, which
may be a combination of keystrokes, mouse clicks and Read stages.
• The behaviour of scrolling tables and lists is also idiosyncratic, and there are multiple techniques for
reading and navigating them.
• A ‘dynamic’ region can be used to travel down a list, or a ‘list region’ can be used to make a repeating
sequence of regions. Both require pixel level precision.
• Bespoke font definitions can be created from screenshots when necessary.
• Some characters in some fonts are visually identical, and such ‘character conflicts’ require logical
interpretation. Capital i and lower-case L are a classic example.
• Image searching and matching is achieved through pixel-by-pixel comparison, and the size of a region and
its search area can impact on performance. The Surface Automation developer should always have
efficiency in mind.
• The image utility Business Objects used in versions 5 and 4 are still useful and should not be disregarded.

Commercial in Confidence Page 46 of 56


10 Appendix
10.1 Object Model
The following tables describe the template objects provided for this course. All data types are Text unless stated
otherwise.

SA Training – Log In
Action Start Screen End Screen Inputs Outputs
Launch Log In
Log In Log In Account Details User Name
Password
(password)
System
Close Log In

SA Training – Find Account


Action Start Screen End Screen Inputs Outputs
Find Account ID Find Account Find Account Account ID Found (flag)
Last Name
First Name
Get Results Find Account Find Account Results (collection)
(
Account ID
Last Name
First Name
)
Select Result Find Account Account Details Account ID
Close Find Account Account Details

SA Training – Account Details


Action Start Screen End Screen Inputs Outputs
Get Details Account Details Account Details Account ID
Last Name
Middle Name
Title
Gender
House Number
Street
City
County
Postcode
Verified (flag)
Set Details Account Details Account Details Account ID
Last Name
Middle Name

Commercial in Confidence Page 47 of 56


Title
Gender
House Number
Street
City
County
Postcode
Verified (flag)
Unlock Account Details Account Details
locked unlocked
Save Account Details Account Details
saved
Navigate to Notes Account Details Notes Tab
Navigate to Find Account Details Find Account
Navigate to New Account Details Account Details
unlocked
Close Account Details

SA Training – Account Notes


Action Start Screen End Screen Inputs Outputs
Get Details Account Notes Account Notes Start Date (date) Notes (collection)
End Date (date) (
Type Agent
Date (date)
Note
Type
)
Navigate to View Account Notes View Note
Note
Navigate to Add Account Notes Add Note
Note

SA Training –Note
Action Start Screen End Screen Inputs Outputs
Get Details View Note View Note Name
Type
Note
Set Details Add Note Add Note Name
Type
Note
Close (OK) Add Note Account Notes
Close (Cancel) Add Note or View Account Notes
Note

Commercial in Confidence Page 48 of 56


10.2 Send Keys

Global Send Keys


Global Send Keys is used to send keystrokes and keystroke combinations to the active application. Each key is
represented by one or more characters.

The plus sign +, caret ^, percent sign %, tilde ~, and parentheses () have special meanings and to specify one of
these characters, curly brackets {} must be used. For example, to specify the plus sign, use {+}. To specify a curly
bracket character, enclose it in other curly brackets, like {{} or {}}. And although square brackets have no special
meaning, they too must be enclosed in curly brackets, eg {[}.

To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent
actions rather than characters, use the codes in the following table:

Key Code
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}

Commercial in Confidence Page 49 of 56


F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or
more of the following codes:

Key Code
SHIFT +
CTRL ^
ALT %

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed,
enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are
pressed, use +(EC). To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use +EC.

To specify repeating keys, add a number inside the curly brackets, for example {LEFT 4} means send the LEFT
ARROW key four times; {h 10} means send h ten times.

If Send Keys does not work with your application, Send Key Events should be tried instead (see below).

Global Send Key Events


Global Send Key Events differs from Send Keys in that it uses a lower level method of sending the keys, and
therefore is more likely to work with some applications. A specific example of this is a Citrix client, which will not
respond to Send Keys but will work with Send Key Events.

Send Key Events can be thought of as using a keyboard – for ‘a’ press the A key, for ‘B’ hold SHIFT and press the B
key. Like Global Send Keys, curly brackets are used for special keys like {HOME} and {DELETE}.

By default, keys are sent as a ‘press down and release’ instruction. The less than < and greater than > characters
are used to modify the proceeding instruction to be a ‘key down and hold’ or ‘key up’, e.g. <{SHIFT}b>{SHIFT} for
‘hold SHIFT, press B then release SHIFT, i.e. B.

Key Interpretation Result


a A key press a

Commercial in Confidence Page 50 of 56


A A key press a
<{SHIFT}a>{SHIFT} SHIFT down, A key press, SHIFT up A
5 5 key press 5
% 5 key press (on a UK keyboard) 5
<{SHIFT}5>{SHIFT} SHIFT down, 5 key press, SHIFT up %
Hello{RETURN}World H-E-L-L-O key presses, RETURN, W-O-R-L-D key presses hello
world
<{ALT}ab>{ALT} ALT down, A key press, B key press, ALT up
<{ALT}A>{ALT}B ALT down, A key, ALT up, B key press
<{CTRL}<{SHIFT}{ESCAPE}>{SHIFT}>{CTRL} CTRL down, SHIFT down, ESCAPE key press, SHIFT up,
CTRL up.

Critical Point

• Care should always be taken with the syntax of Send Key Events. A down keystroke for special keys must
always be followed by a corresponding up keystroke.

A full list of keycode strings are listed below.

Description
A The A key.
Add The add key.
Alt or ALT The ALT modifier key.
Apps The application key (Microsoft Natural Keyboard).
Attn The ATTN key.
B The B key.
Back The BACKSPACE key.
BrowserBack The browser back key (Windows 2000 or later).
BrowserFavorites The browser favorites key (Windows 2000 or later).
BrowserForward The browser forward key (Windows 2000 or later).
BrowserHome The browser home key (Windows 2000 or later).
BrowserRefresh The browser refresh key (Windows 2000 or later).
BrowserSearch The browser search key (Windows 2000 or later).
BrowserStop The browser stop key (Windows 2000 or later).
C The C key.
Cancel The CANCEL key.
Capital The CAPS LOCK key.
CapsLock The CAPS LOCK key.
Clear The CLEAR key.
Control or CTRL The CTRL modifier key.
ControlKey The CTRL key.
Crsel The CRSEL key.

Commercial in Confidence Page 51 of 56


D The D key.
D0 The 0 key.
D1 The 1 key.
D2 The 2 key.
D3 The 3 key.
D4 The 4 key.
D5 The 5 key.
D6 The 6 key.
D7 The 7 key.
D8 The 8 key.
D9 The 9 key.
Decimal The decimal key.
Delete The DEL key.
Divide The divide key.
Down The DOWN ARROW key.
E The E key.
End The END key.
Enter The ENTER key.
EraseEof The ERASE EOF key.
Escape The ESC key.
Execute The EXECUTE key.
Exsel The EXSEL key.
F The F key.
F1 The F1 key.
F10 The F10 key.
F11 The F11 key.
F12 The F12 key.
F13 The F13 key.
F14 The F14 key.
F15 The F15 key.
F16 The F16 key.
F17 The F17 key.
F18 The F18 key.
F19 The F19 key.
F2 The F2 key.
F20 The F20 key.
F21 The F21 key.
F22 The F22 key.
F23 The F23 key.
F24 The F24 key.

Commercial in Confidence Page 52 of 56


F3 The F3 key.
F4 The F4 key.
F5 The F5 key.
F6 The F6 key.
F7 The F7 key.
F8 The F8 key.
F9 The F9 key.
FinalMode The IME final mode key.
G The G key.
H The H key.
HanguelMode The IME Hanguel mode key. (maintained for compatibility; use HangulMode)
HangulMode The IME Hangul mode key.
HanjaMode The IME Hanja mode key.
Help The HELP key.
Home The HOME key.
I The I key.
IMEAccept The IME accept key, replaces IMEAceept.
IMEAceept The IME accept key. Obsolete, use IMEAccept instead.
IMEConvert The IME convert key.
IMEModeChange The IME mode change key.
IMENonconvert The IME nonconvert key.
Insert The INS key.
J The J key.
JunjaMode The IME Junja mode key.
K The K key.
KanaMode The IME Kana mode key.
KanjiMode The IME Kanji mode key.
KeyCode The bitmask to extract a key code from a key value.
L The L key.
LaunchApplication1 The start application one key (Windows 2000 or later).
LaunchApplication2 The start application two key (Windows 2000 or later).
LaunchMail The launch mail key (Windows 2000 or later).
LButton The left mouse button.
LControlKey The left CTRL key.
Left The LEFT ARROW key.
LineFeed The LINEFEED key.
LMenu The left ALT key.
LShiftKey The left SHIFT key.
LWin The left Windows logo key (Microsoft Natural Keyboard).
M The M key.

Commercial in Confidence Page 53 of 56


MButton The middle mouse button (three-button mouse).
MediaNextTrack The media next track key (Windows 2000 or later).
MediaPlayPause The media play pause key (Windows 2000 or later).
MediaPreviousTrack The media previous track key (Windows 2000 or later).
MediaStop The media Stop key (Windows 2000 or later).
Menu The ALT key.
Modifiers The bitmask to extract modifiers from a key value.
Multiply The multiply key.
N The N key.
Next The PAGE DOWN key.
NoName A constant reserved for future use.
None No key pressed.
NumLock The NUM LOCK key.
NumPad0 The 0 key on the numeric keypad.
NumPad1 The 1 key on the numeric keypad.
NumPad2 The 2 key on the numeric keypad.
NumPad3 The 3 key on the numeric keypad.
NumPad4 The 4 key on the numeric keypad.
NumPad5 The 5 key on the numeric keypad.
NumPad6 The 6 key on the numeric keypad.
NumPad7 The 7 key on the numeric keypad.
NumPad8 The 8 key on the numeric keypad.
NumPad9 The 9 key on the numeric keypad.
O The O key.
Oem1 The OEM 1 key.
Oem102 The OEM 102 key.
Oem2 The OEM 2 key.
Oem3 The OEM 3 key.
Oem4 The OEM 4 key.
Oem5 The OEM 5 key.
Oem6 The OEM 6 key.
Oem7 The OEM 7 key.
Oem8 The OEM 8 key.
OemBackslash The OEM angle bracket or backslash key on the RT 102 key keyboard (Windows 2000 or
later).
OemClear The CLEAR key.
OemCloseBrackets The OEM close bracket key on a US standard keyboard (Windows 2000 or later).
Oemcomma The OEM comma key on any country/region keyboard (Windows 2000 or later).
OemMinus The OEM minus key on any country/region keyboard (Windows 2000 or later).
OemOpenBrackets The OEM open bracket key on a US standard keyboard (Windows 2000 or later).

Commercial in Confidence Page 54 of 56


OemPeriod The OEM period key on any country/region keyboard (Windows 2000 or later).
OemPipe The OEM pipe key on a US standard keyboard (Windows 2000 or later).
Oemplus The OEM plus key on any country/region keyboard (Windows 2000 or later).
OemQuestion The OEM question mark key on a US standard keyboard (Windows 2000 or later).
OemQuotes The OEM singled/double quote key on a US standard keyboard (Windows 2000 or later).
OemSemicolon The OEM Semicolon key on a US standard keyboard (Windows 2000 or later).
Oemtilde The OEM tilde key on a US standard keyboard (Windows 2000 or later).
P The P key.
Pa1 The PA1 key.
Packet Used to pass Unicode characters as if they were keystrokes. The Packet key value is the low
word of a 32-bit virtual-key value used for non-keyboard input methods.
PageDown The PAGE DOWN key.
PageUp The PAGE UP key.
Pause The PAUSE key.
Play The PLAY key.
Print The PRINT key.
PrintScreen The PRINT SCREEN key.
Prior The PAGE UP key.
ProcessKey The PROCESS KEY key.
Q The Q key.
R The R key.
RButton The right mouse button.
RControlKey The right CTRL key.
Return The RETURN key.
Right The RIGHT ARROW key.
RMenu The right ALT key.
RShiftKey The right SHIFT key.
RWin The right Windows logo key (Microsoft Natural Keyboard).
S The S key.
Scroll The SCROLL LOCK key.
Select The SELECT key.
SelectMedia The select media key (Windows 2000 or later).
Separator The separator key.
Shift or SHIFT The SHIFT modifier key.
ShiftKey The SHIFT key.
Sleep The computer sleep key.
Snapshot The PRINT SCREEN key.
Space The SPACEBAR key.
Subtract The subtract key.
T The T key.

Commercial in Confidence Page 55 of 56


Tab The TAB key.
U The U key.
Up The UP ARROW key.
V The V key.
VolumeDown The volume down key (Windows 2000 or later).
VolumeMute The volume mute key (Windows 2000 or later).
VolumeUp The volume up key (Windows 2000 or later).
W The W key.
X The X key.
XButton1 The first x mouse button (five-button mouse).
XButton2 The second x mouse button (five-button mouse).
Y The Y key.
Z The Z key.
Zoom The ZOOM key.

Commercial in Confidence Page 56 of 56

Anda mungkin juga menyukai