Contact Us 1-800-596-4880

Interacting with a Screen of a Legacy Application

With the order ID, you can now get the corresponding tracking number from the legacy system:

  1. Run your legacy application.

  2. Search for the word Order-ID on the screen, click in the edit field next to it, enter the order ID, and click Search.

  3. If the search returns a result, copy the found tracking number to the activity parameter and set the gateway variable is_orderid_found to true. If there is no result, set the gateway variable is_orderid_found to false.

The Workflow contains the steps in the form of action steps. Some of the action steps are nested.

1. Run a Legacy Desktop Application

To run the legacy desktop order-tracking application, select the path to the executable file in the Run program action step. You set the start mode of the application to Maximized to open the application in a maximized window. This process ensures that the UI elements are always in the same position on the screen, which is important because you later use action steps that work with screen coordinates. You select Wait for Window to appear and specify the window title to ensure that the following action steps won’t return an error because the window isn’t there yet.

2. Enter Text into a Screen Element and Click a Button

To search for the tracking number, you have to enter the order ID in the search field and click the search button.

To find the search field, you need to find the word Order ID next to it on the application screen first. You use the Search Pattern action step to capture and compare the pattern:

When you capture a pattern, the screen freezes. You draw a box around the pattern and the search area on the frozen screen.

Finding the pattern returns a coordinate that you use in the next step to determine where to input the order ID. You use the Mouse Action action step to click the search field next to the Order ID label.

The coordinates from the found pattern are used in the Relative To field of the Mouse Action action step.

The search field now has the focus, so you can enter the order ID with a simulated keyboard. Instead of recording keystrokes, you use the Activity Parameter order_id with the Enter String action step to copy the order ID into the field:

You use Mouse Action again to start the search. To determine the position of the search button to click, you reuse the location of the Order id pattern to record the click position.

3. Check the Results

The search is successful when a result is listed. As you can see on the screen, the tracking number is listed in the column of the same name, so you search for that column first, using Tracking No. as the search pattern:

Because the order might not have a corresponding tracking number in the system and you don’t want to falsely return the initial value of the variable as tracking number, you check this case first using the Managed action step.

In DoAction, which works like a try element, you check if the result list is empty. As you can see on the screen, in case of no results, an up arrow shows directly below the empty space where the results should have been.

You use the Search Pattern action step to search for this arrow up symbol and limit the search area to the space directly below the column name.

If the bot doesn’t find the pattern, which means that the system found a corresponding tracking number, Search Pattern returns an error. To continue the workflow, you must force an OK state in the OnError section.

If the legacy application returns the tracking number, the number of found patterns matching the arrow up symbol is zero. You use this information as a case differentiator in the Select Case action step.

The Select Case action step uses Found Matched Pattern Count as Pin Variable Found Matched Pattern Count. The case compares the value to zero.

If the search returns a result, you set the gateway variable is_orderid_found to true.

Then, you use AI-enhanced optical character recognition to extract the tracking number with the AI OCR (screen-based) action step using the Recognition Only search mode.

As before, you use the pattern Tracking No. as the anchor for the search area.

You save the extracted tracking number to the Activity Parameter so you can return it at the end of the process.

The text returned by the OCR action step is stored in the Pin Variable named Recognized Text.

If the tracking number is not returned by the search, you set the gateway variable is_orderid_found to false and force an OK state to continue the process.