HCI: Button clicking |
Written by Indiana | |
Wednesday, 07 July 2004 | |
![]() So how should this work? Let say you want to click on a button, where the coordinates of the button center are (x, y) and the distances from the center to the edges of the button are rx and ry. The Java function that does that is: public void clickButton(int x, int y, int rx, int ry, int delay) { int rx2 = (int) (randomNormalScaled(2*rx, 0, 1) - (rx)); int ry2 = (int) (randomNormalScaled(2*ry, 0, 1) - (ry)); clickMouseAt(x + rx2, y + ry2, delay); } Here is the full working code (simple standalone Java class) that also contains more detailed explanation of the routines: http://pokerai.org/pj2/code/RandomClick.java |
|
Last Updated ( Saturday, 08 September 2007 ) |