Loop in list of pre-defined X:Y mouse positions

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 88
Joined: Tue Oct 18, 2016 1:12 pm

Loop in list of pre-defined X:Y mouse positions

Post by Petr » Wed Jun 21, 2017 12:46 pm

This is the background for the example:
I have a set macro which will move mouse position example:

x 1273 y 84

I also have a loop in the macro and thus when looping round I want the coordinates x & y to change to a next in list coordinate x & y. So the next time it loops it now becomes example:

x 278 y 28
This example shows how to loop in list of predefined X:Y mouse positions.

Code: Select all

<#>Parse the list of predefined X:Y mouse positions
<var_parse>("1273:84,278:28,0:0,500:255",":,","",vPos,vPosSize)<#>
<varset>("vPosIndex=0","")<#>
<label>("MOUSEXY")<#>
<if>("%vPosIndex%>=%vPosSize%")<#>// End of mouse poistion list 
<exitmacro><#>
<endif><#>
<varset>("vX=%vPos[vPosIndex]%","")<#>
<varset>("vPosIndex=EXPR(%vPosIndex%+1)","")<#>
<varset>("vY=%vPos[vPosIndex]%","")<#>
<varset>("vPosIndex=EXPR(%vPosIndex%+1)","")<#>
<mm>(%vX%,%vY%)<#>
<msg>(-100,-100,"Mouse position = {%vX%, %vY%}","",1,0,0,0)<#>
<goto>("MOUSEXY")
The .4tw file with the example above can be downloaded here http://www.pitrinec.com/downloads/sampl ... itions.4tw.

Post Reply