Class: Osaka::Numbers

Inherits:
TypicalApplication show all
Defined in:
lib/osaka/numbers.rb

Instance Attribute Summary

Attributes inherited from TypicalApplication

#control

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TypicalApplication

#activate, #close, #close_dialog_sheet_with_dont_save, #copy, #create_dialog, #create_document, #cut, #do_and_wait_for_new_window, #duplicate, #duplicate_and_close_original, #duplicate_available?, #focus, #get_info, #initialize_copy, #open, #paste, #print_dialog, #quit, #raise_error_on_open_standard_windows, #running?, #save, #save_as, #save_pops_up_dialog?, #select_all, #select_file_from_open_dialog, #wait_for_application_to_quit, #wait_for_save_dialog_and_save_file, #wait_for_window_and_dialogs_to_close

Constructor Details

#initializeNumbers

Returns a new instance of Numbers.



16
17
18
# File 'lib/osaka/numbers.rb', line 16

def initialize
  super "Numbers"
end

Class Method Details

.create_document(filename, &block) ⇒ Object



27
28
29
30
# File 'lib/osaka/numbers.rb', line 27

def self.create_document(filename, &block)
  numbers = Osaka::Numbers.new
  numbers.create_document(filename, &block)
end

Instance Method Details

#column_countObject



39
40
41
# File 'lib/osaka/numbers.rb', line 39

def column_count
  control.tell("tell document 1; tell sheet 1; tell table 1; get column count; end tell; end tell; end tell").to_i
end

#fill_cell(column, row, value) ⇒ Object



32
33
34
35
36
37
# File 'lib/osaka/numbers.rb', line 32

def fill_cell(column, row, value)
  if (column > column_count)
    set_column_count(column)
  end
  control.tell("tell document 1; tell sheet 1; tell table 1; set value of cell #{column} of row #{row} to \"#{value}\"; end tell; end tell; end tell")
end

#new_documentObject



20
21
22
23
24
25
# File 'lib/osaka/numbers.rb', line 20

def new_document
  super
  control.set_current_window(do_and_wait_for_new_window {
    control.keystroke(:return)
  })
end

#set_column_count(amount) ⇒ Object



43
44
45
# File 'lib/osaka/numbers.rb', line 43

def set_column_count(amount)
  control.tell("tell document 1; tell sheet 1; tell table 1; set column count to #{amount}; end tell; end tell; end tell")
end

#set_header_columns(column) ⇒ Object



47
48
49
# File 'lib/osaka/numbers.rb', line 47

def set_header_columns(column)
  control.click_menu_bar(at.menu_item(column.to_s).menu(1).menu_item("Header Columns"), "Table")
end