rautomation 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.rdoc +5 -0
- data/VERSION +1 -1
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll/AutomatedSelectList.cpp +10 -0
- data/ext/UiaDll/UiaDll/AutomatedSelectList.h +1 -0
- data/ext/UiaDll/UiaDll/AutomationClicker.cpp +9 -13
- data/ext/UiaDll/UiaDll/AutomationClicker.h +5 -4
- data/ext/UiaDll/UiaDll/AutomationControl.h +8 -0
- data/ext/UiaDll/UiaDll/ControlMethods.cpp +4 -4
- data/ext/UiaDll/UiaDll/ExpandCollapseHelper.cpp +12 -12
- data/ext/UiaDll/UiaDll/ExpandCollapseHelper.h +9 -6
- data/ext/UiaDll/UiaDll/SelectListMethods.cpp +9 -4
- data/ext/UiaDll/UiaDll/TableMethods.cpp +16 -16
- data/ext/UiaDll/UiaDll/UiaDll.cpp +279 -259
- data/lib/rautomation/adapter/ms_uia/button.rb +1 -6
- data/lib/rautomation/adapter/ms_uia/button_helper.rb +0 -6
- data/lib/rautomation/adapter/ms_uia/control.rb +9 -12
- data/lib/rautomation/adapter/ms_uia/functions.rb +0 -16
- data/lib/rautomation/adapter/ms_uia/label.rb +1 -5
- data/lib/rautomation/adapter/ms_uia/list_box.rb +3 -26
- data/lib/rautomation/adapter/ms_uia/select_list.rb +6 -38
- data/lib/rautomation/adapter/ms_uia/table.rb +13 -20
- data/lib/rautomation/adapter/ms_uia/text_field.rb +2 -16
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +52 -33
- data/lib/rautomation/adapter/ms_uia/value_control.rb +2 -2
- data/spec/adapter/ms_uia/window_spec.rb +2 -2
- metadata +2 -2
@@ -8,17 +8,12 @@ module RAutomation
|
|
8
8
|
# Default locators used for searching buttons.
|
9
9
|
DEFAULT_LOCATORS = {:class => /button/i}
|
10
10
|
|
11
|
-
#todo - replace with UIA version
|
12
|
-
# @see RAutomation::Button#value
|
13
|
-
def value
|
14
|
-
Functions.control_value(Functions.control_hwnd(@window.hwnd, @locators))
|
15
|
-
end
|
16
|
-
|
17
11
|
def exist?
|
18
12
|
super && matches_type?(Constants::UIA_BUTTON_CONTROL_TYPE)
|
19
13
|
end
|
20
14
|
|
21
15
|
alias_method :exists?, :exist?
|
16
|
+
alias_method :value, :control_name
|
22
17
|
|
23
18
|
end
|
24
19
|
end
|
@@ -3,12 +3,6 @@ module RAutomation
|
|
3
3
|
module MsUia
|
4
4
|
module ButtonHelper
|
5
5
|
|
6
|
-
#todo - replace with UIA version
|
7
|
-
def set?
|
8
|
-
control_hwnd = Functions.control_hwnd(@window.hwnd, @locators)
|
9
|
-
Functions.control_set? control_hwnd
|
10
|
-
end
|
11
|
-
|
12
6
|
# @todo call a windows function to do this without clicking
|
13
7
|
def clear
|
14
8
|
click {!set?} if set?
|
@@ -40,8 +40,7 @@ module RAutomation
|
|
40
40
|
wait_until do
|
41
41
|
@window.activate
|
42
42
|
@window.active? &&
|
43
|
-
|
44
|
-
Functions.control_click(hwnd) &&
|
43
|
+
UiaDll::control_click(search_information) &&
|
45
44
|
clicked = true # is clicked at least once
|
46
45
|
|
47
46
|
block_given? ? yield : clicked && !exist?
|
@@ -57,23 +56,21 @@ module RAutomation
|
|
57
56
|
end
|
58
57
|
|
59
58
|
def enabled?
|
60
|
-
|
59
|
+
UiaDll::is_enabled(search_information)
|
61
60
|
end
|
62
61
|
|
63
|
-
#todo - replace with UIA version
|
64
62
|
def disabled?
|
65
|
-
|
63
|
+
!enabled?
|
66
64
|
end
|
67
65
|
|
68
66
|
#todo - replace with UIA version
|
69
67
|
def focused?
|
70
|
-
|
68
|
+
UiaDll::is_focused(search_information)
|
71
69
|
end
|
72
70
|
|
73
71
|
def focus
|
74
72
|
assert_enabled
|
75
|
-
|
76
|
-
UiaDll::set_focus(uia_control)
|
73
|
+
UiaDll::set_focus(search_information)
|
77
74
|
end
|
78
75
|
|
79
76
|
def bounding_rectangle
|
@@ -123,13 +120,13 @@ module RAutomation
|
|
123
120
|
end
|
124
121
|
|
125
122
|
def expand(which_item)
|
126
|
-
UiaDll::expand_by_value
|
127
|
-
UiaDll::expand_by_index
|
123
|
+
UiaDll::expand_by_value search_information, which_item if which_item.is_a? String
|
124
|
+
UiaDll::expand_by_index search_information, which_item if which_item.is_a? Integer
|
128
125
|
end
|
129
126
|
|
130
127
|
def collapse(which_item)
|
131
|
-
UiaDll::collapse_by_value
|
132
|
-
UiaDll::collapse_by_index
|
128
|
+
UiaDll::collapse_by_value search_information, which_item if which_item.is_a? String
|
129
|
+
UiaDll::collapse_by_index search_information, which_item if which_item.is_a? Integer
|
133
130
|
end
|
134
131
|
|
135
132
|
end
|
@@ -208,22 +208,6 @@ module RAutomation
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
def set_control_text(control_hwnd, text)
|
212
|
-
send_message(control_hwnd, Constants::WM_SETTEXT, 0, text)
|
213
|
-
end
|
214
|
-
|
215
|
-
def control_set?(control_hwnd)
|
216
|
-
get_button_state(control_hwnd) & Constants::STATE_SYSTEM_CHECKED != 0
|
217
|
-
end
|
218
|
-
|
219
|
-
def has_focus?(control_hwnd)
|
220
|
-
get_button_state(control_hwnd) & Constants::STATE_SYSTEM_FOCUSED != 0
|
221
|
-
end
|
222
|
-
|
223
|
-
def unavailable?(control_hwnd)
|
224
|
-
get_button_state(control_hwnd) & Constants::STATE_SYSTEM_UNAVAILABLE != 0
|
225
|
-
end
|
226
|
-
|
227
211
|
def retrieve_combobox_item_text(control_hwnd, item_no)
|
228
212
|
text_len = 1024
|
229
213
|
string_buffer = FFI::MemoryPointer.new :char, text_len
|
@@ -5,16 +5,12 @@ module RAutomation
|
|
5
5
|
include WaitHelper
|
6
6
|
include Locators
|
7
7
|
|
8
|
-
#todo - replace with UIA version
|
9
|
-
def value
|
10
|
-
Functions.control_value(Functions.control_hwnd(@window.hwnd, @locators))
|
11
|
-
end
|
12
|
-
|
13
8
|
def exist?
|
14
9
|
super && matches_type?(Constants::UIA_TEXT_CONTROL_TYPE)
|
15
10
|
end
|
16
11
|
|
17
12
|
alias_method :exists?, :exist?
|
13
|
+
alias_method :value, :control_name
|
18
14
|
|
19
15
|
end
|
20
16
|
end
|
@@ -17,7 +17,7 @@ module RAutomation
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def strings
|
20
|
-
|
20
|
+
UiaDll::find_table_values(search_information)
|
21
21
|
end
|
22
22
|
|
23
23
|
def value
|
@@ -31,37 +31,14 @@ module RAutomation
|
|
31
31
|
alias_method :exists?, :exist?
|
32
32
|
|
33
33
|
def selected?(index)
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
false
|
34
|
+
item = items[index]
|
35
|
+
return item && item.selected?
|
39
36
|
end
|
40
37
|
|
41
38
|
def select(index)
|
42
39
|
UiaDll::select_list_select_index search_information, index
|
43
40
|
end
|
44
41
|
|
45
|
-
def list_boundary
|
46
|
-
boundary = FFI::MemoryPointer.new :long, 4
|
47
|
-
|
48
|
-
Functions.send_message(hwnd, Constants::LB_GETITEMRECT, 0 ,boundary)
|
49
|
-
|
50
|
-
boundary.read_array_of_long(4)
|
51
|
-
end
|
52
|
-
|
53
|
-
def get_top_index
|
54
|
-
Functions.send_message(hwnd, Constants::LB_GETTOPINDEX, 0 ,nil)
|
55
|
-
end
|
56
|
-
|
57
|
-
def list_item_height
|
58
|
-
Functions.send_message(hwnd, Constants::LB_GETITEMHEIGHT, 0 ,nil)
|
59
|
-
end
|
60
|
-
|
61
|
-
def scroll_to_item(row)
|
62
|
-
Functions.send_message(hwnd, Constants::LB_SETTOPINDEX, row ,nil)
|
63
|
-
end
|
64
|
-
|
65
42
|
end
|
66
43
|
end
|
67
44
|
end
|
@@ -7,7 +7,7 @@ module RAutomation
|
|
7
7
|
include Locators
|
8
8
|
|
9
9
|
class SelectListOption
|
10
|
-
attr_accessor :text, :index
|
10
|
+
attr_accessor :text, :index
|
11
11
|
|
12
12
|
def initialize(select_list, text, index)
|
13
13
|
@select_list = select_list
|
@@ -16,7 +16,7 @@ module RAutomation
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def selected?
|
19
|
-
@index == UiaDll::select_list_selected_index(@select_list.
|
19
|
+
@index == UiaDll::select_list_selected_index(@select_list.search_information)
|
20
20
|
end
|
21
21
|
|
22
22
|
def select
|
@@ -27,11 +27,6 @@ module RAutomation
|
|
27
27
|
alias_method :set, :select
|
28
28
|
end
|
29
29
|
|
30
|
-
def initialize(window, locators)
|
31
|
-
super
|
32
|
-
@hwnd = Functions.control_hwnd(@window.hwnd, @locators)
|
33
|
-
end
|
34
|
-
|
35
30
|
def set(value)
|
36
31
|
UiaDll::select_list_select_value(search_information, value)
|
37
32
|
end
|
@@ -39,9 +34,8 @@ module RAutomation
|
|
39
34
|
def options(options = {})
|
40
35
|
items = []
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
select_options = UiaDll::select_options(search_information)
|
38
|
+
select_options.each_with_index do |item, item_no|
|
45
39
|
if options[:text]
|
46
40
|
items.push(SelectListOption.new(self, item, item_no)) if options[:text] == item
|
47
41
|
else
|
@@ -53,47 +47,21 @@ module RAutomation
|
|
53
47
|
end
|
54
48
|
|
55
49
|
def value
|
56
|
-
|
57
|
-
selected_option ? selected_option.text : ""
|
50
|
+
UiaDll::selection(search_information)
|
58
51
|
end
|
59
52
|
|
60
53
|
def option(options)
|
61
|
-
|
62
|
-
item = Functions.retrieve_combobox_item_text(@hwnd, item_no)
|
54
|
+
UiaDll::select_options(search_information).each_with_index do |item, item_no|
|
63
55
|
return SelectListOption.new(self, item, item_no) if options[:text] == item
|
64
56
|
end
|
65
57
|
|
66
58
|
nil
|
67
59
|
end
|
68
60
|
|
69
|
-
def control_hwnd
|
70
|
-
@hwnd
|
71
|
-
end
|
72
|
-
|
73
61
|
def select(index)
|
74
62
|
UiaDll::select_list_select_index search_information, index
|
75
63
|
end
|
76
64
|
|
77
|
-
def list_item_height
|
78
|
-
Functions.send_message(@hwnd, Constants::CB_GETITEMHEIGHT, 0 ,nil)
|
79
|
-
end
|
80
|
-
|
81
|
-
def dropbox_boundary
|
82
|
-
boundary = FFI::MemoryPointer.new :long, 4
|
83
|
-
|
84
|
-
Functions.send_message(@hwnd, Constants::CB_GETDROPPEDCONTROLRECT, 0 ,boundary)
|
85
|
-
|
86
|
-
boundary.read_array_of_long(4)
|
87
|
-
end
|
88
|
-
|
89
|
-
def get_top_index
|
90
|
-
Functions.send_message(@hwnd, Constants::CB_GETTOPINDEX, 0 ,nil)
|
91
|
-
end
|
92
|
-
|
93
|
-
def scroll_to_item(row)
|
94
|
-
Functions.send_message(@hwnd, Constants::CB_SETTOPINDEX , row ,nil)
|
95
|
-
end
|
96
|
-
|
97
65
|
def exist?
|
98
66
|
super && matches_type?(Constants::UIA_COMBOBOX_CONTROL_TYPE)
|
99
67
|
end
|
@@ -3,21 +3,21 @@ module RAutomation
|
|
3
3
|
module MsUia
|
4
4
|
class Cell
|
5
5
|
include Locators
|
6
|
-
attr_reader :row, :column, :
|
6
|
+
attr_reader :row, :column, :search_information
|
7
7
|
|
8
8
|
def initialize(window, locators)
|
9
|
-
@
|
9
|
+
@search_information = window.search_information
|
10
10
|
@locators = extract(locators)
|
11
11
|
@row = window.row
|
12
12
|
@column = @locators[:index] || 0
|
13
13
|
end
|
14
14
|
|
15
15
|
def exists?
|
16
|
-
UiaDll::table_coordinate_valid?
|
16
|
+
UiaDll::table_coordinate_valid? search_information, row, column
|
17
17
|
end
|
18
18
|
|
19
19
|
def value
|
20
|
-
UiaDll::table_value_at
|
20
|
+
UiaDll::table_value_at search_information, row, column
|
21
21
|
end
|
22
22
|
|
23
23
|
alias_method :text, :value
|
@@ -27,7 +27,7 @@ module RAutomation
|
|
27
27
|
class Row
|
28
28
|
include Locators
|
29
29
|
extend ElementCollections
|
30
|
-
attr_reader :
|
30
|
+
attr_reader :search_information
|
31
31
|
|
32
32
|
has_many :cells
|
33
33
|
|
@@ -42,7 +42,7 @@ module RAutomation
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def initialize(window, locators)
|
45
|
-
@
|
45
|
+
@search_information = window.search_information
|
46
46
|
@locators = extract(locators)
|
47
47
|
end
|
48
48
|
|
@@ -51,11 +51,11 @@ module RAutomation
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def value
|
54
|
-
UiaDll::table_value_at
|
54
|
+
UiaDll::table_value_at search_information, @locators[:index]
|
55
55
|
end
|
56
56
|
|
57
57
|
def exists?
|
58
|
-
UiaDll::table_coordinate_valid?(
|
58
|
+
UiaDll::table_coordinate_valid?(search_information, @locators[:index])
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.locators_match?(locators, item)
|
@@ -87,8 +87,8 @@ module RAutomation
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def strings
|
90
|
-
headers = UiaDll.table_headers(
|
91
|
-
values = UiaDll.table_values(
|
90
|
+
headers = UiaDll.table_headers(search_information)
|
91
|
+
values = UiaDll.table_values(search_information)
|
92
92
|
return values if headers.empty?
|
93
93
|
|
94
94
|
all_strings = [] << headers
|
@@ -97,15 +97,15 @@ module RAutomation
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def select(which_item)
|
100
|
-
UiaDll::table_select
|
100
|
+
UiaDll::table_select search_information, which_item
|
101
101
|
end
|
102
102
|
|
103
103
|
def selected?(which_item)
|
104
|
-
UiaDll::table_row_is_selected
|
104
|
+
UiaDll::table_row_is_selected search_information, which_item
|
105
105
|
end
|
106
106
|
|
107
107
|
def row_count
|
108
|
-
UiaDll::table_row_count
|
108
|
+
UiaDll::table_row_count search_information
|
109
109
|
end
|
110
110
|
|
111
111
|
def exist?
|
@@ -117,13 +117,6 @@ module RAutomation
|
|
117
117
|
end
|
118
118
|
|
119
119
|
alias_method :exists?, :exist?
|
120
|
-
|
121
|
-
private
|
122
|
-
|
123
|
-
def count_children(element)
|
124
|
-
UiaDll::find_children(element, nil)
|
125
|
-
end
|
126
|
-
|
127
120
|
end
|
128
121
|
end
|
129
122
|
end
|
@@ -12,15 +12,7 @@ module RAutomation
|
|
12
12
|
# @see RAutomation::TextField#set
|
13
13
|
def set(text)
|
14
14
|
raise "Cannot set value on a disabled text field" if disabled?
|
15
|
-
|
16
|
-
wait_until do
|
17
|
-
hwnd = Functions.control_hwnd(@window.hwnd, @locators)
|
18
|
-
@window.activate
|
19
|
-
@window.active? &&
|
20
|
-
Functions.set_control_focus(hwnd) &&
|
21
|
-
Functions.set_control_text(hwnd, text) &&
|
22
|
-
value == text
|
23
|
-
end
|
15
|
+
UiaDll::set_control_value(search_information, text)
|
24
16
|
end
|
25
17
|
|
26
18
|
# @see RAutomation::TextField#clear
|
@@ -32,13 +24,7 @@ module RAutomation
|
|
32
24
|
#todo - replace with UIA version
|
33
25
|
# @see RAutomation::TextField#value
|
34
26
|
def value
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
#todo - replace with UIA version
|
39
|
-
# @see RAutomation::TextField#hwnd
|
40
|
-
def hwnd
|
41
|
-
Functions.control_hwnd(@window.hwnd, @locators)
|
27
|
+
UiaDll::get_control_value(search_information)
|
42
28
|
end
|
43
29
|
|
44
30
|
def exist?
|
@@ -104,12 +104,15 @@ module RAutomation
|
|
104
104
|
# Generic Control methods
|
105
105
|
attach_function :ElementExists, [SearchCriteria.by_ref], :bool
|
106
106
|
attach_function :process_id, :ProcessId, [SearchCriteria.by_ref], :int
|
107
|
-
attach_function :Control_GetValue, [
|
108
|
-
attach_function :set_control_value, :Control_SetValue, [
|
107
|
+
attach_function :Control_GetValue, [SearchCriteria.by_ref, :pointer, :int], :void
|
108
|
+
attach_function :set_control_value, :Control_SetValue, [SearchCriteria.by_ref, :string], :void
|
109
109
|
attach_function :BoundingRectangle, [SearchCriteria.by_ref, :pointer], :int
|
110
110
|
attach_function :current_control_type, :ControlType, [SearchCriteria.by_ref], :int
|
111
111
|
attach_function :Name, [SearchCriteria.by_ref, :pointer, :int], :void
|
112
112
|
attach_function :ClassName, [SearchCriteria.by_ref, :pointer, :int], :void
|
113
|
+
attach_function :is_enabled, :IsEnabled, [SearchCriteria.by_ref], :bool
|
114
|
+
attach_function :is_focused, :IsFocused, [SearchCriteria.by_ref], :bool
|
115
|
+
attach_function :set_focus, :SetControlFocus, [SearchCriteria.by_ref], :bool
|
113
116
|
attach_function :GetClassNames,
|
114
117
|
[SearchCriteria.by_ref, :pointer], :int
|
115
118
|
|
@@ -123,8 +126,8 @@ module RAutomation
|
|
123
126
|
boundary.read_array_of_long(4)
|
124
127
|
end
|
125
128
|
|
126
|
-
def self.get_control_value(
|
127
|
-
string_from(:Control_GetValue,
|
129
|
+
def self.get_control_value(search_information)
|
130
|
+
string_from(:Control_GetValue, search_information)
|
128
131
|
end
|
129
132
|
|
130
133
|
def self.name(search_information)
|
@@ -148,17 +151,23 @@ module RAutomation
|
|
148
151
|
# Select List methods
|
149
152
|
attach_function :SelectList_Selection,
|
150
153
|
[SearchCriteria.by_ref, :pointer, :int], :void
|
154
|
+
attach_function :SelectList_Options,
|
155
|
+
[SearchCriteria.by_ref, :pointer], :int
|
151
156
|
attach_function :select_list_count, :SelectList_Count,
|
152
157
|
[SearchCriteria.by_ref], :int
|
153
158
|
attach_function :select_list_selected_index, :SelectList_SelectedIndex,
|
154
|
-
[
|
159
|
+
[SearchCriteria.by_ref], :int
|
155
160
|
attach_function :select_list_value_at, :SelectList_ValueAt,
|
156
|
-
[
|
161
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :bool
|
157
162
|
attach_function :select_list_select_index, :SelectList_SelectIndex,
|
158
163
|
[SearchCriteria.by_ref, :int], :bool
|
159
164
|
attach_function :select_list_select_value, :SelectList_SelectValue,
|
160
165
|
[SearchCriteria.by_ref, :pointer], :int
|
161
166
|
|
167
|
+
def self.select_options(search_information)
|
168
|
+
strings_from(:SelectList_Options, search_information)
|
169
|
+
end
|
170
|
+
|
162
171
|
def self.selection(search_information)
|
163
172
|
string_from(:SelectList_Selection, search_information)
|
164
173
|
end
|
@@ -171,47 +180,47 @@ module RAutomation
|
|
171
180
|
|
172
181
|
# Table methods
|
173
182
|
attach_function :Table_GetHeaders,
|
174
|
-
[
|
183
|
+
[SearchCriteria.by_ref, :pointer], :int
|
175
184
|
attach_function :Table_GetValues,
|
176
|
-
[
|
185
|
+
[SearchCriteria.by_ref, :pointer], :int
|
177
186
|
attach_function :Table_FindValues,
|
178
187
|
[SearchCriteria.by_ref, :pointer], :int
|
179
188
|
attach_function :table_row_count, :Table_RowCount,
|
180
|
-
[
|
189
|
+
[SearchCriteria.by_ref], :int
|
181
190
|
attach_function :Table_CoordinateIsValid,
|
182
|
-
[
|
191
|
+
[SearchCriteria.by_ref, :int, :int], :bool
|
183
192
|
attach_function :Table_ValueAt,
|
184
|
-
[
|
193
|
+
[SearchCriteria.by_ref, :int, :int, :pointer, :int], :void
|
185
194
|
attach_function :Table_SelectByIndex,
|
186
|
-
[
|
195
|
+
[SearchCriteria.by_ref, :int], :void
|
187
196
|
attach_function :Table_SelectByValue,
|
188
|
-
[
|
197
|
+
[SearchCriteria.by_ref, :string], :void
|
189
198
|
attach_function :table_row_is_selected, :Table_IsSelectedByIndex,
|
190
|
-
[
|
199
|
+
[SearchCriteria.by_ref, :int], :bool
|
191
200
|
|
192
|
-
def self.table_select(
|
201
|
+
def self.table_select(search_information, which_item)
|
193
202
|
case which_item
|
194
203
|
when Integer
|
195
|
-
Table_SelectByIndex
|
204
|
+
Table_SelectByIndex search_information, which_item
|
196
205
|
when String
|
197
|
-
Table_SelectByValue
|
206
|
+
Table_SelectByValue search_information, which_item
|
198
207
|
end
|
199
208
|
end
|
200
209
|
|
201
|
-
def self.table_value_at(
|
202
|
-
string_from(:Table_ValueAt,
|
210
|
+
def self.table_value_at(search_information, row, column=0)
|
211
|
+
string_from(:Table_ValueAt, search_information, row, column)
|
203
212
|
end
|
204
213
|
|
205
|
-
def self.table_coordinate_valid?(
|
206
|
-
Table_CoordinateIsValid
|
214
|
+
def self.table_coordinate_valid?(search_information, row, column=0)
|
215
|
+
Table_CoordinateIsValid search_information, row, column
|
207
216
|
end
|
208
217
|
|
209
|
-
def self.table_headers(
|
210
|
-
strings_from :Table_GetHeaders,
|
218
|
+
def self.table_headers(search_information)
|
219
|
+
strings_from :Table_GetHeaders, search_information
|
211
220
|
end
|
212
221
|
|
213
|
-
def self.table_values(
|
214
|
-
strings_from :Table_GetValues,
|
222
|
+
def self.table_values(search_information)
|
223
|
+
strings_from :Table_GetValues, search_information
|
215
224
|
end
|
216
225
|
|
217
226
|
def self.find_table_values(search_information)
|
@@ -230,8 +239,6 @@ module RAutomation
|
|
230
239
|
[:pointer, :string], :pointer
|
231
240
|
attach_function :current_native_window_handle, :RA_CurrentNativeWindowHandle,
|
232
241
|
[:pointer], :long
|
233
|
-
attach_function :set_focus, :RA_SetFocus,
|
234
|
-
[:pointer], :bool
|
235
242
|
attach_function :move_mouse, :RA_MoveMouse,
|
236
243
|
[:int,:int], :long
|
237
244
|
attach_function :click_mouse, :RA_ClickMouse,
|
@@ -245,18 +252,22 @@ module RAutomation
|
|
245
252
|
attach_function :select, :RA_Select,
|
246
253
|
[:pointer], :int
|
247
254
|
attach_function :expand_by_value, :RA_ExpandItemByValue,
|
248
|
-
[
|
255
|
+
[SearchCriteria.by_ref, :string], :void
|
249
256
|
attach_function :expand_by_index, :RA_ExpandItemByIndex,
|
250
|
-
[
|
257
|
+
[SearchCriteria.by_ref, :int], :void
|
251
258
|
attach_function :collapse_by_value, :RA_CollapseItemByValue,
|
252
|
-
[
|
259
|
+
[SearchCriteria.by_ref, :string], :void
|
253
260
|
attach_function :collapse_by_index, :RA_CollapseItemByIndex,
|
254
|
-
[
|
255
|
-
attach_function :
|
256
|
-
[
|
261
|
+
[SearchCriteria.by_ref, :int], :void
|
262
|
+
attach_function :RA_Click,
|
263
|
+
[SearchCriteria.by_ref, :pointer, :int], :void
|
257
264
|
attach_function :control_mouse_click, :RA_PointAndClick,
|
258
265
|
[:long, :pointer, :int], :void
|
259
266
|
|
267
|
+
def self.control_click(search_information)
|
268
|
+
can_throw(:RA_Click, search_information)
|
269
|
+
end
|
270
|
+
|
260
271
|
private
|
261
272
|
def self.strings_from(method, hwnd)
|
262
273
|
string_count = send method, hwnd, nil
|
@@ -272,6 +283,14 @@ module RAutomation
|
|
272
283
|
send method, *(args << pointer << 1024)
|
273
284
|
pointer.read_string
|
274
285
|
end
|
286
|
+
|
287
|
+
def self.can_throw(method, *args)
|
288
|
+
string_buffer = FFI::MemoryPointer.new :char, 1024
|
289
|
+
send method, *(args << string_buffer << 1024)
|
290
|
+
error_info = string_buffer.read_string
|
291
|
+
raise error_info unless error_info.empty?
|
292
|
+
true
|
293
|
+
end
|
275
294
|
end
|
276
295
|
end
|
277
296
|
end
|