Module: Accessibility::String

Defined in:
lib/accessibility/string.rb

Overview

Parses strings of human readable text into a series of events meant to be processed by Core#post or KeyCoder.post_event.

Supports most, if not all, latin keyboard layouts, maybe some international layouts as well. Japanese layouts can be made to work with use of ‘String#transform`.

Examples:


app = AXUIElementCreateApplication(3456)
include Accessibility::String
app.post keyboard_events_for "Hello, world!\n"

Defined Under Namespace

Classes: EventGenerator, Lexer

Instance Method Summary collapse

Instance Method Details

#keyboard_events_for(string) ⇒ Array<Array(Fixnum,Boolean)>

Generate keyboard events for the given string. Strings should be in a human readable with a few exceptions. Command key (e.g. control, option, command) should be written in string as they appear in Accessibility::String::EventGenerator::CUSTOM.

For more details on event generation, read the [Keyboarding documentation](github.com/Marketcircle/AXElements/wiki/Keyboarding).

Parameters:

Returns:

  • (Array<Array(Fixnum,Boolean)>)


33
34
35
# File 'lib/accessibility/string.rb', line 33

def keyboard_events_for string
  EventGenerator.new(Lexer.new(string).lex).generate
end