Class: AutoItWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/buildmaster/win32/auto_it_window.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(autoit, title, text = nil) ⇒ AutoItWindow

Returns a new instance of AutoItWindow.



2
3
4
5
6
# File 'lib/buildmaster/win32/auto_it_window.rb', line 2

def initialize(autoit, title, text=nil)
  @autoit = autoit
  @title = title
  @text = text
end

Class Method Details

.on_activation(autoit, title, text = nil) {|window| ... } ⇒ Object

Yields:

  • (window)


14
15
16
17
# File 'lib/buildmaster/win32/auto_it_window.rb', line 14

def self.on_activation(autoit, title, text = nil)
  window = wait_for(autoit, title, text)
  yield window
end

.wait_for(autoit, title, text = nil) ⇒ Object



8
9
10
11
12
# File 'lib/buildmaster/win32/auto_it_window.rb', line 8

def self.wait_for(autoit, title, text = nil)
  window = self.new(autoit, title, text)
  window.wait_for_appear
  window
end

Instance Method Details

#activateObject



27
28
29
# File 'lib/buildmaster/win32/auto_it_window.rb', line 27

def activate
  @autoit.WinActivate(@title, @text)
end

#activate_if_neededObject



48
49
50
51
# File 'lib/buildmaster/win32/auto_it_window.rb', line 48

def activate_if_needed
  winstate = state
  activate unless winstate.active?
end

#active?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/buildmaster/win32/auto_it_window.rb', line 31

def active?
  1 == @autoit.WinActive(@title, @text)
end

#closeObject



44
45
46
# File 'lib/buildmaster/win32/auto_it_window.rb', line 44

def close
  @autoit.WinClose(@title)
end

#send_keys(keys) ⇒ Object



39
40
41
42
# File 'lib/buildmaster/win32/auto_it_window.rb', line 39

def send_keys(keys)
  activate_if_needed
  @autoit.Send(keys)
end

#stateObject



35
36
37
# File 'lib/buildmaster/win32/auto_it_window.rb', line 35

def state
  AutoItWindowState.new(@autoit.WinGetState(@title, @text))
end

#wait_for_activationObject



19
20
21
# File 'lib/buildmaster/win32/auto_it_window.rb', line 19

def wait_for_activation
  @autoit.WinWaitActive(@title, @text, 30)
end

#wait_for_appearObject



23
24
25
# File 'lib/buildmaster/win32/auto_it_window.rb', line 23

def wait_for_appear
  @autoit.WinWait(@title, @text, 30)
end