Class: Dutchman::GhostWriter::AppleScript::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/dutchman/ghost_writer/apple_script/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#containerObject (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

#nameObject (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

#applescriptObject



33
34
35
# File 'lib/dutchman/ghost_writer/apple_script/application.rb', line 33

def applescript
  tell_application_command
end

#executeObject



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