marshallgrads Absent Member.
Absent Member.
1784 views

Attempting to "search" for a string on my screen

Hello everyone,
We have upgraded to v16.0 of the new MICRO FOCUS REFLECTION DESKTOP PRO. In the older version of Reflection, v14, I was able to search for text and capture that data in a string using the old .findtext and .gettext methods. In the newer version of Reflection, v16.0, it appears that only the .gettext method is available to me. I have been successful in retrieving data from the screen using this method

Sub SEARCH_NEW()
' Generated by the Reflection Macro Recorder on 07-01-2017 14:19:51.59.
' Generated by Micro Focus Reflection Desktop Pro (16.0.308.0).
'
Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim HELLO As Variant

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)

'this method actually works to retrieve a line of data from the screen as of 7/14/2017.
' need to be able to search for a specific piece of data after splitting the line of text
'
HELLO = ThisScreen.GetText(5, 1, 80)

MsgBox HELLO

Exit Sub

End Sub


In the above listed example, if I have data on my computer screen it will identify the STRING of text on the 5th row starting at column 1 and then going to column 80. This is fine with me, but I am unable to search for a specific identifying word on my screen....
Using the screenshot below, I would be extracting the String " UID: 0771950001 " (notice the leading and trailing spaces. I can use the trim function to condense and the split function to parse)

ACCESSION: UR 0714 1
PATIENT: DUCK, DAFFEY
ORDER #: 1149674
SSN/ID: ABC-12-LMOP
UID: 0771950001
DOB: Oct 31, 1901
LOCATION: ED
DATE ORDERED: Jul 14, 2017
COLLECTED: Jul 14, 2017@02:40
PROVIDER: LEGHORN, FOGHORN
LAB ARRIVAL: Jul 14, 2017@02:48


With the older Reflection, I was able to use the .FindText method to search for a specific Identifying word/phrase and once found, identify the specific screen row and screen column that it was found. This made it easier to capture the specific data pieces based on the KNOWN value above. The screen position is not always the same so my ROW changes from time to time... I want to be able to search for "SSN/ID:" as my string and once found I would then be able to identify the row it was located in. I could then set my variable to increment for each subsequent work/phrase based on that ROW location...


Can anyone suggest a good equivalent method to use in the newer version of REFLECTION...
0 Likes
3 Replies
AutomaticReply Absent Member.
Absent Member.

Re: Attempting to "search" for a string on my screen

marshallgrads,

It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.

These forums are peer-to-peer, best effort, volunteer run and that if your issue
is urgent or not getting a response, you might try one of the following options:

- Visit https://www.microfocus.com/support-and-services and search the knowledgebase and/or check
all the other self support options and support programs available.
- Open a service request: https://www.microfocus.com/support
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.microfocus.com)
- You might consider hiring a local partner to assist you.
https://www.partnernetprogram.com/partnerfinder/find.html

Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.microfocus.com/faq.php

Sometimes this automatic posting will alert someone that can respond.

If this is a reply to a duplicate posting or otherwise posted in error, please
ignore and accept our apologies and rest assured we will issue a stern reprimand
to our posting bot.

Good luck!

Your Micro Focus Forums Team
http://forums.microfocus.com



0 Likes
marshallgrads Absent Member.
Absent Member.

Re: Attempting to "search" for a string on my screen

I have been able to figure it out.. The new Reflections v16 offers several GetText methods. GetText, GetText2, GetText3. I am using the GetText2 method.
This seems to work extremely well. I can then set variables based on the extracted/split phrases I need and then have REFLECTIONS automatically enter those into my Macro for an automated run sequence with very little user input... Hurray !!!

In my example, I am wishing to pull out the "UR 0721 1" text.

if screen text =
Select Accessioning menu Option: lookup accession
Select Accession or UID: ur 1
ur URINALYSIS
URINALYSIS (JUL 21, 2017) 1

-------------------------------------------------------------------------------
ACCESSION: UR 0721 1 PATIENT: Duck, Daffey




Sub NAME_TEST()

' Generated by the Reflection Macro Recorder on 07-17-2017 15:17:44.80.
' Generated by Micro Focus Reflection Desktop Pro (16.0.308.0).

'====================================================
Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer
'====================================================
Const NEVER_TIME_OUT = 0
'====================================================
Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M
'====================================================
Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen
'====================================================
LF = Chr(10)
CR = Chr(13)
'====================================================

SCRAPETEXT = ThisScreen.GetText2(1, 1, 24, 80)
' CAPTURE THE ENTIRE SCREEN TEXT BY STARTING AT ROW 1, COLUMN 1 AND GO TO ROW 24, COLUMN 80.
MsgBox "THIS IS YOUR SCREEN TEXT: " & SCRAPETEXT

SPLIT_TEXT = Split(SCRAPETEXT, "ACCESSION:", 2)
' after capturing my entire screen of text into a "STRING", I then split the data in the String into 2 pieces based on the separating phrase/word I choose.
' In this case, I am using the phrase - "ACCESSION:" to parse my string into two separate portions.
' SPLIT THE CAPTURED TEXT FROM ABOVE SO THAT YOU HAVE TWO PIECES
MsgBox "SPLIT TEXT #1: " & SPLIT_TEXT(0)
MsgBox "SPLIT TEXT #2: " & SPLIT_TEXT(1) ' THIS SHOULD CONTAIN ALL THE DATA NEEDED TO SET VARIABLES

Exit Sub

' Recording stopped at 15:17:57.66.

End Sub


I can further modify the text from above to extract the exact string sequence using a combination of the Split, Trim, Right, Left, and MID methods available in the VB language.
0 Likes
marshallgrads Absent Member.
Absent Member.

Re: Attempting to "search" for a string on my screen

You can also utilize the SPLIT function to help you separate and parse data.

SPLIT_TEXT = Split(expression or string you want to parse, parsing term, how many pieces to parse)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.