Scan color from coordinate from coordinate

Post here if you need help using Actiona
Post Reply
sdolac
Posts: 5
Joined: 11 May 2012, 20:53

Scan color from coordinate from coordinate

Post by sdolac »

I'm sorry, I need help again.
There is an area on the screen, a rectangle, and its coordinates are:
Top left: 744:522
Top right: 939:522
Bottom left: 744:542
Bottom right: 939:542

I would like it to search for color yellow inside that area, and when it founds it, that it clicks it, yellow is a small triangle that appears randomly on screen.
I don't know where to start since I only know how to use getpixel and click options inside but I don't know how to combine them to do that... so some help would be grateful.

Thank you.
User avatar
Jmgr
Admin
Posts: 1649
Joined: 07 Dec 2005, 15:45
Contact:

Re: Scan color from coordinate from coordinate

Post by Jmgr »

Hi,

You have two options :
  • Use the Find Image action to find your triangle, store the result in a variable and emulate a click at this position
  • You could also take a screenshot of the screen at these coordinates and search within this screenshot for the pixel you want, this will require some Javascript skills, but it not very complicated (to take a screenshot: http://wiki.actionaz.org/doku.php?id=en ... screenshot)
If you are stuck I can provide you an example, but this will certainly require some more days since I'm not at home this week-end.
"My software never has bugs. It just develops random features."
sdolac
Posts: 5
Joined: 11 May 2012, 20:53

Re: Scan color from coordinate from coordinate

Post by sdolac »

I would really like an example, when you have some time, please.
Problem is that, triangle changes position after some time so ...
It looks similar to this Image
and I don't know if it is an image, it changes its position.
It is on website, but I can't right click it.
I tried to use FindPicture but I don't know what to select window (since I open the website in opera) or picture...

Ty and sorry for the trouble.
Wh4xer
Posts: 9
Joined: 04 Jul 2012, 16:38

Re: Scan color from coordinate from coordinate

Post by Wh4xer »

What website is it? and how do i make that picture show on the website? I maybe can get it in some way and then post it here. :D
User avatar
Jmgr
Admin
Posts: 1649
Joined: 07 Dec 2005, 15:45
Contact:

Re: Scan color from coordinate from coordinate

Post by Jmgr »

You don't need to specify any window if you use a screenshot. It won't work anyway if the window is hidden.

Here is an example :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.4.2" scriptVersion="1.0.0" os="GNU/Linux"/>
    <actions>
        <action name="ActionClick" version="1.0.0"/>
        <action name="ActionFindImage" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionFindImage">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="33" action="0" line=""/>
            <parameter name="searchExpansion">
                <subParameter name="value" code="0">15</subParameter>
            </parameter>
            <parameter name="windowName">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="confidenceMinimum">
                <subParameter name="value" code="0">70</subParameter>
            </parameter>
            <parameter name="downPyramidCount">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
            <parameter name="imageToFind">
                <subParameter name="value" code="0">target.png</subParameter>
            </parameter>
            <parameter name="position">
                <subParameter name="value" code="0">pos</subParameter>
            </parameter>
            <parameter name="imageToSearchIn">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="source">
                <subParameter name="value" code="0">screenshot</subParameter>
            </parameter>
            <parameter name="maximumMatches">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
            <parameter name="windowRelativePosition">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
        </action>
        <action name="ActionClick">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="33" action="0" line=""/>
            <parameter name="button">
                <subParameter name="value" code="0">left</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="amount">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
            <parameter name="position">
                <subParameter name="value" code="1">pos</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>
Note that I had to set the "Down pyramid count" to 1 instead of 2 because the target is small, but this depends on your target image and the image/window you are searching into.
Here is the target image I used :
target.png
target.png (233 Bytes) Viewed 3559 times
"My software never has bugs. It just develops random features."
sdolac
Posts: 5
Joined: 11 May 2012, 20:53

Re: Scan color from coordinate from coordinate

Post by sdolac »

Thank you, that helped a lot.
Post Reply