Class: Delirium::Platform::Windows::Keyboard

Inherits:
Base::Keyboard show all
Defined in:
lib/delirium/platform/windows/keyboard.rb

Instance Method Summary collapse

Instance Method Details

#key_down(key:) ⇒ Object



18
19
20
21
22
23
# File 'lib/delirium/platform/windows/keyboard.rb', line 18

def key_down(key:)
  case key
  when Symbol
    `nircmd.exe sendkey #{key} down`
  end
end

#key_press(key:) ⇒ Object



11
12
13
14
15
16
# File 'lib/delirium/platform/windows/keyboard.rb', line 11

def key_press(key:)
  case key
  when Symbol
    `nircmd.exe sendkey #{key} press`
  end
end

#key_up(key:) ⇒ Object



25
26
27
28
29
30
# File 'lib/delirium/platform/windows/keyboard.rb', line 25

def key_up(key:)
  case key
  when Symbol
    `nircmd.exe sendkey #{key} up`
  end
end

#write(string:) ⇒ Object



5
6
7
8
9
# File 'lib/delirium/platform/windows/keyboard.rb', line 5

def write(string:)
  string.split("").each do |c|
    `nircmd.exe sendkey #{c} press`
  end
end