×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

Stop macro question

Stop macro question

Stop macro question

(OP)
What I am wanting to do is have the macro check a specific screen location in Attachmate for any value other than nothing. If there is a value, then continue running the macro, if there is nothing then stop running the macro. I've tried using the following, but it isn't working:

Location = Trim(Sess0.Screen.GetString (8,31,1))
If Location = "" Then
STOP
End IF

If I use the word "STOP" then it compiles fine, but ignores the IF/Then statement. If I use the word "EXIT" then I get a Syntax Error for the word "EXIT" and the "End If" becomes an illegal statement. I've been able to use something similar for placing values into an Excel cell when there is nothing on the Attachmate screen location:

Location = Trim(Sess0.Screen.GetString (8,31,1))
If Location = "" Then
obj.WorkSheets("Quarterly Macro").Cells(3, "A").Value = 0
End IF

I'm missing something.

RE: Stop macro question

Hi,

"If I use the word "STOP" then it compiles fine, but ignores the IF/Then statement."

How do you know that. Nothing in the code you posted would give that indication!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Stop macro question

BTW, if you are grabbing data from tour terminal emulator and writing to Excel, then by coding in Attachmate, you're coding in the Yugo, when you could be coding in the Jaguar.

You'll still need to create the Attachmate objects, but all the Excel objects will exist in Excel VBA. Excel VBA is orders of magnitude better than Attachmate VBA.

Regarding your issue, usually you're testing for the presence of a value AFTER having issued a SendKeys to fetch data from the system. So FIRST you have to WAIT for the asynchronous system to respond by returning a screens worth of data. Testing BEFORE the system has responded is futile!

I usually use WaitForCursor at the screen rest point, within a Do Loop.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Stop macro question

(OP)
"How do you know that. Nothing in the code you posted would give that indication!" I ran it on two separate accounts, one that matched the criteria and one that did not. It continued on as if nothing had happened on both.

"Regarding your issue, usually you're testing for the presence of a value AFTER having issued a SendKeys to fetch data from the system. So FIRST you have to WAIT for the asynchronous system to respond by returning a screens worth of data. Testing BEFORE the system has responded is futile!" I'll take a look at this and see what I can do. I think I know what you are talking about, atleast my head is telling me I do. :)

RE: Stop macro question

That position might contain a control character, so Trim() would be insufficient. You might try testing the instance that appears to be nothing to determine the ASCII value.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close