Simulate random position mouse events in Cocoa
I want to build a very rough app which will simulate mouse clicks every 10th of a second at random places on the entire screen. I was thinking of building this in Cocoa/Objective-C开发者_JS百科. Can anyone point me in a direction of research?
To do something every 1/10th of a second, you need an NSTimer
.
To simulate mouse clicks, you need CGEventCreateMouseEvent()
in conjunction with CGEventPost()
.
To generate random numbers, you need arc4random()
精彩评论