Page 1 of 1

Remember the last clicked position

Posted: 08 Apr 2012, 00:11
by andrewmark
Hello,

First i want to say you did an amazing job with this software, it's a bless to use it, and secondly please excuse my english, i working on it and i hope you will understand what kind of help i need. Thanks in advance!

What i need to achieve? I use in Ubuntu an clipboard manager (clipit) and i need to paste the copied texts in an software. So after the script execute the click action on clipit icon the next action i need is to click first item - position 1234:40 (this will paste automatically the text in software)... AND when the times is come (to repeat the action) i need to remember the last clicked position and this time to move forward and click the next item in clipit - position 1234:60, that means 20 pixels down... and so on with every item in clipit. Please, can you help me with that? For a better example see the next image and also the code.

Image

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.2.2" scriptVersion="1.0.0" os="GNU/Linux"/>
    <actions>
        <action name="ActionClick" version="1.0.0"/>
        <action name="ActionWindowCondition" version="1.0.0"/>
        <action name="ActionConsole" version="1.0.0"/>
        <action name="ActionDataInput" version="1.0.0"/>
        <action name="ActionKey" version="1.0.0"/>
        <action name="ActionLoop" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="500" pauseAfter="0">
        <action name="ActionDataInput" comment="how many item to paste from clipboard manager (send info to loop)" enabled="false">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="defaultValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="dataType">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">x</subParameter>
            </parameter>
            <parameter name="question">
                <subParameter name="value" code="0">how many paste do you want?</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="open the application i work with" enabled="false">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">1</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">true</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionWindowCondition" comment="wait to open... then continue" enabled="false">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="width">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">App Example</subParameter>
            </parameter>
            <parameter name="condition">
                <subParameter name="value" code="0">exists</subParameter>
            </parameter>
            <parameter name="processId">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="height">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="ifTrue">
                <subParameter name="line" code="0">C4</subParameter>
                <subParameter name="action" code="0">goto</subParameter>
            </parameter>
            <parameter name="ifFalse">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">wait</subParameter>
            </parameter>
            <parameter name="yCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="xCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
        </action>
        <action name="ActionKey" label="C4" comment="tab" enabled="false">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Tab</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="enter" enabled="false" pauseAfter="500">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Return</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionClick" comment="click clipboard manager" enabled="false" pauseAfter="500">
            <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">1234:13</subParameter>
            </parameter>
        </action>
        <action name="ActionClick" comment="select from clipboard position x y" color="#bc1818" enabled="false" pauseAfter="500">
            <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="amount">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="position">
                <subParameter name="value" code="0">1234:40</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="enter" enabled="false" pauseAfter="10000">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Return</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionConsole" comment="finish pasting" enabled="false">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="output">
                <subParameter name="value" code="0">information</subParameter>
            </parameter>
            <parameter name="text">
                <subParameter name="value" code="0">terminat cont: 1</subParameter>
            </parameter>
        </action>
        <action name="ActionLoop" comment="repeat x times (from line 002)" enabled="false">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="line">
                <subParameter name="value" code="0">db2</subParameter>
            </parameter>
            <parameter name="count">
                <subParameter name="value" code="1">x = x - 1</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>
A friend of mine has trying to help me with the following code, but it works only with his test - two actions click and loop, when i try to add other actions don't remember the last position where did clicked and repeat from beginning, he say something like it maybe is necessary to record the last position and then extract with some global javascript function, i don't know, for me is like Chinese. :P

Code: Select all

var myObject = new Mouse;
var myPosition = myObject.position();
myPosition.setY(myPosition.y + 20);
myObject.move(myPosition);
Console.print(myObject.toString());
Console.print(myPosition.toString());
myObject.click();
Alternative solutions
Another solution i think is to use a predefined click actions (every of them with different positions), and somehow to use one by one but not repeat from beginning when loop to line 002, to know that execute already action #1 (with position 1234:40) and continue to action #2 (1234:60) and so on, what do you say?

If not exist a solution for my needs, it is possible to write ubuntu clipboard selections into console, and when is time to paste it to read from there/write to clipboard to paste it? but again, i need here also to remember that he read first item in console and to move to the next one.

Please help me with that problem. Thanks a lot! :)

Re: Remember the last clicked position

Posted: 08 Apr 2012, 19:09
by Jmgr
Hi,

I think you could use a variable to do that.
I edited your script to show you what I mean :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.4.0" scriptVersion="1.0.0" os="GNU/Linux"/>
    <actions>
        <action name="ActionKey" version="1.0.0"/>
        <action name="ActionLoop" version="1.0.0"/>
        <action name="ActionVariable" version="1.0.0"/>
        <action name="ActionClick" version="1.0.0"/>
        <action name="ActionCode" version="1.0.0"/>
        <action name="ActionWindowCondition" version="1.0.0"/>
        <action name="ActionConsole" version="1.0.0"/>
        <action name="ActionDataInput" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="500" pauseAfter="0">
        <action name="ActionVariable" comment="set the initial value of the position variable">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <parameter name="colorValue">
                <subParameter name="value" code="0">::</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">position</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">position</subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="positionValue">
                <subParameter name="value" code="0">1234:40</subParameter>
            </parameter>
        </action>
        <action name="ActionDataInput" comment="how many item to paste from clipboard manager (send info to loop)">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="defaultValue">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="dataType">
                <subParameter name="value" code="0">integer</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0">x</subParameter>
            </parameter>
            <parameter name="question">
                <subParameter name="value" code="0">how many paste do you want?</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="open the application i work with">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">1</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">true</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionWindowCondition" comment="wait to open... then continue">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="width">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">App Example</subParameter>
            </parameter>
            <parameter name="condition">
                <subParameter name="value" code="0">exists</subParameter>
            </parameter>
            <parameter name="processId">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="height">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="ifTrue">
                <subParameter name="line" code="0">C4</subParameter>
                <subParameter name="action" code="0">goto</subParameter>
            </parameter>
            <parameter name="ifFalse">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">wait</subParameter>
            </parameter>
            <parameter name="yCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="xCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
        </action>
        <action name="ActionKey" label="C4" comment="tab">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Tab</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="enter" pauseAfter="500">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Return</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionClick" comment="click clipboard manager" pauseAfter="500">
            <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">1234:13</subParameter>
            </parameter>
        </action>
        <action name="ActionClick" comment="select from clipboard position x y" color="#bc1818" pauseAfter="500">
            <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="amount">
                <subParameter name="value" code="0">1</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="position">
                <subParameter name="value" code="1">position</subParameter>
            </parameter>
        </action>
        <action name="ActionCode" comment="increase the y value (vertical) of the position variable">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">position.y += 20</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="enter" pauseAfter="10000">
            <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="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">Return</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">Win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
        <action name="ActionConsole" comment="finish pasting">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="output">
                <subParameter name="value" code="0">information</subParameter>
            </parameter>
            <parameter name="text">
                <subParameter name="value" code="0">terminat cont: 1</subParameter>
            </parameter>
        </action>
        <action name="ActionLoop" comment="repeat x times (from line 002)">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="line">
                <subParameter name="value" code="0">db2</subParameter>
            </parameter>
            <parameter name="count">
                <subParameter name="value" code="1">x = x - 1</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>

Re: Remember the last clicked position

Posted: 09 Apr 2012, 17:20
by andrewmark
I've tested your example and it seems it works. Thanks man! :D