rautomation 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -8
- data/Gemfile.lock +2 -2
- data/History.rdoc +13 -0
- data/README.rdoc +3 -2
- data/Rakefile +30 -10
- data/VERSION +1 -1
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
- data/ext/UiaDll/UiaDll/AutomatedComboBox.cpp +66 -0
- data/ext/UiaDll/UiaDll/AutomatedComboBox.h +32 -0
- data/ext/UiaDll/UiaDll/AutomatedTable.cpp +50 -0
- data/ext/UiaDll/UiaDll/AutomatedTable.h +22 -0
- data/ext/UiaDll/UiaDll/AutomationClicker.cpp +50 -0
- data/ext/UiaDll/UiaDll/AutomationClicker.h +24 -0
- data/ext/UiaDll/UiaDll/ExpandCollapseHelper.cpp +53 -0
- data/ext/UiaDll/UiaDll/ExpandCollapseHelper.h +22 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.h +22 -0
- data/ext/UiaDll/UiaDll/ReadMe.txt +8 -18
- data/ext/UiaDll/UiaDll/StringHelper.cpp +9 -0
- data/ext/UiaDll/UiaDll/StringHelper.h +7 -0
- data/ext/UiaDll/UiaDll/ToggleStateHelper.cpp +33 -0
- data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +458 -325
- data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +45 -28
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +66 -7
- data/ext/UiaDll/UiaDll/app.ico +0 -0
- data/ext/UiaDll/UiaDll/app.rc +0 -0
- data/ext/UiaDll/UiaDll/dllmain.cpp +5 -23
- data/ext/UiaDll/UiaDll/resource.h +3 -0
- data/ext/UiaDll/UiaDll/stdafx.cpp +0 -3
- data/ext/UiaDll/UiaDll/stdafx.h +23 -18
- data/ext/UiaDll/UiaDll.sln +6 -6
- data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.resx +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.resx +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.Designer.cs +173 -76
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.cs +76 -77
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.resx +3 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.resx +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Program.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/AssemblyInfo.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Resources.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Resources.resx +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Settings.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Settings.settings +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.Designer.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.cs +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.resx +0 -0
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/WindowsForms.csproj +2 -2
- data/ext/WindowsForms/{src/WindowsForms/WindowsForms.sln → WindowsForms.sln} +0 -0
- data/lib/rautomation/adapter/ms_uia/constants.rb +1 -0
- data/lib/rautomation/adapter/ms_uia/control.rb +11 -0
- data/lib/rautomation/adapter/ms_uia/functions.rb +8 -5
- data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
- data/lib/rautomation/adapter/ms_uia/select_list.rb +4 -12
- data/lib/rautomation/adapter/ms_uia/table.rb +90 -11
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +48 -2
- data/lib/rautomation/adapter/ms_uia/window.rb +6 -1
- data/lib/rautomation/adapter/ms_uia.rb +1 -0
- data/spec/adapter/autoit/mouse_spec.rb +2 -2
- data/spec/adapter/ms_uia/functions_spec.rb +39 -0
- data/spec/adapter/ms_uia/select_list_spec.rb +26 -13
- data/spec/adapter/ms_uia/table_spec.rb +96 -2
- data/spec/adapter/ms_uia/window_spec.rb +37 -11
- data/spec/adapter/win_32/mouse_spec.rb +2 -2
- data/spec/adapter/win_32/window_spec.rb +0 -9
- data/spec/spec_helper.rb +3 -3
- data/spec/window_spec.rb +17 -6
- metadata +48 -40
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp +0 -174
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj +0 -95
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters +0 -42
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user +0 -3
- data/ext/ListViewExplorer/ListViewExplorer/ReadMe.txt +0 -40
- data/ext/ListViewExplorer/ListViewExplorer/stdafx.cpp +0 -8
- data/ext/ListViewExplorer/ListViewExplorer/stdafx.h +0 -17
- data/ext/ListViewExplorer/ListViewExplorer/table_support.cpp +0 -250
- data/ext/ListViewExplorer/ListViewExplorer/table_support.h +0 -2
- data/ext/ListViewExplorer/ListViewExplorer/targetver.h +0 -8
- data/ext/ListViewExplorer/ListViewExplorer.sln +0 -20
- data/ext/ListViewExplorer/ListViewExplorer.suo +0 -0
- data/ext/UiaDll/UiaDll.suo +0 -0
- data/ext/WindowsForms/bin/WindowsForms.exe +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms.suo +0 -0
@@ -1,250 +0,0 @@
|
|
1
|
-
#include "stdafx.h"
|
2
|
-
|
3
|
-
#define BUFFER_SIZE 255
|
4
|
-
|
5
|
-
long get_number_of_rows(IAccessible *pAccessible) {
|
6
|
-
long count ;
|
7
|
-
|
8
|
-
pAccessible->get_accChildCount(&count) ;
|
9
|
-
return count ;
|
10
|
-
}
|
11
|
-
|
12
|
-
void get_name(long childId, IAccessible *pAccessible, char *itemText) {
|
13
|
-
BSTR bstrValue ;
|
14
|
-
|
15
|
-
VARIANT varIn ;
|
16
|
-
VariantInit(&varIn) ;
|
17
|
-
varIn.vt = VT_I4 ;
|
18
|
-
varIn.lVal = childId ;
|
19
|
-
|
20
|
-
if (pAccessible->get_accName(varIn, &bstrValue) == S_OK) {
|
21
|
-
char *pszName = _com_util::ConvertBSTRToString(bstrValue) ;
|
22
|
-
strcpy(itemText, pszName) ;
|
23
|
-
delete[] pszName ;
|
24
|
-
SysFreeString(bstrValue) ;
|
25
|
-
} else
|
26
|
-
strcpy(itemText, "\0") ;
|
27
|
-
}
|
28
|
-
|
29
|
-
HRESULT get_role(long childId, IAccessible *pAccessible, long *pRole) {
|
30
|
-
VARIANT varIn ;
|
31
|
-
VariantInit(&varIn) ;
|
32
|
-
varIn.vt = VT_I4 ;
|
33
|
-
varIn.lVal = childId ;
|
34
|
-
|
35
|
-
VARIANT varOut ;
|
36
|
-
VariantInit(&varOut) ;
|
37
|
-
varOut.vt = VT_I4 ;
|
38
|
-
|
39
|
-
HRESULT hr = pAccessible->get_accRole(varIn, &varOut) ;
|
40
|
-
*pRole = varOut.lVal ;
|
41
|
-
|
42
|
-
return hr ;
|
43
|
-
}
|
44
|
-
|
45
|
-
void get_role(long childId, IAccessible *pAccessible, char *itemText) {
|
46
|
-
long role ;
|
47
|
-
|
48
|
-
if (get_role(childId, pAccessible, &role) == S_OK) {
|
49
|
-
int roleTextMax = 255 ;
|
50
|
-
LPTSTR pRoleText = new TCHAR[roleTextMax] ;
|
51
|
-
GetRoleText(role, pRoleText, roleTextMax) ;
|
52
|
-
|
53
|
-
int lenSzRoleText = 255 ;
|
54
|
-
char *pszRoleText = new char[lenSzRoleText] ;
|
55
|
-
WideCharToMultiByte(CP_ACP, 0, pRoleText, wcslen(pRoleText) + 1, pszRoleText, lenSzRoleText, NULL, NULL) ;
|
56
|
-
|
57
|
-
sprintf(itemText, "0x%x, %s", role, pszRoleText) ;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
void get_description(long childId, IAccessible *pAccessible, char *itemText) {
|
62
|
-
BSTR bstrValue ;
|
63
|
-
|
64
|
-
VARIANT varIn ;
|
65
|
-
VariantInit(&varIn) ;
|
66
|
-
varIn.vt = VT_I4 ;
|
67
|
-
varIn.lVal = childId ;
|
68
|
-
|
69
|
-
if (pAccessible->get_accDescription(varIn, &bstrValue) == S_OK) {
|
70
|
-
char *pszName = _com_util::ConvertBSTRToString(bstrValue) ;
|
71
|
-
strcpy(itemText, pszName) ;
|
72
|
-
delete[] pszName ;
|
73
|
-
SysFreeString(bstrValue) ;
|
74
|
-
} else
|
75
|
-
strcpy(itemText, "\0") ;
|
76
|
-
}
|
77
|
-
|
78
|
-
void print_child_name(long childId, IAccessible *pAccessible) {
|
79
|
-
char *childName = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
|
80
|
-
get_name(childId, pAccessible, childName) ;
|
81
|
-
|
82
|
-
if (childId == CHILDID_SELF)
|
83
|
-
printf("Name for child SELF is %s\r\n", childId, childName) ;
|
84
|
-
else
|
85
|
-
printf("Name for child %d is %s\r\n", childId, childName) ;
|
86
|
-
|
87
|
-
free(childName) ;
|
88
|
-
}
|
89
|
-
|
90
|
-
void print_child_role(long childId, IAccessible *pAccessible) {
|
91
|
-
char *childRole = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
|
92
|
-
get_role(childId, pAccessible, childRole) ;
|
93
|
-
|
94
|
-
if (childId == CHILDID_SELF)
|
95
|
-
printf("Role for child SELF is %s\r\n", childId, childRole) ;
|
96
|
-
else
|
97
|
-
printf("Role for child %d is %s\r\n", childId, childRole) ;
|
98
|
-
|
99
|
-
free(childRole) ;
|
100
|
-
}
|
101
|
-
|
102
|
-
void walk_tree(IAccessible *pAccessible, char **pColumnHeaderNames, long *pColumnHeadersCount) {
|
103
|
-
HRESULT hr ;
|
104
|
-
long childCount ;
|
105
|
-
|
106
|
-
hr = pAccessible->get_accChildCount(&childCount) ;
|
107
|
-
if (FAILED(hr) || childCount == 0)
|
108
|
-
return ;
|
109
|
-
|
110
|
-
VARIANT *pChildVariants = new VARIANT[childCount] ;
|
111
|
-
long childrenFound ;
|
112
|
-
hr = AccessibleChildren(pAccessible, 0, childCount, pChildVariants, &childrenFound) ;
|
113
|
-
if (FAILED(hr))
|
114
|
-
return ;
|
115
|
-
|
116
|
-
for (int i=1; i < childrenFound + 1; i++) {
|
117
|
-
VARIANT vChild = pChildVariants[i] ;
|
118
|
-
if (vChild.vt == VT_DISPATCH) {
|
119
|
-
IDispatch *pDispatch = vChild.pdispVal ;
|
120
|
-
IAccessible *pChildAccessible = NULL ;
|
121
|
-
hr = pDispatch->QueryInterface(IID_IAccessible, (void**) &pChildAccessible) ;
|
122
|
-
if (hr == S_OK) {
|
123
|
-
walk_tree(pChildAccessible, pColumnHeaderNames, pColumnHeadersCount) ;
|
124
|
-
|
125
|
-
pChildAccessible->Release() ;
|
126
|
-
}
|
127
|
-
|
128
|
-
pDispatch->Release() ;
|
129
|
-
} else {
|
130
|
-
long role ;
|
131
|
-
get_role(i, pAccessible, &role) ;
|
132
|
-
if (role == 0x19) {
|
133
|
-
if (pColumnHeaderNames == NULL) {
|
134
|
-
*pColumnHeadersCount = *pColumnHeadersCount + 1 ;
|
135
|
-
} else {
|
136
|
-
char *headerName = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
|
137
|
-
get_name(i, pAccessible, headerName) ;
|
138
|
-
pColumnHeaderNames[i - 1] = headerName ;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
void find_column_headers(IAccessible *pAccessible, char ***pHeaderNames, long *pColumns) {
|
146
|
-
long columns = 0 ;
|
147
|
-
|
148
|
-
walk_tree(pAccessible, NULL, &columns) ;
|
149
|
-
printf("Columns: %d\r\n", columns) ;
|
150
|
-
|
151
|
-
char **pHeaders = (char **)malloc(sizeof(char *) * columns) ;
|
152
|
-
walk_tree(pAccessible, pHeaders, &columns) ;
|
153
|
-
|
154
|
-
*pHeaderNames = pHeaders ;
|
155
|
-
*pColumns = columns ;
|
156
|
-
}
|
157
|
-
|
158
|
-
char *trimwhitespace(char *str) {
|
159
|
-
char *end;
|
160
|
-
// Trim leading space
|
161
|
-
while(isspace(*str))
|
162
|
-
str++;
|
163
|
-
if(*str == 0)
|
164
|
-
// All spaces?
|
165
|
-
return str;
|
166
|
-
// Trim trailing space
|
167
|
-
end = str + strlen(str) - 1;
|
168
|
-
|
169
|
-
while(end > str && isspace(*end))
|
170
|
-
end--; // Write new null terminator
|
171
|
-
|
172
|
-
*(end+1) = 0;
|
173
|
-
|
174
|
-
return str;
|
175
|
-
}
|
176
|
-
|
177
|
-
char* remove_column_header_name(char *columnName, char *item) {
|
178
|
-
int itemLen = strlen(item) ;
|
179
|
-
int columnNameLen = strlen(columnName) ;
|
180
|
-
|
181
|
-
if (itemLen > 0) {
|
182
|
-
char *newItem = (char *)malloc(sizeof(char *) * (itemLen - columnNameLen)) ; // still a bit too long
|
183
|
-
|
184
|
-
strcpy(newItem, item + columnNameLen + 2) ; // :<space>
|
185
|
-
|
186
|
-
free(item) ;
|
187
|
-
return newItem ;
|
188
|
-
} else
|
189
|
-
return item ;
|
190
|
-
}
|
191
|
-
|
192
|
-
void get_table_strings(HMODULE oleAccModule, HWND controlHwnd, char **tableStrings, long *numberOfRowsOut, long *numberOfColumnsOut) {
|
193
|
-
IAccessible *pAccessible ;
|
194
|
-
LPFNACCESSIBLEOBJECTFROMWINDOW lpfnAccessibleObjectFromWindow ;
|
195
|
-
|
196
|
-
lpfnAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(oleAccModule, "AccessibleObjectFromWindow");
|
197
|
-
|
198
|
-
if (HRESULT hResult = lpfnAccessibleObjectFromWindow(controlHwnd, OBJID_CLIENT, IID_IAccessible, (void**)&pAccessible) == S_OK) {
|
199
|
-
int numberOfRows = get_number_of_rows(pAccessible) ; // including the header
|
200
|
-
long numberOfColumns = 3 ;
|
201
|
-
char ***table_rows ;
|
202
|
-
char **pHeaderNames ;
|
203
|
-
|
204
|
-
find_column_headers(pAccessible, &pHeaderNames, &numberOfColumns) ;
|
205
|
-
|
206
|
-
table_rows = (char ***)malloc(sizeof(char*) * numberOfRows) ;
|
207
|
-
table_rows[0] = pHeaderNames ;
|
208
|
-
|
209
|
-
for (int row = 1; row < numberOfRows; row++) {
|
210
|
-
char **table_column = (char **)malloc(sizeof(char*) * numberOfColumns) ;
|
211
|
-
|
212
|
-
char *mainItem = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
|
213
|
-
get_name(row, pAccessible, mainItem) ;
|
214
|
-
|
215
|
-
char *description = (char *)malloc(sizeof(char) * 2048) ;
|
216
|
-
get_description(row, pAccessible, description) ;
|
217
|
-
|
218
|
-
char *token ;
|
219
|
-
if (strlen(description) > 0)
|
220
|
-
token = strtok(description, ",") ;
|
221
|
-
else
|
222
|
-
token = NULL ;
|
223
|
-
|
224
|
-
for (int column = 0; column < numberOfColumns; column++) {
|
225
|
-
if (column == 0)
|
226
|
-
table_column[column] = mainItem ;
|
227
|
-
else {
|
228
|
-
char *item = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
|
229
|
-
|
230
|
-
if (token != NULL) {
|
231
|
-
strcpy(item, token) ;
|
232
|
-
token = strtok(NULL, ",") ;
|
233
|
-
} else
|
234
|
-
strcpy(item, "\0") ;
|
235
|
-
|
236
|
-
table_column[column] = remove_column_header_name(pHeaderNames[column], trimwhitespace(item)) ;
|
237
|
-
}
|
238
|
-
}
|
239
|
-
|
240
|
-
table_rows[row] = table_column ;
|
241
|
-
}
|
242
|
-
|
243
|
-
*tableStrings = (char *)table_rows ;
|
244
|
-
*numberOfRowsOut = numberOfRows ;
|
245
|
-
*numberOfColumnsOut = numberOfColumns ;
|
246
|
-
} else {
|
247
|
-
*numberOfRowsOut = 0 ;
|
248
|
-
*numberOfColumnsOut = 0 ;
|
249
|
-
}
|
250
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
// Including SDKDDKVer.h defines the highest available Windows platform.
|
4
|
-
|
5
|
-
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
6
|
-
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
7
|
-
|
8
|
-
#include <SDKDDKVer.h>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
|
2
|
-
Microsoft Visual Studio Solution File, Format Version 11.00
|
3
|
-
# Visual C++ Express 2010
|
4
|
-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ListViewExplorer", "ListViewExplorer\ListViewExplorer.vcxproj", "{EF611F7A-863F-4062-AAD2-84D150F4D7C0}"
|
5
|
-
EndProject
|
6
|
-
Global
|
7
|
-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
8
|
-
Debug|Win32 = Debug|Win32
|
9
|
-
Release|Win32 = Release|Win32
|
10
|
-
EndGlobalSection
|
11
|
-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
12
|
-
{EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Debug|Win32.ActiveCfg = Debug|Win32
|
13
|
-
{EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Debug|Win32.Build.0 = Debug|Win32
|
14
|
-
{EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Release|Win32.ActiveCfg = Release|Win32
|
15
|
-
{EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Release|Win32.Build.0 = Release|Win32
|
16
|
-
EndGlobalSection
|
17
|
-
GlobalSection(SolutionProperties) = preSolution
|
18
|
-
HideSolutionNode = FALSE
|
19
|
-
EndGlobalSection
|
20
|
-
EndGlobal
|
Binary file
|
data/ext/UiaDll/UiaDll.suo
DELETED
Binary file
|
Binary file
|
Binary file
|