Random clicks

Post here if you need help using Actiona
Post Reply
Karsen
Posts: 4
Joined: 14 May 2020, 14:26

Random clicks

Post by Karsen »

Hello,
I want to create a script that can generate random click in a certain positions
For example: I want to click on "519:454" or"519:356 ", or"519:985 ", or"519:342"

Thanks in advance,
Example d'image :
Image
francois
Posts: 456
Joined: 18 Oct 2010, 10:33
Location: France

Re: Random clicks

Post by francois »

Code: Select all

XY= [];
XY[0] =  new Point(796,139);
XY[1] =  new Point(796,208);
XY[2] =  new Point(796,275);
XY[3] =  new Point(796,341);

alea= Algorithms.randomInteger(0, (XY.length-1))

var souris=new Mouse()
souris.move(XY[alea])

souris.click();
Karsen
Posts: 4
Joined: 14 May 2020, 14:26

Re: Random clicks

Post by Karsen »

Thank you so much for your reply
I think I miss explain this
I want to click just once but when every time I click i would like to click in random interval position like I want "X" [796 - 896] and for "Y" [100 - 200]

Thank you again for your help

PS: When I run the script I get an error " Script line 1 : "Mouse" is not a valid position. "
francois
Posts: 456
Joined: 18 Oct 2010, 10:33
Location: France

Re: Random clicks

Post by francois »

To choose a point inside a rectangle :

Code: Select all

X_mini = 227
Y_mini=183
X_maxi=451
Y_maxi = 512

X_alea= Algorithms.randomInteger(X_mini,X_maxi)
Y_alea= Algorithms.randomInteger(Y_mini,Y_maxi)


XY_alea =  new Point(X_alea,Y_alea);
var souris=new Mouse()
souris.move(XY_alea)

souris.click();
Post Reply