Page 1 of 1

Detect colour on screen

Posted: 09 Feb 2020 11:45
by robchoc
I have a simple script that presses page down every 200ms and is repeated 50 times.

The reason I do this is to quickly visually inspect the screen for any red highlighted areas. Then when I have spotted one I can then try to find it and click on it, lots of manual scrolling to find it.

I want to know if it is possible to detect a specific colour on the screen (see picture for an example) and then I can break out the loop to leave the screen with a red highlighted box ready for me to click.

So basically you have firefox on google search set to 100 results per page and one of the results might be highlighted in a red box. I need to locate this box if it exists.

If it's any help the highlighted area has the following added in the Html:

Code: Select all

<div class="r" style="background-color: rgb(255, 135, 135);">

Also

Image

How do I show a picture in here instead of using links?

https://pasteboard.co/ITSBdE3.png




Many thanks for all the help. :)

Re: Detect colour on screen

Posted: 11 Feb 2020 18:43
by Desmanto
Put image tag between the link. But some image hosting doesn't allow hotlinking, hence direct image link won't work. Just upload it here as attachment and place inline. The screenshot shoudl appear.

Anyway, although there is a way to check the color, it is very inefficient. You have to scroll then take screenshot, load the image data and loop getcolor at the x,y to check if it is red color. Better use HTTP request action from Automagic. But I don't know if it will show up the red coloring if the search is fetched from Automagic HTTP request action.

I don't know if firefox have it or not, but chrome android has view source feature by appending "view-source:" to the url. I can use control UI to open up new tab and use this url. Then use CUI getTextInActiveWindow() to retrieve all the text, parse the color and click the link. It takes a while to get all the text if you have 100 page. But once parsed, there is no scroll needed. So you don't have to wait the scroll to finish.

Re: Detect colour on screen

Posted: 11 Feb 2020 20:52
by robchoc
That's just opened up a whole world of possibilities. The view-source: works in Firefox too.

Thanks :)