Class: Dutchman::GhostWriter::AppleScript::Application
- Inherits:
-
Object
- Object
- Dutchman::GhostWriter::AppleScript::Application
- Defined in:
- lib/dutchman/ghost_writer/apple_script/application.rb
Instance Attribute Summary collapse
-
#command(new_command = nil) ⇒ Object
readonly
Returns the value of attribute command.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #applescript ⇒ Object
- #execute ⇒ Object
-
#initialize(container, name) ⇒ Application
constructor
A new instance of Application.
- #keystroke(key_name) ⇒ Object
- #typed_phrase(phrase, typing_speed) ⇒ Object
Constructor Details
#initialize(container, name) ⇒ Application
Returns a new instance of Application.
6 7 8 9 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 6 def initialize(container,name) @container = container @name = name end |
Instance Attribute Details
#command(new_command = nil) ⇒ Object (readonly)
Returns the value of attribute command.
11 12 13 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 11 def command @command end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
13 14 15 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 13 def container @container end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 11 def name @name end |
Instance Method Details
#applescript ⇒ Object
33 34 35 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 33 def applescript tell_application_command end |
#execute ⇒ Object
37 38 39 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 37 def execute container.execute(applescript) end |
#keystroke(key_name) ⇒ Object
23 24 25 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 23 def keystroke(key_name) command [ apl_keystroke(key_name) ] end |
#typed_phrase(phrase, typing_speed) ⇒ Object
27 28 29 30 31 |
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 27 def typed_phrase(phrase,typing_speed) command(phrase.chars.map do |letter| [ apl_keystroke(letter), apl_delay(typing_speed.delay_between_characters) ] end.flatten) end |