Falcon Robot Template

The Falcon template is a robotic process whose functionality is to click in an image defined in the support files section. This page includes descriptions of the methods within the Falcon module that correspond with actions in the workflow. The workflow is very basic to demonstrate how Falcon works. Learn more about the Falcon module.

Workflow

This template's workflow includes three actions: Init, Search, and End.

falcon-workflow2.png

Managing images

The robotic process uses a sample image. For the robot to locate the image, it must be cropped again. To do so, you can use the support image creation tool from the Appian RPA agent.

The sample image is the Firefox icon.

falcon-template-2.png

falcon-3.png

Implementation

JidokaImageSupport

You will see a special class called JidokaImageSupport. This class can be automatically created during the Maven build process using a plugin.

With this Appian RPA Maven plugin, you can generate a support class to automatically obtain supporting code for images. This template obtains a method for each uploaded image as support files, which will return an object of type IFalconImage with which we can work directly.

Learn more about the support image creation tool.

You can see in the template code the method getTestPng(), which allows you to obtain an IFalconImage Instance of the image test.png stored in the support files section of the robotic process configuration.

1
2
3
4
5
6
7
8
/**
 * Returns a falcon image referencing image resource test.png
 * @return
 * @throws IOException
 */
public IFalconImage getTestPng() throws IOException {
	return getImage(Paths.get(server.getCurrentDir(), "test.png"));
}

To use the Falcon module in an Appian RPA robotic process, we recommend you use this plugin to generate the class for support images. The robotic process has a pre-configured section in the pom.xml file with the required values for its use.

Modify the content with your data and you'll get some similar to this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<properties>
	<jidoka.createImageSupportClass>true</jidoka.createImageSupportClass>
	<jidoka.serverId>appianrpa_lab_images</jidoka.serverId>
	<jidoka.consoleURL>https://rpa-coe-lab.appiancloud.com/rpa/</jidoka.consoleURL>
	<jidoka.robotName>5eb129b9e4b08994675a24b7</jidoka.robotName>	<jidoka.imageSupportClassFullName>com.novayre.jidoka.robot.username.JidokaImageSupport</jidoka.imageSupportClassFullName>
</properties>

<!-- Authenticate using the Appian service account's name and API key created in the Appian Admin Console. Note that this isn't the same API key used to authenticate with Maven. -->

<server>
  <id>jidoka</id>
  <username>appian_service_account_username</username>
  <password>service_account_api_key</password>
</server>

RobotFalconTemplate

The main methods that this class contains are start() and searchImage().

The start() method initializes all the Appian RPA modules the robotic process is going to use, including Falcon. It also initializes the JidokaImageSupport class.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * Initialize the modules
 * @throws IOException 
 */
public void start() throws IOException {
		
	server = JidokaFactory.getServer();
	client = IClient.getInstance(this);
	falcon = IFalcon.getInstance(this, client);
	images = JidokaImageSupport.getInstance(this);
		
	server.setNumberOfItems(1);
	server.setCurrentItem(1, images.getTestPng().getDescription());
}

In the searchImage() method, the robotic process does these actions:

  • Loads an IFalconImage instance with the image stored in test.png file.
  • Uses Falcon module to send the image to log (falcon.sendImage(..)).
  • Search the image on the screen.
  • If the image is found, click on the center of the image.
  • Draws a rectangle on the screen to mark the place where the image was found.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public void searchImage() throws IOException, AWTException {
		
	IFalconImage testImage = images.getTestPng().search();		
	server.info("Searching the image: " + testImage.getDescription());
		
	// Sends the image to the trace
	falcon.sendImage(testImage.getImage(), "Test image");
		
	server.info("Desktop capture");
	server.sendScreen("Current desktop");
		
	// Image search on the desktop
	if (testImage.search().found()) {
			
		server.info("Image found at: " + testImage.getPointsWhereFound().get(0));

		// Draw a rectangle where the image was found
		drawRectangle(testImage);
			
		// Single left click over the image
		testImage.clickOnCenter();
			
		server.setCurrentItemResultToOK();	
	} else {		
		server.warn("Image not found");
		server.setCurrentItemResultToWarn();
	}
}
Open in Github

On This Page

FEEDBACK