Class: RAutomation::Adapter::Win32::Mouse
- Inherits:
-
Object
- Object
- RAutomation::Adapter::Win32::Mouse
- Defined in:
- lib/rautomation/adapter/win_32/mouse.rb
Instance Method Summary collapse
- #click
-
#initialize(window) ⇒ Mouse
constructor
A new instance of Mouse.
- #move(coords = {})
- #position
- #press
- #release
Constructor Details
#initialize(window) ⇒ Mouse
Returns a new instance of Mouse.
5 6 7 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 5 def initialize(window) @window = window end |
Instance Method Details
#click
22 23 24 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 22 def click send_input down_event, up_event end |
#move(coords = {})
9 10 11 12 13 14 15 16 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 9 def move(coords={}) @last_position = coords = (@last_position || position).merge(coords) until position[:x] == coords[:x] && position[:y] == coords[:y] @window.activate Functions.set_cursor_pos coords[:x], coords[:y] end end |
#position
18 19 20 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 18 def position Functions.get_cursor_pos end |
#press
26 27 28 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 26 def press send_input down_event, down_event end |
#release
30 31 32 |
# File 'lib/rautomation/adapter/win_32/mouse.rb', line 30 def release send_input up_event, up_event end |