[英]Using Ruby on Mac OS X, how to programmatically click on the screen — and mouse move, mouse down, and mouse up?
最好的方法是什么? ffi
,RubyCocoa或MacRuby可以做到嗎?
似乎可以使用CGEventCreateMouseEvent
或CGPostMouseEvent
(已棄用)。
請舉一個工作的例子。 謝謝。
更新:此問題的標題已更新...
在MacRuby中,您的視圖可以捕獲這些事件。 只需查看DotView
隨附的DotView
示例。
class MyView < NSView
def mouseUp event
puts convertPoint(event.locationInWindow, fromView:nil)
end
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.