How to program a mouse click on Mac OS X and on Linux?
I kno开发者_如何学编程w how to program a click on Win32 (click on the screen programmatically) using C or Ruby. Does anyone know how to do it on Mac OS X and Linux just as a comparison? thanks.
For OS X, there are various approaches (i.e. Carbon, Cocoa, Apple Events) to programming a mouse click described in the article and comments here.
I asked this question myself recently on identi.ca, and got the following answers:
"You can try XSendEvent in Xlib or xcb_send_event in XCB."
"Try a small utility called xte (part of the xautomation package.)"
I also found a tool called xdotool which allows you to programatically simulate keyboard and mouse activity, amongst other things.
精彩评论