rautomation 2.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +41 -0
- data/.rspec +2 -0
- data/.yardopts +8 -0
- data/CHANGES.md +276 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +142 -0
- data/Rakefile +73 -0
- data/ext/AutoItX/AutoItX.chm +0 -0
- data/ext/AutoItX/AutoItX3.dll +0 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +179 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters +42 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user +3 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt +48 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp +19 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp +8 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.h +22 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp +282 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/targetver.h +8 -0
- data/ext/IAccessibleDLL/IAccessibleDLL.sln +31 -0
- data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +63 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +116 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs +46 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs +54 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +132 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs +50 -0
- data/ext/UiaDll/RAutomation.UIA/Expander.cs +59 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +166 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs +76 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Property.cs +27 -0
- data/ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs +36 -0
- data/ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs +18 -0
- data/ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj +77 -0
- data/ext/UiaDll/Release/RAutomation.UIA.dll +0 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.cpp +14 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.h +7 -0
- data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
- data/ext/UiaDll/UiaDll/ControlMethods.cpp +16 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
- data/ext/UiaDll/UiaDll/Locator.cpp +93 -0
- data/ext/UiaDll/UiaDll/Locator.h +55 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.h +24 -0
- data/ext/UiaDll/UiaDll/MenuMethods.cpp +62 -0
- data/ext/UiaDll/UiaDll/ReadMe.txt +38 -0
- data/ext/UiaDll/UiaDll/SelectListMethods.cpp +84 -0
- data/ext/UiaDll/UiaDll/SpinnerMethods.cpp +61 -0
- data/ext/UiaDll/UiaDll/StringHelper.cpp +57 -0
- data/ext/UiaDll/UiaDll/StringHelper.h +15 -0
- data/ext/UiaDll/UiaDll/StringMethods.cpp +8 -0
- data/ext/UiaDll/UiaDll/TabControlMethods.cpp +40 -0
- data/ext/UiaDll/UiaDll/TableMethods.cpp +108 -0
- data/ext/UiaDll/UiaDll/TextMethods.cpp +25 -0
- data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +216 -0
- data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +167 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +110 -0
- data/ext/UiaDll/UiaDll/app.ico +0 -0
- data/ext/UiaDll/UiaDll/app.rc +0 -0
- data/ext/UiaDll/UiaDll/dllmain.cpp +1 -0
- data/ext/UiaDll/UiaDll/resource.h +3 -0
- data/ext/UiaDll/UiaDll/stdafx.cpp +5 -0
- data/ext/UiaDll/UiaDll/stdafx.h +41 -0
- data/ext/UiaDll/UiaDll/targetver.h +8 -0
- data/ext/UiaDll/UiaDll.sln +57 -0
- data/ext/WindowsForms/.nuget/NuGet.Config +6 -0
- data/ext/WindowsForms/.nuget/NuGet.exe +0 -0
- data/ext/WindowsForms/.nuget/NuGet.targets +136 -0
- data/ext/WindowsForms/Release/FizzWare.NBuilder.dll +0 -0
- data/ext/WindowsForms/Release/UIA.Extensions.dll +0 -0
- data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.Designer.cs +168 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.cs +103 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.resx +123 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +218 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +52 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.Designer.cs +77 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.cs +43 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.resx +120 -0
- data/ext/WindowsForms/WindowsForms/FizzWare.NBuilder.dll +0 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +527 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +109 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.resx +126 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.cs +34 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/Program.cs +21 -0
- data/ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
- data/ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
- data/ext/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
- data/ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
- data/ext/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/UIA.Extensions.dll +0 -0
- data/ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs +28 -0
- data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +166 -0
- data/ext/WindowsForms/WindowsForms/packages.config +4 -0
- data/ext/WindowsForms/WindowsForms.sln +46 -0
- data/lib/rautomation/adapter/autoit/button.rb +59 -0
- data/lib/rautomation/adapter/autoit/locators.rb +22 -0
- data/lib/rautomation/adapter/autoit/mouse.rb +38 -0
- data/lib/rautomation/adapter/autoit/text_field.rb +70 -0
- data/lib/rautomation/adapter/autoit/window.rb +197 -0
- data/lib/rautomation/adapter/autoit.rb +8 -0
- data/lib/rautomation/adapter/helper.rb +64 -0
- data/lib/rautomation/adapter/ms_uia/button.rb +21 -0
- data/lib/rautomation/adapter/ms_uia/button_helper.rb +19 -0
- data/lib/rautomation/adapter/ms_uia/checkbox.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/constants.rb +111 -0
- data/lib/rautomation/adapter/ms_uia/control.rb +134 -0
- data/lib/rautomation/adapter/ms_uia/functions.rb +279 -0
- data/lib/rautomation/adapter/ms_uia/keys.rb +121 -0
- data/lib/rautomation/adapter/ms_uia/keystroke_converter.rb +122 -0
- data/lib/rautomation/adapter/ms_uia/label.rb +18 -0
- data/lib/rautomation/adapter/ms_uia/list_box.rb +46 -0
- data/lib/rautomation/adapter/ms_uia/list_item.rb +22 -0
- data/lib/rautomation/adapter/ms_uia/locators.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
- data/lib/rautomation/adapter/ms_uia/radio.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/select_list.rb +85 -0
- data/lib/rautomation/adapter/ms_uia/spinner.rb +31 -0
- data/lib/rautomation/adapter/ms_uia/tab_control.rb +46 -0
- data/lib/rautomation/adapter/ms_uia/table.rb +140 -0
- data/lib/rautomation/adapter/ms_uia/text_field.rb +39 -0
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +428 -0
- data/lib/rautomation/adapter/ms_uia/value_control.rb +21 -0
- data/lib/rautomation/adapter/ms_uia/window.rb +289 -0
- data/lib/rautomation/adapter/ms_uia.rb +27 -0
- data/lib/rautomation/adapter/win_32/button.rb +14 -0
- data/lib/rautomation/adapter/win_32/button_helper.rb +24 -0
- data/lib/rautomation/adapter/win_32/checkbox.rb +14 -0
- data/lib/rautomation/adapter/win_32/constants.rb +73 -0
- data/lib/rautomation/adapter/win_32/control.rb +86 -0
- data/lib/rautomation/adapter/win_32/functions.rb +336 -0
- data/lib/rautomation/adapter/win_32/keys.rb +146 -0
- data/lib/rautomation/adapter/win_32/label.rb +10 -0
- data/lib/rautomation/adapter/win_32/list_box.rb +40 -0
- data/lib/rautomation/adapter/win_32/locators.rb +22 -0
- data/lib/rautomation/adapter/win_32/mouse.rb +59 -0
- data/lib/rautomation/adapter/win_32/password_field.rb +15 -0
- data/lib/rautomation/adapter/win_32/radio.rb +11 -0
- data/lib/rautomation/adapter/win_32/select_list.rb +97 -0
- data/lib/rautomation/adapter/win_32/table.rb +25 -0
- data/lib/rautomation/adapter/win_32/text_field.rb +52 -0
- data/lib/rautomation/adapter/win_32/window.rb +277 -0
- data/lib/rautomation/adapter/win_32.rb +23 -0
- data/lib/rautomation/button.rb +55 -0
- data/lib/rautomation/element_collections.rb +55 -0
- data/lib/rautomation/platform.rb +15 -0
- data/lib/rautomation/text_field.rb +60 -0
- data/lib/rautomation/version.rb +3 -0
- data/lib/rautomation/wait_helper.rb +23 -0
- data/lib/rautomation/window.rb +248 -0
- data/lib/rautomation.rb +8 -0
- data/rautomation.gemspec +52 -0
- data/spec/adapter/autoit/mouse_spec.rb +53 -0
- data/spec/adapter/autoit/window_spec.rb +17 -0
- data/spec/adapter/ms_uia/button_spec.rb +39 -0
- data/spec/adapter/ms_uia/checkbox_spec.rb +55 -0
- data/spec/adapter/ms_uia/control_spec.rb +88 -0
- data/spec/adapter/ms_uia/functions_spec.rb +39 -0
- data/spec/adapter/ms_uia/keystroke_converter_spec.rb +48 -0
- data/spec/adapter/ms_uia/label_spec.rb +18 -0
- data/spec/adapter/ms_uia/list_item_spec.rb +14 -0
- data/spec/adapter/ms_uia/listbox_spec.rb +73 -0
- data/spec/adapter/ms_uia/radio_spec.rb +39 -0
- data/spec/adapter/ms_uia/select_list_spec.rb +118 -0
- data/spec/adapter/ms_uia/spinner_spec.rb +44 -0
- data/spec/adapter/ms_uia/tab_control_spec.rb +53 -0
- data/spec/adapter/ms_uia/table_spec.rb +197 -0
- data/spec/adapter/ms_uia/text_field_spec.rb +43 -0
- data/spec/adapter/ms_uia/value_control_spec.rb +11 -0
- data/spec/adapter/ms_uia/window_spec.rb +81 -0
- data/spec/adapter/win_32/button_spec.rb +31 -0
- data/spec/adapter/win_32/checkbox_spec.rb +46 -0
- data/spec/adapter/win_32/label_spec.rb +13 -0
- data/spec/adapter/win_32/listbox_spec.rb +41 -0
- data/spec/adapter/win_32/mouse_spec.rb +49 -0
- data/spec/adapter/win_32/radio_spec.rb +33 -0
- data/spec/adapter/win_32/select_list_spec.rb +65 -0
- data/spec/adapter/win_32/table_spec.rb +27 -0
- data/spec/adapter/win_32/text_field_spec.rb +24 -0
- data/spec/adapter/win_32/window_spec.rb +61 -0
- data/spec/button_spec.rb +67 -0
- data/spec/buttons_spec.rb +21 -0
- data/spec/spec_helper.rb +128 -0
- data/spec/text_field_spec.rb +64 -0
- data/spec/text_fields_spec.rb +22 -0
- data/spec/window_spec.rb +150 -0
- data/spec/windows_spec.rb +76 -0
- metadata +369 -0
@@ -0,0 +1,428 @@
|
|
1
|
+
#todo - move this file up to the same level as the others
|
2
|
+
#todo - organize the methods better
|
3
|
+
|
4
|
+
module RAutomation
|
5
|
+
module Adapter
|
6
|
+
module MsUia
|
7
|
+
module UiaDll
|
8
|
+
extend FFI::Library
|
9
|
+
|
10
|
+
HowToFind = enum(:hwnd, 1,
|
11
|
+
:id,
|
12
|
+
:value,
|
13
|
+
:focus,
|
14
|
+
:point)
|
15
|
+
|
16
|
+
|
17
|
+
class FindData < FFI::Union
|
18
|
+
layout :string_data, [:uint8, 256],
|
19
|
+
:int_data, :int,
|
20
|
+
:point_data, [:int, 2]
|
21
|
+
end
|
22
|
+
|
23
|
+
class SearchCriteria < FFI::Struct
|
24
|
+
def self.from_locator(parent, locator)
|
25
|
+
info = SearchCriteria.new
|
26
|
+
info.parent_window = parent
|
27
|
+
info.index = locator[:index] || 0
|
28
|
+
info.children_only = locator[:children_only]
|
29
|
+
|
30
|
+
case
|
31
|
+
when locator[:hwnd]
|
32
|
+
info.how = :hwnd
|
33
|
+
info.data = locator[:hwnd]
|
34
|
+
when locator[:id]
|
35
|
+
info.how = :id
|
36
|
+
info.data = locator[:id]
|
37
|
+
when locator[:value]
|
38
|
+
info.how = :value
|
39
|
+
info.data = locator[:value]
|
40
|
+
when locator[:point]
|
41
|
+
info.how = :point
|
42
|
+
info.data = locator[:point]
|
43
|
+
when locator[:focus]
|
44
|
+
info.how = :focus
|
45
|
+
end
|
46
|
+
info
|
47
|
+
end
|
48
|
+
|
49
|
+
def how
|
50
|
+
self[:how]
|
51
|
+
end
|
52
|
+
|
53
|
+
def how=(value)
|
54
|
+
self[:how] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
def index
|
58
|
+
self[:index]
|
59
|
+
end
|
60
|
+
|
61
|
+
def index=(value)
|
62
|
+
self[:index] = value
|
63
|
+
end
|
64
|
+
|
65
|
+
def children_only?
|
66
|
+
self[:children_only]
|
67
|
+
end
|
68
|
+
|
69
|
+
def children_only=(yes_or_no)
|
70
|
+
self[:children_only] = yes_or_no
|
71
|
+
end
|
72
|
+
|
73
|
+
def parent_window
|
74
|
+
self[:hwnd]
|
75
|
+
end
|
76
|
+
|
77
|
+
def parent_window=(parent)
|
78
|
+
self[:hwnd] = parent
|
79
|
+
end
|
80
|
+
|
81
|
+
def data
|
82
|
+
case how
|
83
|
+
when :hwnd
|
84
|
+
return self[:data][:int_data]
|
85
|
+
when :id, :value
|
86
|
+
return self[:data][:string_data].to_ptr.read_string
|
87
|
+
when :point
|
88
|
+
return self[:data][:point_data].to_ptr.read_array_of_int(2)
|
89
|
+
else
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def data=(value)
|
95
|
+
case how
|
96
|
+
when :hwnd
|
97
|
+
self[:data][:int_data] = value || 0 # cannot accept nil
|
98
|
+
when :id, :value
|
99
|
+
self[:data][:string_data] = value
|
100
|
+
when :point
|
101
|
+
self[:data][:point_data].to_ptr.write_array_of_int(value)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
layout :hwnd, :int,
|
106
|
+
:index, :int,
|
107
|
+
:children_only, :bool,
|
108
|
+
:how, HowToFind, :data, FindData
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.uia_dll_directory
|
112
|
+
File.dirname(__FILE__) + '/../../../../ext/UiaDll/Release'
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
ffi_lib File.join(uia_dll_directory, 'UiaDll.dll')
|
117
|
+
ffi_convention :stdcall
|
118
|
+
|
119
|
+
attach_function :init, :initialize, [:string], :void
|
120
|
+
init(uia_dll_directory)
|
121
|
+
|
122
|
+
# Generic Control methods
|
123
|
+
attach_function :cached_hwnd, :NativeWindowHandle, [SearchCriteria.by_ref], :long
|
124
|
+
attach_function :ElementExists, [SearchCriteria.by_ref], :bool
|
125
|
+
attach_function :process_id, :ProcessId, [SearchCriteria.by_ref], :int
|
126
|
+
attach_function :Control_GetValue, [SearchCriteria.by_ref, :pointer, :int], :void
|
127
|
+
attach_function :set_control_value, :Control_SetValue, [SearchCriteria.by_ref, :string], :void
|
128
|
+
attach_function :Text_GetValue, [SearchCriteria.by_ref, :pointer, :int], :void
|
129
|
+
attach_function :set_text, :Text_SetValue, [SearchCriteria.by_ref, :string], :void
|
130
|
+
attach_function :BoundingRectangle, [SearchCriteria.by_ref, :pointer], :int
|
131
|
+
attach_function :current_control_type, :ControlType, [SearchCriteria.by_ref], :int
|
132
|
+
attach_function :Name, [SearchCriteria.by_ref, :pointer, :int], :void
|
133
|
+
attach_function :ClassName, [SearchCriteria.by_ref, :pointer, :int], :void
|
134
|
+
attach_function :is_enabled, :IsEnabled, [SearchCriteria.by_ref], :bool
|
135
|
+
attach_function :is_focused, :IsFocused, [SearchCriteria.by_ref], :bool
|
136
|
+
attach_function :set_focus, :SetControlFocus, [SearchCriteria.by_ref], :bool
|
137
|
+
attach_function :GetClassNames, [SearchCriteria.by_ref, :pointer], :int
|
138
|
+
attach_function :HelpText, [SearchCriteria.by_ref, :pointer, :int], :void
|
139
|
+
attach_function :SendKeys, [SearchCriteria.by_ref, :string, :pointer, :int], :void
|
140
|
+
|
141
|
+
def self.exists?(search_information)
|
142
|
+
ElementExists search_information
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.bounding_rectangle(search_information)
|
146
|
+
boundary = FFI::MemoryPointer.new :long, 4
|
147
|
+
BoundingRectangle search_information, boundary
|
148
|
+
boundary.read_array_of_long(4)
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.get_control_value(search_information)
|
152
|
+
string_from(:Control_GetValue, search_information)
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.get_text(search_information)
|
156
|
+
string_from(:Text_GetValue, search_information)
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.help_text(search_information)
|
160
|
+
string_from(:HelpText, search_information)
|
161
|
+
end
|
162
|
+
|
163
|
+
def self.name(search_information)
|
164
|
+
string_from(:Name, search_information)
|
165
|
+
end
|
166
|
+
|
167
|
+
def self.class_name(search_information)
|
168
|
+
string_from(:ClassName, search_information)
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.children_class_names(search_information)
|
172
|
+
strings_from :GetClassNames, search_information
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.send_keys(search_information, keys_to_send)
|
176
|
+
can_throw(:SendKeys, search_information, keys_to_send)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Toggle methods
|
180
|
+
attach_function :is_set, :IsSet, [SearchCriteria.by_ref], :bool
|
181
|
+
|
182
|
+
# Selection Item methods
|
183
|
+
attach_function :is_selected, :IsSelected, [SearchCriteria.by_ref], :bool
|
184
|
+
|
185
|
+
# Select List methods
|
186
|
+
attach_function :SelectList_Selection,
|
187
|
+
[SearchCriteria.by_ref, :pointer, :int], :void
|
188
|
+
attach_function :SelectList_Selections,
|
189
|
+
[SearchCriteria.by_ref, :pointer], :int
|
190
|
+
attach_function :SelectList_Options,
|
191
|
+
[SearchCriteria.by_ref, :pointer], :int
|
192
|
+
attach_function :select_list_count, :SelectList_Count,
|
193
|
+
[SearchCriteria.by_ref], :int
|
194
|
+
attach_function :select_list_selected_index, :SelectList_SelectedIndex,
|
195
|
+
[SearchCriteria.by_ref], :int
|
196
|
+
attach_function :select_list_value_at, :SelectList_ValueAt,
|
197
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :bool
|
198
|
+
attach_function :select_list_select_index, :SelectList_SelectIndex,
|
199
|
+
[SearchCriteria.by_ref, :int], :bool
|
200
|
+
attach_function :select_list_select_value, :SelectList_SelectValue,
|
201
|
+
[SearchCriteria.by_ref, :pointer], :int
|
202
|
+
attach_function :SelectList_RemoveIndex,
|
203
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :void
|
204
|
+
attach_function :SelectList_RemoveValue,
|
205
|
+
[SearchCriteria.by_ref, :string, :pointer, :int], :void
|
206
|
+
|
207
|
+
def self.select_options(search_information)
|
208
|
+
strings_from(:SelectList_Options, search_information)
|
209
|
+
end
|
210
|
+
|
211
|
+
def self.selection(search_information)
|
212
|
+
string_from(:SelectList_Selection, search_information)
|
213
|
+
end
|
214
|
+
|
215
|
+
def self.selections(search_information)
|
216
|
+
strings_from(:SelectList_Selections, search_information)
|
217
|
+
end
|
218
|
+
|
219
|
+
def self.remove_from_selection(search_information, which_item)
|
220
|
+
case which_item
|
221
|
+
when Integer
|
222
|
+
can_throw(:SelectList_RemoveIndex, search_information, which_item)
|
223
|
+
when String
|
224
|
+
can_throw(:SelectList_RemoveValue, search_information, which_item)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Spinner methods
|
229
|
+
attach_function :Spinner_GetValue,
|
230
|
+
[SearchCriteria.by_ref, :pointer, :int], :double
|
231
|
+
attach_function :Spinner_SetValue,
|
232
|
+
[SearchCriteria.by_ref, :double, :pointer, :int], :void
|
233
|
+
attach_function :Spinner_Minimum,
|
234
|
+
[SearchCriteria.by_ref, :pointer, :int], :double
|
235
|
+
attach_function :Spinner_Maximum,
|
236
|
+
[SearchCriteria.by_ref, :pointer, :int], :double
|
237
|
+
attach_function :Spinner_Increment,
|
238
|
+
[SearchCriteria.by_ref, :pointer, :int], :double
|
239
|
+
attach_function :Spinner_Decrement,
|
240
|
+
[SearchCriteria.by_ref, :pointer, :int], :double
|
241
|
+
|
242
|
+
def self.spinner_value(search_information)
|
243
|
+
can_throw(:Spinner_GetValue, search_information)
|
244
|
+
end
|
245
|
+
|
246
|
+
def self.set_spinner_value(search_information, value)
|
247
|
+
can_throw(:Spinner_SetValue, search_information, value)
|
248
|
+
end
|
249
|
+
|
250
|
+
def self.spinner_min(search_information)
|
251
|
+
can_throw(:Spinner_Minimum, search_information)
|
252
|
+
end
|
253
|
+
|
254
|
+
def self.spinner_max(search_information)
|
255
|
+
can_throw(:Spinner_Maximum, search_information)
|
256
|
+
end
|
257
|
+
|
258
|
+
def self.increment_spinner(search_information)
|
259
|
+
can_throw(:Spinner_Increment, search_information)
|
260
|
+
end
|
261
|
+
|
262
|
+
def self.decrement_spinner(search_information)
|
263
|
+
can_throw(:Spinner_Decrement, search_information)
|
264
|
+
end
|
265
|
+
|
266
|
+
# Tab Control methods
|
267
|
+
attach_function :TabControl_Items,
|
268
|
+
[SearchCriteria.by_ref, :pointer], :int
|
269
|
+
attach_function :TabControl_Selection,
|
270
|
+
[SearchCriteria.by_ref, :pointer, :int], :void
|
271
|
+
attach_function :TabControl_SelectByIndex,
|
272
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :void
|
273
|
+
attach_function :TabControl_SelectByValue,
|
274
|
+
[SearchCriteria.by_ref, :string, :pointer, :int], :void
|
275
|
+
attach_function :tab_control_selected_index, :TabControl_SelectedIndex, [SearchCriteria.by_ref], :int
|
276
|
+
|
277
|
+
def self.tab_items(search_information)
|
278
|
+
strings_from(:TabControl_Items, search_information)
|
279
|
+
end
|
280
|
+
|
281
|
+
def self.tab_selection(search_information)
|
282
|
+
string_from(:TabControl_Selection, search_information)
|
283
|
+
end
|
284
|
+
|
285
|
+
def self.select_tab(search_information, which)
|
286
|
+
case which
|
287
|
+
when Integer
|
288
|
+
can_throw(:TabControl_SelectByIndex, search_information, which)
|
289
|
+
when String
|
290
|
+
can_throw(:TabControl_SelectByValue, search_information, which)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
# Menu methods
|
295
|
+
attach_function :select_menu_item, :Menu_SelectPath,
|
296
|
+
[:long, :pointer, :int, :varargs], :void
|
297
|
+
attach_function :menu_item_exists, :Menu_ItemExists,
|
298
|
+
[:long, :varargs], :bool
|
299
|
+
|
300
|
+
# Table methods
|
301
|
+
attach_function :Table_GetHeaders,
|
302
|
+
[SearchCriteria.by_ref, :pointer], :int
|
303
|
+
attach_function :Table_GetValues,
|
304
|
+
[SearchCriteria.by_ref, :pointer], :int
|
305
|
+
attach_function :Table_GetSelectedIndexes,
|
306
|
+
[SearchCriteria.by_ref, :pointer], :int
|
307
|
+
attach_function :table_row_count, :Table_RowCount,
|
308
|
+
[SearchCriteria.by_ref], :int
|
309
|
+
attach_function :Table_CoordinateIsValid,
|
310
|
+
[SearchCriteria.by_ref, :int, :int], :bool
|
311
|
+
attach_function :Table_ValueAt,
|
312
|
+
[SearchCriteria.by_ref, :int, :int, :pointer, :int], :void
|
313
|
+
attach_function :Table_SelectByIndex,
|
314
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :void
|
315
|
+
attach_function :Table_SingleSelectByIndex,
|
316
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :void
|
317
|
+
attach_function :Table_SelectByValue,
|
318
|
+
[SearchCriteria.by_ref, :string, :pointer, :int], :void
|
319
|
+
attach_function :table_row_is_selected, :Table_IsSelectedByIndex,
|
320
|
+
[SearchCriteria.by_ref, :int], :bool
|
321
|
+
attach_function :Table_RemoveRowByIndex,
|
322
|
+
[SearchCriteria.by_ref, :int, :pointer, :int], :void
|
323
|
+
attach_function :Table_RemoveRowByValue,
|
324
|
+
[SearchCriteria.by_ref, :string, :pointer, :int], :void
|
325
|
+
|
326
|
+
def self.table_selected_indexes(search_information)
|
327
|
+
integers_from(:Table_GetSelectedIndexes, search_information)
|
328
|
+
end
|
329
|
+
|
330
|
+
def self.table_select(search_information, which_item)
|
331
|
+
case which_item
|
332
|
+
when Integer
|
333
|
+
can_throw(:Table_SelectByIndex, search_information, which_item)
|
334
|
+
when String
|
335
|
+
can_throw(:Table_SelectByValue, search_information, which_item)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
def self.table_single_select(search_information, which_item)
|
340
|
+
can_throw(:Table_SingleSelectByIndex, search_information, which_item)
|
341
|
+
end
|
342
|
+
|
343
|
+
def self.table_value_at(search_information, row, column=0)
|
344
|
+
string_from(:Table_ValueAt, search_information, row, column)
|
345
|
+
end
|
346
|
+
|
347
|
+
def self.table_coordinate_valid?(search_information, row, column=0)
|
348
|
+
Table_CoordinateIsValid search_information, row, column
|
349
|
+
end
|
350
|
+
|
351
|
+
def self.table_headers(search_information)
|
352
|
+
strings_from :Table_GetHeaders, search_information
|
353
|
+
end
|
354
|
+
|
355
|
+
def self.table_values(search_information)
|
356
|
+
strings_from :Table_GetValues, search_information
|
357
|
+
end
|
358
|
+
|
359
|
+
def self.table_remove_from_selection(search_information, which_row)
|
360
|
+
case which_row
|
361
|
+
when Integer
|
362
|
+
can_throw(:Table_RemoveRowByIndex, search_information, which_row)
|
363
|
+
when String
|
364
|
+
can_throw(:Table_RemoveRowByValue, search_information, which_row)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
# String methods
|
369
|
+
attach_function :clean_up_strings, :String_CleanUp,
|
370
|
+
[:pointer, :int], :void
|
371
|
+
|
372
|
+
attach_function :handle_from_point, :HandleFromPoint,
|
373
|
+
[:int, :int], :long
|
374
|
+
attach_function :move_mouse, :MoveMouse,
|
375
|
+
[:int,:int], :long
|
376
|
+
attach_function :click_mouse, :ClickMouse,
|
377
|
+
[], :long
|
378
|
+
attach_function :is_offscreen, :IsOffscreen,
|
379
|
+
[SearchCriteria.by_ref], :bool
|
380
|
+
attach_function :expand_by_value, :ExpandItemByValue,
|
381
|
+
[SearchCriteria.by_ref, :string], :void
|
382
|
+
attach_function :expand_by_index, :ExpandItemByIndex,
|
383
|
+
[SearchCriteria.by_ref, :int], :void
|
384
|
+
attach_function :collapse_by_value, :CollapseItemByValue,
|
385
|
+
[SearchCriteria.by_ref, :string], :void
|
386
|
+
attach_function :collapse_by_index, :CollapseItemByIndex,
|
387
|
+
[SearchCriteria.by_ref, :int], :void
|
388
|
+
attach_function :Click,
|
389
|
+
[SearchCriteria.by_ref, :pointer, :int], :bool
|
390
|
+
|
391
|
+
def self.control_click(search_information)
|
392
|
+
can_throw(:Click, search_information)
|
393
|
+
end
|
394
|
+
|
395
|
+
private
|
396
|
+
def self.integers_from(method, search_information)
|
397
|
+
item_count = send method, search_information, nil
|
398
|
+
pointer = FFI::MemoryPointer.new :pointer, item_count
|
399
|
+
send method, search_information, pointer
|
400
|
+
pointer.read_array_of_int(item_count)
|
401
|
+
end
|
402
|
+
|
403
|
+
def self.strings_from(method, hwnd)
|
404
|
+
string_count = send method, hwnd, nil
|
405
|
+
pointer = FFI::MemoryPointer.new :pointer, string_count
|
406
|
+
send method, hwnd, pointer
|
407
|
+
strings = pointer.get_array_of_string 0, string_count
|
408
|
+
clean_up_strings pointer, string_count
|
409
|
+
strings
|
410
|
+
end
|
411
|
+
|
412
|
+
def self.string_from(method, *args)
|
413
|
+
pointer = FFI::MemoryPointer.new :pointer, 1024
|
414
|
+
send method, *(args << pointer << 1024)
|
415
|
+
pointer.read_string
|
416
|
+
end
|
417
|
+
|
418
|
+
def self.can_throw(method, *args)
|
419
|
+
string_buffer = FFI::MemoryPointer.new :char, 1024
|
420
|
+
result = send method, *(args << string_buffer << 1024)
|
421
|
+
error_info = string_buffer.read_string
|
422
|
+
raise error_info unless error_info.empty?
|
423
|
+
result
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
class ValueControl < Control
|
5
|
+
include WaitHelper
|
6
|
+
include Locators
|
7
|
+
|
8
|
+
def value
|
9
|
+
UiaDll::get_control_value(search_information)
|
10
|
+
end
|
11
|
+
|
12
|
+
def set(value)
|
13
|
+
UiaDll::set_control_value(search_information, value)
|
14
|
+
end
|
15
|
+
|
16
|
+
alias_method :exists?, :exist?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|