Sure, You could simply change your loop to say Do Until At(bitmap)... need to add a small wait into that loop though, otherwise it's going to hammer the screen with about 50 keystrokes a second - that's way too fast.
If this were me... I'd change this to be a For Next Loop to give
yourself a counter instead of a Do Loop since you need something that
reacts to if the condition never did occur for some reason.
I built a function below that takes a bitmap siginiture and a maximum
number of attempts to illustrate:
'Usage
If not GetToHere ("&H551D81CA@616,758x626,837", 10) then
GlobalErrHandler 'Here assuming you've got something that resets the
screen etc in a sub called GlobalErrHandler
'Function
Function GetToHere(Here as string, MaxTries as Long) as boolean
Dim i as long
On error goto errh
Status="GetToHere:" & Here
For i=1 to MaxTries
If at(Here) then GetToHere=True:Exit Function
Key "@@_a"
Key "@@_{enter}"
Wait
Next i
Exit function
Errh:
Status="GetToHere Failed"
GetToHere=False
End function
Thom C. Blackwell
Vice President, Technical Services
Boston Software Systems
(866) 653-5105 ex 807
<http://twitter.com/thomcblackwell> @ThomCBlackwell
www.bossoft.com <http://www.bossoft.com/>
Learn about what we do <http://www.youtube.com/watch?v=Fbjk_4LUZYU>
Please follow us on Facebook
<http://www.facebook.com/pages/Boston-Software-Systems/122739774403349?>
and Twitter! <http://twitter.com/Bossoft>
LEGAL NOTICE Unless expressly stated otherwise, this message is
confidential and may be privileged. It is intended for the addressee(s)
only. Access to this E-mail by anyone else is unauthorized. If you are
not an addressee, any disclosure or copying of the contents of this
E-mail or any action taken (or not taken) in reliance on it is
unauthorized and may be unlawful. If you are not an addressee, please
inform the sender immediately, then delete this message and empty from
your trash.
From: [email protected] [mailto:[email protected]]
Sent: Thursday, December 15, 2011 7:42 PM
To: Talk
Subject: [talkbws] OCR Loop Until
Using an OCR connection, I would like to perform some actions until a
bitmap condition is true. Is it possible to do something similar to the
code below?
Do Until "&H551D81CA@616,758x626,837<30337643"
Key "@@_a"
Key "@@_{enter}"
Loop
Thanks in advance!
Rob Stanfield
Application Developer
PARA Healthcare Financial Services
[email protected] <mailto:[email protected]>
PH: 800.999.3332 x214 <http://para-hcfs.com/rstanfield.html>
The enclosed work-product material is confidential to the Hospital and
PARA, any dissemination of this material to any person or entity outside
of Hospital or PARA Employees, will constitute a breach of the agreement
between Hospital and PARA.
--- To post a message to this list, send mail to: [email protected]
You are currently subscribed as: [email protected]
Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx
--- To post a message to this list, send mail to: [email protected] You are
currently subscribed as: [email protected] Unsubscribe in the
customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx <<image001.png>>
