Hi,
I saw the demo about how to automate non-standard GUI applications (JAVA!), and I really like it... the find an image within an image thingy is really cool.
I have a question about the opposite of that, I guess. I have a Java application where a dialog box pops up, you enter some data and click the button (so far, so good). But next, the app does some data validation before the box disappears, and only the main screen is visible. The length of time that this takes varies, and using a "wait" command really slows down my app. I process thousands of records overnight, and a wait here, wait there really adds up. Right now, I'm using another product to do this, but there is an opportunity to switch, and I'd like to be able to make the switch.
How can I pause to detect the disappearance of an image within an image (i.e., box goes away) before proceeding with the next command?
Tx,
George
Image recognition question
Moderators: JRL, Dorian (MJT support)
Image recognition question
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
So to wait for an image to disappear just use FindImagePos in a loop:
So if the image is found, it loops back and checks again. It keeps looping until the image is no longer present.
Code: Select all
Label>WaitForDisappear
ScreenCapture>x1,y1,x2,y2,c:\screen.bmp
FindImagePos>c:\DialogImage.bmp,c:\screen.bmp,.....etc...
Wait>0.2
If>imgs>0,WaitForDisappear
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi,
That's great, thanks... I guess if there's different data in the box, I need to be careful about what image I originally select, perhaps just the title bar of the dialog vs. the entire thing.
Also, does it matter exactly where the dialog box pops up? So, for instance, if the Java app is maximized, and that is my main canvas that I'm working from, and the dialog box pops up on top in slightly different positions over time (this usually happens with new releases of the application), but the title bar of the dialog box stays the same, I can cope with that change without modifying code. Is that correct?
Great product Marcus, thanks.
George
That's great, thanks... I guess if there's different data in the box, I need to be careful about what image I originally select, perhaps just the title bar of the dialog vs. the entire thing.
Also, does it matter exactly where the dialog box pops up? So, for instance, if the Java app is maximized, and that is my main canvas that I'm working from, and the dialog box pops up on top in slightly different positions over time (this usually happens with new releases of the application), but the title bar of the dialog box stays the same, I can cope with that change without modifying code. Is that correct?
Great product Marcus, thanks.
George
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, I would use the title bar, or a part of the title bar. Something that identifies the box and doesn't change.
No, doesn't matter where the dialog appears assuming the ScreenCapture command is set to capture the entire screen. Sometimes it is useful to have the ScreenCapture only capture a portion of the screen - like a specific window. This is good when we know the image will only appear within those bounds. But if it could be anywhere on the entire screen, then have the ScreenCapture command capture the entire screen (Use GetScreenRes before the loop/top of script to determine the bounds first).
No, doesn't matter where the dialog appears assuming the ScreenCapture command is set to capture the entire screen. Sometimes it is useful to have the ScreenCapture only capture a portion of the screen - like a specific window. This is good when we know the image will only appear within those bounds. But if it could be anywhere on the entire screen, then have the ScreenCapture command capture the entire screen (Use GetScreenRes before the loop/top of script to determine the bounds first).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?