Class: RAutomation::Adapter::MsUia::UiaDll::SearchCriteria

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/rautomation/adapter/ms_uia/uia_dll.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_locator(parent, locator)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 24

def self.from_locator(parent, locator)
  info = SearchCriteria.new
  info.parent_window = parent
  info.index = locator[:index] || 0

  case
    when locator[:hwnd]
      info.how = :hwnd
      info.data = locator[:hwnd]
    when locator[:id]
      info.how = :id
      info.data = locator[:id]
    when locator[:value]
      info.how = :value
      info.data = locator[:value]
    when locator[:point]
      info.how = :point
      info.data = locator[:point]
    when locator[:focus]
      info.how = :focus
  end
  info
end

Instance Method Details

#data



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 72

def data
  case how
    when :hwnd
      return self[:data][:int_data]
    when :id, :value
      return self[:data][:string_data].to_ptr.read_string
    when :point
      return self[:data][:point_data].to_ptr.read_array_of_int(2)
    else
      return nil
  end
end

#data=(value)



85
86
87
88
89
90
91
92
93
94
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 85

def data=(value)
  case how
    when :hwnd
      self[:data][:int_data] = value
    when :id, :value
      self[:data][:string_data] = value
    when :point
      self[:data][:point_data].to_ptr.write_array_of_int(value)
  end
end

#how



48
49
50
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 48

def how
  self[:how]
end

#how=(value)



52
53
54
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 52

def how=(value)
  self[:how] = value
end

#index



56
57
58
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 56

def index
  self[:index]
end

#index=(value)



60
61
62
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 60

def index=(value)
  self[:index] = value
end

#parent_window



64
65
66
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 64

def parent_window
  self[:hwnd]
end

#parent_window=(parent)



68
69
70
# File 'lib/rautomation/adapter/ms_uia/uia_dll.rb', line 68

def parent_window=(parent)
  self[:hwnd] = parent
end