# File AgileGuiTesting.rb, line 102 def move_mouse_animated (x,y) # get the old auto_delay, then set it to what we # want it to be old_auto_delay = @robot.getAutoDelay @robot.setAutoDelay(15) p = MouseInfo.getPointerInfo().getLocation() x_last = p.x y_last = p.y x_dist = x - x_last y_dist = y - y_last x_new = x_last y_new = y_last steps = 50 (1...steps).each { |i| x_new = x_new + x_dist / steps.to_f y_new = y_new + y_dist / steps.to_f @robot.mouseMove(x_new,y_new); } # just to be sure we get to the destination @robot.mouseMove(x,y); sleep 0.5 # return to the previous auto_delay @robot.setAutoDelay(old_auto_delay) end