Class: RIESS::ActiveConsole

Inherits:
Object
  • Object
show all
Defined in:
lib/riess.rb

Defined Under Namespace

Classes: IEWindow

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window_title) ⇒ ActiveConsole

Returns a new instance of ActiveConsole.



80
81
82
83
84
85
# File 'lib/riess.rb', line 80

def initialize(window_title)
  @window_title = window_title
  @windows = []
  @all_windows = []
  connect
end

Instance Attribute Details

#all_windowsObject (readonly)

Returns the value of attribute all_windows.



77
78
79
# File 'lib/riess.rb', line 77

def all_windows
  @all_windows
end

#windowsObject (readonly)

Returns the value of attribute windows.



77
78
79
# File 'lib/riess.rb', line 77

def windows
  @windows
end

Instance Method Details

#connectObject



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/riess.rb', line 87

def connect
  WIN32OLE.new('Shell.Application').Windows.each{|w|
    begin
      if w.document.title.match(/#{@window_title}/) 
        @windows << IEWindow.new(w.Document.Title,w)
      elsif w.document.title != ""
        @all_windows << IEWindow.new(w.document.title,w)
      end
      
    rescue
    end
  }
end

#list_all_windowsObject



105
106
107
# File 'lib/riess.rb', line 105

def list_all_windows
  @all_windows.each_with_index{|w,i| puts "#{i} : #{w.title}"}
end

#list_windowsObject



101
102
103
# File 'lib/riess.rb', line 101

def list_windows
  @windows.each_with_index{|w,i| puts "#{i} : #{w.title}"}
end