I have a program that wants to be able to click on the screen; say my screen is X by Y pix开发者_如何学Cels, I want to make my program send clicks to coordinate (x, y). Any language is acceptable, but preferably Ruby, Java, or Python :)
Preferably on Windows, Ubuntu is another possibility.
Thanks for the help.
With Ubuntu:
from Xlib import X, display
disp = display.Display()
screen = disp.screen()
root = screen.root
root.warp_pointer(300, 300)
disp.sync()
So as a function:
from Xlib import X, display
def MoveMouse(x, y):
disp = display.Display()
screen = disp.screen()
root = screen.root
root.warp_pointer(x, y)
disp.sync()
I'll edit in click
functionality in a little bit...
Holy cow, just look at the help(root)
! You can draw things, change the cursor, fiddle with windows, and kill X!
I'm using this for my own purposes...
I would give a short answer to your question, but I believe that this article here explains things a lot better than I would and would be much more beneficial. It's in Java and goes over the Robot class which is good for input simulations, mainly for things such as tech demos where the robot class substitutes for real user input. It's fairly in depth, short, and is a really easy read. Hope you enjoy!
精彩评论