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.
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
"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,
Just traded in my OLD subtlety...
for a NUance!
RE: Stop macro question
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,
Just traded in my OLD subtlety...
for a NUance!
RE: Stop macro question
"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
Skip,
Just traded in my OLD subtlety...
for a NUance!