×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Attachmate Comparation

## Attachmate Comparation

(OP)
Hi!!!

I was able to search for a String named "T628100", but I can not figure out how to make a comparison if it does not find the text.

Example: If you did not find this information, it would look on the bottom line and if it did not find it again press F8

#### CODE --> vba

Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
Set MyScreen = Sess0.Screen

MyScreen.MoveTo 2, 2
Set MyArea = MyScreen.Search("T628100")
MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 1
MyScreen.SendKeys ("<Up>")

if .........

MyScreen.SendKeys ("<PF8>")

end if 

Sorry, I do not speak fluent English and I'm a beginner in programming.

### RE: Attachmate Comparation

Hi,

#### CODE

‘
Set MyArea = MyScreen.Search("T628100")

If MyArea Is Nothing Then
‘Could not find search string on this screen
MyScreen.SendKeys (“<PF8>”)
Else
MsgBox MyArea.Value & “ found at row “ & _
MyArea.Row & “ column “ & MyArea.Column
End If 

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: Attachmate Comparation

(OP)
Hello SkipVought,

That's fine, but I need just one more info: when pressing F8, it should do the search again and if it does not find that it exits the loop

The code above was just an example, follow my true code:

#### CODE --> VBA

i = 2

While Sheet1.Cells(i, "A") <> ""

Sess0.Screen.SendKeys ("<Home>ATK8<Enter>")

MyScreen.area(2, 22, 2, 27).Value = Trim(Left(Sheet1.Cells(i, "A"), 6))
MyScreen.area(2, 29, 2, 38).Value = Trim(Mid(Sheet1.Cells(i, "A"), 7, 10))
MyScreen.SendKeys ("<Enter>")
Sleep (500)

Set MyArea = MyScreen.Search(Sheet1.Cells(i, "B"))

If MyArea Is Nothing Then
MyScreen.SendKeys ("<PF8>")
'here it would search again and if it did not find it would return to Sess0.Screen.SendKeys ("<Home>ATK8<Enter>")

Else

MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 2
MyScreen.SendKeys ("S<Enter>")
Sleep(500)
MyScreen.SendKeys ("R<Enter><Enter>")
Sleep(500)

i = i + 1
Wend

MsgBox "Finished!" 

### RE: Attachmate Comparation

BTW, any time you Send a command to the mainframe, which processes asynchronously from your application, you must WAIT until the mainframe process is complete. That might be less than a millisecond or many milliseconds or seconds or minutes. No one knows!

Wait(500) is like saying, “when I get to a STOP sign, I’ll just wait for exactly 5 seconds and then proceed into the intersection.” That would be silly and dangerous. You might be able to proceed immediately after stoping, or you might need to wait a long time due to traffic on the through street.

You will notice that when you issue a command to the mainframe that the cursor disappears until the mainframe is done, at which time the curor reappears at that screen’s rest coordinates. These coordinates an be different for various screens. DON’T USE WAIT(SomeDuration)

#### CODE

‘ a command has been sent to the mainframe
Do Until Screen.WaitForCursor(r, c)   ‘ where r, c are the screen rest coordinates
DoEvents
Loop 

I’ll have more to say about your question when I get back from church.

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: Attachmate Comparation

(OP)
Thank you again for responding

I did some testing and it really is not necessary to wait, even more the way I did.

Ok, thanks

### RE: Attachmate Comparation

#### Quote:

I did some testing and it really is not necessary to wait

You say that now, but there WILL be times when the mainframe will not respond “immediately.”

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: Attachmate Comparation

Hope you're coding and running this from Excel.

#### CODE

Dim i As Integer, j As Integer

i = 2

While Sheet1.Cells(i, "A") <> ""

Sess0.Screen.SendKeys ("<Home>ATK8<Enter>")

MyScreen.area(2, 22, 2, 27).Value = Trim(Left(Sheet1.Cells(i, "A"), 6))
MyScreen.area(2, 29, 2, 38).Value = Trim(Mid(Sheet1.Cells(i, "A"), 7, 10))
MyScreen.SendKeys ("<Enter>")
Sleep (500)
'
Set MyArea = MyScreen.Search(Sheet1.Cells(i, "B"))

Select Case j
Case 0
If MyArea Is Nothing Then
MyScreen.SendKeys ("<PF8>")
'here it would search again
'so do nothing else here
Else

MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 2
MyScreen.SendKeys ("S<Enter>")
Sleep (500)
MyScreen.SendKeys ("R<Enter><Enter>")
Sleep (500)

Exit For
End If
Case 1
If MyArea Is Nothing Then
Sess0.Screen.SendKeys ("<Home>ATK8<Enter>")
Else

MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 2
MyScreen.SendKeys ("S<Enter>")
Sleep (500)
MyScreen.SendKeys ("R<Enter><Enter>")
Sleep (500)

End If
End Select

Next
'
i = i + 1
Wend 

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: Attachmate Comparation

(OP)
it's at the same excel

As soon as I test, I'll let you know.

### RE: Attachmate Comparation

👍

Skip,

Just traded in my OLD subtlety...
for a NUance!

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2690034806728363, "perplexity": 14832.198213372145}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-43/segments/1539583509170.2/warc/CC-MAIN-20181015100606-20181015122106-00205.warc.gz"}