Reverse Wait Screen Image

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Reverse Wait Screen Image

Post by winstein » Tue Dec 22, 2015 9:16 am

I want to be able to continue a program if a certain image is lost on the screen. With WaitScreenImage, the program will continue only after the image is found on the screen, but I want to perform a command where the program only continues if the image is gone. To be specific, I want to continue the program if the webpage stopped being one blank screen.

Is there a way around it?

Thanks for reading.
PPQ

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Reverse Wait Screen Image

Post by Dorian (MJT support) » Tue Dec 29, 2015 12:26 am

That's a very interesting question.

How about sampling the big blank page with the Image Recognition Wizard, and taking it from there. Like this :

Code: Select all

//Sample your blank page as an image (which will probably be a large white rectangle, and in this example is named image_1.bmp) 
Label>CheckPage
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF

//If it doesn't find the big white image, NumFound will be 0
If>NumFound=0
//Your action script goes here
MessageModal>The area is no longer blank

//If NumFound isn't 0, the white image is still present, so we check again.
Else
Goto>CheckPage
Endif
Or if it's a web page, you could always extract the page body, and parse the html to detect whether it's blank or contains certain information.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: Reverse Wait Screen Image

Post by PepsiHog » Tue Jan 05, 2016 2:38 pm

It's a known image, right? Because sometimes I find it shorter to use GetPixelColor. Pick 5 areas on the image (or more) and use GetPixelColor to look for specific colors on the screen. When it does not find the colors, it continues to do something else.

Or the reverse. If you want to wait for a blank page to go away, get pixel colors on the page that will be there only after the blank page is gone.

Ofcourse, I don't know if the image is in the same place on the screen all the time. So there may be issues I am unaware of.

The nice thing about this method is you don't need to do screen captures.

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts