Page 1 of 1

Loops

Posted: 07 Feb 2012, 13:52
by dainiusb
I'm stuck again...When I put loop how to make it stop and just let the other actions do their job when something happens like when it finds an image?
Thanks.

Re: Loops

Posted: 07 Feb 2012, 18:16
by Jmgr
You could the "Variable condition" action that allows you to jump to a line of your script depending on the value of a variable.

Re: Loops

Posted: 07 Feb 2012, 19:00
by dainiusb
But if I use 'Find Image' the value(coordinates) can be totally random. What value should I set then?

Re: Loops

Posted: 10 Feb 2012, 06:56
by Jmgr
I don't understand your question. The value of the "position" field in the Find Image action is the name of the variable where to store the position. This is filled in when the action gets executed.

Could you post the content of your script here? (Goto File->Export and paste the text here)

Re: Loops

Posted: 10 Feb 2012, 12:34
by dainiusb
Hmm...I need it to go forever until something happens. Like until it sees a specific text message in a chat or somewhere else. Ok now I figured that I don't really need 'loop' when I have 'Variable condition'. But what value to put in 'Variable condition' for it if variable value are coordinates from 'Find image'. And what 'Comparison' should I set. And this is the code:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.2.1" scriptVersion="1.0.0" os="Windows"/>
    <actions>
        <action name="ActionClick" version="1.0.0"/>
        <action name="ActionFindImage" version="1.0.0"/>
        <action name="ActionVariableCondition" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="0" pauseAfter="3000">
        <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">2</subParameter>
            </parameter>
            <parameter name="imageToFind">
                <subParameter name="value" code="0">C:/Documents and Settings/NT/My Documents/My Pictures/explorer.bmp</subParameter>
            </parameter>
            <parameter name="position">
                <subParameter name="value" code="0">img</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="ActionVariableCondition">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="ifEqual">
                <subParameter name="line" code="0">003</subParameter>
                <subParameter name="action" code="0">goto</subParameter>
            </parameter>
            <parameter name="comparison">
                <subParameter name="value" code="0">equal</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">img</subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0">what to put here?</subParameter>
            </parameter>
            <parameter name="ifDifferent">
                <subParameter name="line" code="0">001</subParameter>
                <subParameter name="action" code="0">goto</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">img</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="0">1141:9</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>
And I attached an Actionaz file too.

Re: Loops

Posted: 18 Feb 2012, 12:56
by Jmgr
Sorry for the late reply. I didn't have much free time these days.

The "Find Image" action throws and exception and stops the script execution when it cannot find the image, to change that go to the Exceptions tab and choose "Go to a line" in "Cannot find the image". This will allow you to find out if the image has been found or not. When it is found then the next action is executed. So if you specify the line of the Find Image action then it will search until it finds the image.

Re: Loops

Posted: 18 Feb 2012, 21:25
by dainiusb
Wow that was really long! But that was worth waiting. Thanks! :)