node-autoit-koffi 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/node-autoit-koffi.iml +13 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +36 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2067 -0
- package/dist/util.d.ts +4 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +51 -0
- package/dist/wchar.d.ts +16 -0
- package/dist/wchar.d.ts.map +1 -0
- package/dist/wchar.js +100 -0
- package/dlls/AutoItX3.dll +0 -0
- package/dlls/AutoItX3_DLL.h +177 -0
- package/dlls/AutoItX3_x64.dll +0 -0
- package/examples/index.test.js +36 -0
- package/package.json +42 -0
- package/tools/gen.ts +0 -0
- package/tools/generate_code.js +578 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
// Ignore this script, everyone.
|
|
2
|
+
|
|
3
|
+
const { forEach } = require("lodash");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const autoitFunctions = {
|
|
6
|
+
AU3_Init: ["void", []],
|
|
7
|
+
AU3_error: ["int", []],
|
|
8
|
+
AU3_AutoItSetOption: ["int", ["string16", "int"]],
|
|
9
|
+
AU3_ClipGet: ["void", ["LPWSTR", "int"]],
|
|
10
|
+
AU3_ClipPut: ["void", ["string16"]],
|
|
11
|
+
AU3_ControlClick: [
|
|
12
|
+
"int",
|
|
13
|
+
["string16", "string16", "string16", "string16", "int", "int", "int"],
|
|
14
|
+
],
|
|
15
|
+
AU3_ControlClickByHandle: [
|
|
16
|
+
"int",
|
|
17
|
+
["int", "int", "string16", "int", "int", "int"],
|
|
18
|
+
],
|
|
19
|
+
AU3_ControlCommand: [
|
|
20
|
+
"void",
|
|
21
|
+
[
|
|
22
|
+
"string16",
|
|
23
|
+
"string16",
|
|
24
|
+
"string16",
|
|
25
|
+
"string16",
|
|
26
|
+
"string16",
|
|
27
|
+
"LPWSTR",
|
|
28
|
+
"int",
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
AU3_ControlCommandByHandle: [
|
|
32
|
+
"void",
|
|
33
|
+
["int", "int", "string16", "string16", "LPWSTR", "int"],
|
|
34
|
+
],
|
|
35
|
+
AU3_ControlListView: [
|
|
36
|
+
"void",
|
|
37
|
+
[
|
|
38
|
+
"string16",
|
|
39
|
+
"string16",
|
|
40
|
+
"string16",
|
|
41
|
+
"string16",
|
|
42
|
+
"string16",
|
|
43
|
+
"string16",
|
|
44
|
+
"LPWSTR",
|
|
45
|
+
"int",
|
|
46
|
+
],
|
|
47
|
+
],
|
|
48
|
+
AU3_ControlListViewByHandle: [
|
|
49
|
+
"void",
|
|
50
|
+
["int", "int", "string16", "string16", "string16", "LPWSTR", "int"],
|
|
51
|
+
],
|
|
52
|
+
AU3_ControlDisable: ["int", ["string16", "string16", "string16"]],
|
|
53
|
+
AU3_ControlDisableByHandle: ["int", ["int", "int"]],
|
|
54
|
+
AU3_ControlEnable: ["int", ["string16", "string16", "string16"]],
|
|
55
|
+
AU3_ControlEnableByHandle: ["int", ["int", "int"]],
|
|
56
|
+
AU3_ControlFocus: ["int", ["string16", "string16", "string16"]],
|
|
57
|
+
AU3_ControlFocusByHandle: ["int", ["int", "int"]],
|
|
58
|
+
AU3_ControlGetFocus: ["void", ["string16", "string16", "LPWSTR", "int"]],
|
|
59
|
+
AU3_ControlGetFocusByHandle: ["void", ["int", "LPWSTR", "int"]],
|
|
60
|
+
AU3_ControlGetHandle: ["int", ["int", "string16"]],
|
|
61
|
+
AU3_ControlGetHandleAsText: [
|
|
62
|
+
"void",
|
|
63
|
+
[
|
|
64
|
+
"string16",
|
|
65
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
66
|
+
"string16",
|
|
67
|
+
"LPWSTR",
|
|
68
|
+
"int",
|
|
69
|
+
],
|
|
70
|
+
],
|
|
71
|
+
AU3_ControlGetPos: ["int", ["string16", "string16", "string16", "LPRECT"]],
|
|
72
|
+
AU3_ControlGetPosByHandle: ["int", ["int", "int", "LPRECT"]],
|
|
73
|
+
AU3_ControlGetText: [
|
|
74
|
+
"void",
|
|
75
|
+
["string16", "string16", "string16", "LPWSTR", "int"],
|
|
76
|
+
],
|
|
77
|
+
AU3_ControlGetTextByHandle: ["void", ["int", "int", "LPWSTR", "int"]],
|
|
78
|
+
AU3_ControlHide: ["int", ["string16", "string16", "string16"]],
|
|
79
|
+
AU3_ControlHideByHandle: ["int", ["int", "int"]],
|
|
80
|
+
AU3_ControlMove: [
|
|
81
|
+
"int",
|
|
82
|
+
["string16", "string16", "string16", "int", "int", "int", "int"],
|
|
83
|
+
],
|
|
84
|
+
AU3_ControlMoveByHandle: ["int", ["int", "int", "int", "int", "int", "int"]],
|
|
85
|
+
AU3_ControlSend: [
|
|
86
|
+
"int",
|
|
87
|
+
["string16", "string16", "string16", "string16", "int"],
|
|
88
|
+
],
|
|
89
|
+
AU3_ControlSendByHandle: ["int", ["int", "int", "string16", "int"]],
|
|
90
|
+
AU3_ControlSetText: ["int", ["string16", "string16", "string16", "string16"]],
|
|
91
|
+
AU3_ControlSetTextByHandle: ["int", ["int", "int", "string16"]],
|
|
92
|
+
AU3_ControlShow: ["int", ["string16", "string16", "string16"]],
|
|
93
|
+
AU3_ControlShowByHandle: ["int", ["int", "int"]],
|
|
94
|
+
AU3_ControlTreeView: [
|
|
95
|
+
"void",
|
|
96
|
+
[
|
|
97
|
+
"string16",
|
|
98
|
+
"string16",
|
|
99
|
+
"string16",
|
|
100
|
+
"string16",
|
|
101
|
+
"string16",
|
|
102
|
+
"string16",
|
|
103
|
+
"LPWSTR",
|
|
104
|
+
"int",
|
|
105
|
+
],
|
|
106
|
+
],
|
|
107
|
+
AU3_ControlTreeViewByHandle: [
|
|
108
|
+
"void",
|
|
109
|
+
["int", "int", "string16", "string16", "string16", "LPWSTR", "int"],
|
|
110
|
+
],
|
|
111
|
+
AU3_DriveMapAdd: [
|
|
112
|
+
"void",
|
|
113
|
+
[
|
|
114
|
+
"string16",
|
|
115
|
+
"string16",
|
|
116
|
+
"int",
|
|
117
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
118
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
119
|
+
"LPWSTR",
|
|
120
|
+
"int",
|
|
121
|
+
],
|
|
122
|
+
],
|
|
123
|
+
AU3_DriveMapDel: ["int", ["string16"]],
|
|
124
|
+
AU3_DriveMapGet: ["void", ["string16", "LPWSTR", "int"]],
|
|
125
|
+
AU3_IsAdmin: ["int", []],
|
|
126
|
+
AU3_MouseClick: [
|
|
127
|
+
"int",
|
|
128
|
+
[/*[in,defaultvalue("LEFT")]*/ "string16", "int", "int", "int", "int"],
|
|
129
|
+
],
|
|
130
|
+
AU3_MouseClickDrag: ["int", ["string16", "int", "int", "int", "int", "int"]],
|
|
131
|
+
AU3_MouseDown: ["void", [/*[in,defaultvalue("LEFT")]*/ "string16"]],
|
|
132
|
+
AU3_MouseGetCursor: ["int", []],
|
|
133
|
+
AU3_MouseGetPos: ["void", ["LPPOINT"]],
|
|
134
|
+
AU3_MouseMove: ["int", ["int", "int", "int"]],
|
|
135
|
+
AU3_MouseUp: ["void", [/*[in,defaultvalue("LEFT")]*/ "string16"]],
|
|
136
|
+
AU3_MouseWheel: ["void", ["string16", "int"]],
|
|
137
|
+
AU3_Opt: ["int", ["string16", "int"]],
|
|
138
|
+
AU3_PixelChecksum: ["uint", ["LPRECT", "int"]],
|
|
139
|
+
AU3_PixelGetColor: ["int", ["int", "int"]],
|
|
140
|
+
AU3_PixelSearch: [
|
|
141
|
+
"void",
|
|
142
|
+
["LPRECT", "int", /*default 0*/ "int", /*default 1*/ "int", "LPPOINT"],
|
|
143
|
+
],
|
|
144
|
+
AU3_ProcessClose: ["int", ["string16"]],
|
|
145
|
+
AU3_ProcessExists: ["int", ["string16"]],
|
|
146
|
+
AU3_ProcessSetPriority: ["int", ["string16", "int"]],
|
|
147
|
+
AU3_ProcessWait: ["int", ["string16", "int"]],
|
|
148
|
+
AU3_ProcessWaitClose: ["int", ["string16", "int"]],
|
|
149
|
+
AU3_Run: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16", "int"]],
|
|
150
|
+
AU3_RunWait: [
|
|
151
|
+
"int",
|
|
152
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
153
|
+
],
|
|
154
|
+
AU3_RunAs: [
|
|
155
|
+
"int",
|
|
156
|
+
[
|
|
157
|
+
"string16",
|
|
158
|
+
"string16",
|
|
159
|
+
"string16",
|
|
160
|
+
"int",
|
|
161
|
+
"string16",
|
|
162
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
163
|
+
"int",
|
|
164
|
+
],
|
|
165
|
+
],
|
|
166
|
+
AU3_RunAsWait: [
|
|
167
|
+
"int",
|
|
168
|
+
[
|
|
169
|
+
"string16",
|
|
170
|
+
"string16",
|
|
171
|
+
"string16",
|
|
172
|
+
"int",
|
|
173
|
+
"string16",
|
|
174
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
175
|
+
"int",
|
|
176
|
+
],
|
|
177
|
+
],
|
|
178
|
+
AU3_Send: ["void", ["string16", "int"]],
|
|
179
|
+
AU3_Shutdown: ["int", ["int"]],
|
|
180
|
+
AU3_Sleep: ["void", ["int"]],
|
|
181
|
+
AU3_StatusbarGetText: [
|
|
182
|
+
"int",
|
|
183
|
+
[
|
|
184
|
+
"string16",
|
|
185
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
186
|
+
/*[in,defaultvalue(1)]*/ "int",
|
|
187
|
+
"LPWSTR",
|
|
188
|
+
"int",
|
|
189
|
+
],
|
|
190
|
+
],
|
|
191
|
+
AU3_StatusbarGetTextByHandle: [
|
|
192
|
+
"int",
|
|
193
|
+
["int", /*[in,defaultvalue(1)]*/ "int", "LPWSTR", "int"],
|
|
194
|
+
],
|
|
195
|
+
AU3_ToolTip: ["void", ["string16", "int", "int"]],
|
|
196
|
+
AU3_WinActivate: ["int", ["string16", "string16"]],
|
|
197
|
+
AU3_WinActivateByHandle: ["int", ["int"]],
|
|
198
|
+
AU3_WinActive: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
199
|
+
AU3_WinActiveByHandle: ["int", ["int"]],
|
|
200
|
+
AU3_WinClose: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
201
|
+
AU3_WinCloseByHandle: ["int", ["int"]],
|
|
202
|
+
AU3_WinExists: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
203
|
+
AU3_WinExistsByHandle: ["int", ["int"]],
|
|
204
|
+
AU3_WinGetCaretPos: ["int", ["LPPOINT"]],
|
|
205
|
+
AU3_WinGetClassList: [
|
|
206
|
+
"void",
|
|
207
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPWSTR", "int"],
|
|
208
|
+
],
|
|
209
|
+
AU3_WinGetClassListByHandle: ["void", ["int", "LPWSTR", "int"]],
|
|
210
|
+
AU3_WinGetClientSize: [
|
|
211
|
+
"int",
|
|
212
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPRECT"],
|
|
213
|
+
],
|
|
214
|
+
AU3_WinGetClientSizeByHandle: ["int", ["int", "LPRECT"]],
|
|
215
|
+
AU3_WinGetHandle: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
216
|
+
AU3_WinGetHandleAsText: [
|
|
217
|
+
"void",
|
|
218
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPWSTR", "int"],
|
|
219
|
+
],
|
|
220
|
+
AU3_WinGetPos: [
|
|
221
|
+
"int",
|
|
222
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPRECT"],
|
|
223
|
+
],
|
|
224
|
+
AU3_WinGetPosByHandle: ["int", ["int", "LPRECT"]],
|
|
225
|
+
AU3_WinGetProcess: [
|
|
226
|
+
"uint32",
|
|
227
|
+
["string16", /*[in,defaultvalue("")]*/ "string16"],
|
|
228
|
+
],
|
|
229
|
+
AU3_WinGetProcessByHandle: ["uint32", ["int"]],
|
|
230
|
+
AU3_WinGetState: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
231
|
+
AU3_WinGetStateByHandle: ["int", ["int"]],
|
|
232
|
+
AU3_WinGetText: [
|
|
233
|
+
"void",
|
|
234
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPWSTR", "int"],
|
|
235
|
+
],
|
|
236
|
+
AU3_WinGetTextByHandle: ["void", ["int", "LPWSTR", "int"]],
|
|
237
|
+
AU3_WinGetTitle: [
|
|
238
|
+
"void",
|
|
239
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "LPWSTR", "int"],
|
|
240
|
+
],
|
|
241
|
+
AU3_WinGetTitleByHandle: ["void", ["int", "LPWSTR", "int"]],
|
|
242
|
+
AU3_WinKill: ["int", ["string16", /*[in,defaultvalue("")]*/ "string16"]],
|
|
243
|
+
AU3_WinKillByHandle: ["int", ["int"]],
|
|
244
|
+
AU3_WinMenuSelectItem: [
|
|
245
|
+
"int",
|
|
246
|
+
[
|
|
247
|
+
"string16",
|
|
248
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
249
|
+
"string16",
|
|
250
|
+
"string16",
|
|
251
|
+
"string16",
|
|
252
|
+
"string16",
|
|
253
|
+
"string16",
|
|
254
|
+
"string16",
|
|
255
|
+
"string16",
|
|
256
|
+
"string16",
|
|
257
|
+
],
|
|
258
|
+
],
|
|
259
|
+
AU3_WinMenuSelectItemByHandle: [
|
|
260
|
+
"int",
|
|
261
|
+
[
|
|
262
|
+
"int",
|
|
263
|
+
"string16",
|
|
264
|
+
"string16",
|
|
265
|
+
"string16",
|
|
266
|
+
"string16",
|
|
267
|
+
"string16",
|
|
268
|
+
"string16",
|
|
269
|
+
"string16",
|
|
270
|
+
"string16",
|
|
271
|
+
],
|
|
272
|
+
],
|
|
273
|
+
AU3_WinMinimizeAll: ["void", []],
|
|
274
|
+
AU3_WinMinimizeAllUndo: ["void", []],
|
|
275
|
+
AU3_WinMove: [
|
|
276
|
+
"int",
|
|
277
|
+
[
|
|
278
|
+
"string16",
|
|
279
|
+
/*[in,defaultvalue("")]*/ "string16",
|
|
280
|
+
"int",
|
|
281
|
+
"int",
|
|
282
|
+
"int",
|
|
283
|
+
"int",
|
|
284
|
+
],
|
|
285
|
+
],
|
|
286
|
+
AU3_WinMoveByHandle: ["int", ["int", "int", "int", "int", "int"]],
|
|
287
|
+
AU3_WinSetOnTop: [
|
|
288
|
+
"int",
|
|
289
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
290
|
+
],
|
|
291
|
+
AU3_WinSetOnTopByHandle: ["int", ["int", "int"]],
|
|
292
|
+
AU3_WinSetState: [
|
|
293
|
+
"int",
|
|
294
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
295
|
+
],
|
|
296
|
+
AU3_WinSetStateByHandle: ["int", ["int", "int"]],
|
|
297
|
+
AU3_WinSetTitle: [
|
|
298
|
+
"int",
|
|
299
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "string16"],
|
|
300
|
+
],
|
|
301
|
+
AU3_WinSetTitleByHandle: ["int", ["int", "string16"]],
|
|
302
|
+
AU3_WinSetTrans: [
|
|
303
|
+
"int",
|
|
304
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
305
|
+
],
|
|
306
|
+
AU3_WinSetTransByHandle: ["int", ["int", "int"]],
|
|
307
|
+
AU3_WinWait: [
|
|
308
|
+
"int",
|
|
309
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
310
|
+
],
|
|
311
|
+
AU3_WinWaitByHandle: ["int", ["int", "int"]],
|
|
312
|
+
AU3_WinWaitActive: ["int", ["string16", "string16", "int"]],
|
|
313
|
+
AU3_WinWaitActiveByHandle: ["int", ["int", "int"]],
|
|
314
|
+
AU3_WinWaitClose: [
|
|
315
|
+
"int",
|
|
316
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
317
|
+
],
|
|
318
|
+
AU3_WinWaitCloseByHandle: ["int", ["int", "int"]],
|
|
319
|
+
AU3_WinWaitNotActive: [
|
|
320
|
+
"int",
|
|
321
|
+
["string16", /*[in,defaultvalue("")]*/ "string16", "int"],
|
|
322
|
+
],
|
|
323
|
+
AU3_WinWaitNotActiveByHandle: ["int", ["int", "int"]],
|
|
324
|
+
};
|
|
325
|
+
const AU3_INTDEFAULT = -2147483647;
|
|
326
|
+
const SW_SHOWNORMAL = 1;
|
|
327
|
+
const defaultArgs = {
|
|
328
|
+
ClipGet: { 1: 512 },
|
|
329
|
+
ControlClick: {
|
|
330
|
+
1: "",
|
|
331
|
+
3: "LEFT",
|
|
332
|
+
4: 1,
|
|
333
|
+
5: AU3_INTDEFAULT,
|
|
334
|
+
6: AU3_INTDEFAULT,
|
|
335
|
+
},
|
|
336
|
+
ControlClickByHandle: {
|
|
337
|
+
2: "LEFT",
|
|
338
|
+
3: 1,
|
|
339
|
+
4: AU3_INTDEFAULT,
|
|
340
|
+
5: AU3_INTDEFAULT,
|
|
341
|
+
},
|
|
342
|
+
ControlCommand: { 1: "", 4: "", 6: 256 },
|
|
343
|
+
ControlCommandByHandle: { 3: "", 5: 256 },
|
|
344
|
+
ControlListView: { 1: "", 4: "", 5: "", 7: 256 },
|
|
345
|
+
ControlListViewByHandle: { 3: "", 4: "", 6: 256 },
|
|
346
|
+
ControlDisable: { 1: "" },
|
|
347
|
+
ControlEnable: { 1: "" },
|
|
348
|
+
ControlFocus: { 1: "" },
|
|
349
|
+
ControlGetFocus: { 1: "", 3: 256 },
|
|
350
|
+
ControlGetFocusByHandle: { 2: 256 },
|
|
351
|
+
ControlGetHandleAsText: { 1: "", 4: 256 },
|
|
352
|
+
ControlGetPos: { 1: "" },
|
|
353
|
+
ControlGetText: { 1: "", 4: 512 },
|
|
354
|
+
ControlGetTextByHandle: { 3: 512 },
|
|
355
|
+
ControlHide: { 1: "" },
|
|
356
|
+
ControlMove: { 1: "", 5: -1, 6: -1 },
|
|
357
|
+
ControlMoveByHandle: { 4: -1, 5: -1 },
|
|
358
|
+
ControlSend: { 1: "", 4: 0 },
|
|
359
|
+
ControlSendByHandle: { 3: 0 },
|
|
360
|
+
ControlSetText: { 1: "" },
|
|
361
|
+
ControlShow: { 1: "" },
|
|
362
|
+
ControlTreeView: { 1: "", 4: "", 5: "", 7: 256 },
|
|
363
|
+
ControlTreeViewByHandle: { 3: "", 4: "", 6: 256 },
|
|
364
|
+
DriveMapAdd: { 3: "", 4: "", 6: 256 },
|
|
365
|
+
DriveMapGet: { 2: 256 },
|
|
366
|
+
MouseClick: { 0: "LEFT", 1: AU3_INTDEFAULT, 2: AU3_INTDEFAULT, 3: 1, 4: -1 },
|
|
367
|
+
MouseClickDrag: { 5: -1 },
|
|
368
|
+
MouseDown: { 0: "LEFT" },
|
|
369
|
+
MouseMove: { 2: -1 },
|
|
370
|
+
MouseUp: { 0: "LEFT" },
|
|
371
|
+
PixelChecksum: { 1: 1 },
|
|
372
|
+
PixelSearch: { 2: 0, 3: 1 },
|
|
373
|
+
ProcessWait: { 1: 0 },
|
|
374
|
+
ProcessWaitClose: { 1: 0 },
|
|
375
|
+
Run: { 1: "", 2: SW_SHOWNORMAL },
|
|
376
|
+
RunWait: { 1: "", 2: SW_SHOWNORMAL },
|
|
377
|
+
RunAs: { 5: "", 6: SW_SHOWNORMAL },
|
|
378
|
+
RunAsWait: { 5: "", 6: SW_SHOWNORMAL },
|
|
379
|
+
Send: { 1: 0 },
|
|
380
|
+
StatusbarGetText: { 1: "", 2: 1, 4: 256 },
|
|
381
|
+
StatusbarGetTextByHandle: { 1: 1, 3: 256 },
|
|
382
|
+
ToolTip: { 1: AU3_INTDEFAULT, 2: AU3_INTDEFAULT },
|
|
383
|
+
WinActivate: { 1: "" },
|
|
384
|
+
WinClose: { 1: "" },
|
|
385
|
+
WinExists: { 1: "" },
|
|
386
|
+
WinGetClassList: { 1: "", 3: 512 },
|
|
387
|
+
WinGetClassListByHandle: { 2: 512 },
|
|
388
|
+
WinGetClientSize: { 1: "" },
|
|
389
|
+
WinGetHandle: { 1: "" },
|
|
390
|
+
WinGetHandleAsText: { 1: "", 3: 256 },
|
|
391
|
+
WinGetPos: { 1: "" },
|
|
392
|
+
WinGetProcess: { 1: "" },
|
|
393
|
+
WinGetState: { 1: "" },
|
|
394
|
+
WinGetText: { 1: "", 3: 512 },
|
|
395
|
+
WinGetTextByHandle: { 2: 512 },
|
|
396
|
+
WinGetTitle: { 1: "", 3: 512 },
|
|
397
|
+
WinGetTitleByHandle: { 2: 512 },
|
|
398
|
+
WinKill: { 1: "" },
|
|
399
|
+
WinMenuSelectItem: { 1: "", 3: "", 4: "", 5: "", 6: "", 7: "", 8: "", 9: "" },
|
|
400
|
+
WinMenuSelectItemByHandle: {
|
|
401
|
+
2: "",
|
|
402
|
+
3: "",
|
|
403
|
+
4: "",
|
|
404
|
+
5: "",
|
|
405
|
+
6: "",
|
|
406
|
+
7: "",
|
|
407
|
+
8: "",
|
|
408
|
+
},
|
|
409
|
+
WinMove: { 1: "", 4: -1, 5: -1 },
|
|
410
|
+
WinMoveByHandle: { 3: -1, 4: -1 },
|
|
411
|
+
WinSetOnTop: { 1: "" },
|
|
412
|
+
WinSetState: { 1: "" },
|
|
413
|
+
WinSetTitle: { 1: "" },
|
|
414
|
+
WinSetTrans: { 1: "" },
|
|
415
|
+
WinWait: { 1: "", 2: 0 },
|
|
416
|
+
WinWaitByHandle: { 1: 0 },
|
|
417
|
+
WinWaitActive: { 1: "", 2: 0 },
|
|
418
|
+
WinWaitActiveByHandle: { 1: 0 },
|
|
419
|
+
WinWaitClose: { 1: "", 2: 0 },
|
|
420
|
+
WinWaitCloseByHandle: { 1: 0 },
|
|
421
|
+
WinWaitNotActive: { 1: "", 2: 0 },
|
|
422
|
+
WinWaitNotActiveByHandle: { 1: 0 },
|
|
423
|
+
};
|
|
424
|
+
const argToReturnValue = {
|
|
425
|
+
ClipGet: { arg: 0, type: "wstring", ex_arg: 1 },
|
|
426
|
+
ControlCommand: { arg: 5, type: "wstring", ex_arg: 6 },
|
|
427
|
+
ControlCommandByHandle: { arg: 4, type: "wstring", ex_arg: 5 },
|
|
428
|
+
ControlListView: { arg: 6, type: "wstring", ex_arg: 7 },
|
|
429
|
+
ControlListViewByHandle: { arg: 5, type: "wstring", ex_arg: 6 },
|
|
430
|
+
ControlGetFocus: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
431
|
+
ControlGetFocusByHandle: { arg: 1, type: "wstring", ex_arg: 2 },
|
|
432
|
+
ControlGetHandleAsText: { arg: 3, type: "wstring", ex_arg: 4 },
|
|
433
|
+
ControlGetPos: { arg: 3, type: "rect" },
|
|
434
|
+
ControlGetPosByHandle: { arg: 2, type: "rect" },
|
|
435
|
+
ControlGetText: { arg: 3, type: "wstring", ex_arg: 4 },
|
|
436
|
+
ControlGetTextByHandle: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
437
|
+
ControlTreeView: { arg: 6, type: "wstring", ex_arg: 7 },
|
|
438
|
+
ControlTreeViewByHandle: { arg: 5, type: "wstring", ex_arg: 6 },
|
|
439
|
+
DriveMapAdd: { arg: 5, type: "wstring", ex_arg: 6 },
|
|
440
|
+
DriveMapGet: { arg: 1, type: "wstring", ex_arg: 2 },
|
|
441
|
+
MouseGetPos: { arg: 0, type: "point" },
|
|
442
|
+
PixelSearch: { arg: 4, type: "point" },
|
|
443
|
+
StatusbarGetText: { arg: 3, type: "wstring", ex_arg: 4 },
|
|
444
|
+
StatusbarGetTextByHandle: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
445
|
+
WinGetCaretPos: { arg: 0, type: "point" },
|
|
446
|
+
WinGetClassList: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
447
|
+
WinGetClassListByHandle: { arg: 1, type: "wstring", ex_arg: 2 },
|
|
448
|
+
WinGetClientSize: { arg: 2, type: "rect" },
|
|
449
|
+
WinGetClientSizeByHandle: { arg: 1, type: "rect" },
|
|
450
|
+
WinGetHandleAsText: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
451
|
+
WinGetPos: { arg: 2, type: "rect" },
|
|
452
|
+
WinGetPosByHandle: { arg: 1, type: "rect" },
|
|
453
|
+
WinGetText: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
454
|
+
WinGetTextByHandle: { arg: 1, type: "wstring", ex_arg: 2 },
|
|
455
|
+
WinGetTitle: { arg: 2, type: "wstring", ex_arg: 3 },
|
|
456
|
+
WinGetTitleByHandle: { arg: 1, type: "wstring", ex_arg: 2 },
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
function lowercaseFirstLetter(str) {
|
|
460
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const saveContent = [
|
|
464
|
+
`const lib: any = {};\nconst fn:any = {};\nconst wchar:any = {};`,
|
|
465
|
+
];
|
|
466
|
+
|
|
467
|
+
forEach(autoitFunctions, (config, fnName) => {
|
|
468
|
+
const key = lowercaseFirstLetter(fnName.replace("AU3_", ""));
|
|
469
|
+
const defaultArgKey = fnName.replace("AU3_", "");
|
|
470
|
+
const result = JSON.stringify(config[0]);
|
|
471
|
+
const arguments = JSON.stringify(
|
|
472
|
+
config[1].map((v, i) => {
|
|
473
|
+
if (argToReturnValue.hasOwnProperty(defaultArgKey)) {
|
|
474
|
+
const toReturn = argToReturnValue[defaultArgKey];
|
|
475
|
+
if (i === toReturn.arg) {
|
|
476
|
+
if (toReturn.type !== "wstring") {
|
|
477
|
+
v = `_Out_ ${v}*`;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return v;
|
|
482
|
+
}),
|
|
483
|
+
);
|
|
484
|
+
const fn = `lib.func("${fnName}", ${result}, ${arguments})`.replace(
|
|
485
|
+
/\n/g,
|
|
486
|
+
"",
|
|
487
|
+
);
|
|
488
|
+
const argTypes = {
|
|
489
|
+
string16: "string",
|
|
490
|
+
int: "number",
|
|
491
|
+
void: "void",
|
|
492
|
+
uint: "number",
|
|
493
|
+
uint32: "number",
|
|
494
|
+
};
|
|
495
|
+
// result
|
|
496
|
+
if (!argTypes.hasOwnProperty(config[0])) {
|
|
497
|
+
throw { message: `type '${config[0]}' not found` };
|
|
498
|
+
}
|
|
499
|
+
let resultType = argTypes[config[0]];
|
|
500
|
+
let resultHandleCode = "";
|
|
501
|
+
let resultHandleType = "";
|
|
502
|
+
const passArgs = [];
|
|
503
|
+
// generate arguments
|
|
504
|
+
const gen_arguments = config[1]
|
|
505
|
+
.map((argType, i) => {
|
|
506
|
+
if (argToReturnValue.hasOwnProperty(defaultArgKey)) {
|
|
507
|
+
const toReturn = argToReturnValue[defaultArgKey];
|
|
508
|
+
if (i === toReturn.arg) {
|
|
509
|
+
if (toReturn.type === "wstring") {
|
|
510
|
+
resultType = "string";
|
|
511
|
+
resultHandleCode = `let result = Buffer.alloc(arg${toReturn.ex_arg} * wchar.size);`;
|
|
512
|
+
resultHandleType = "string";
|
|
513
|
+
passArgs.push(`result`);
|
|
514
|
+
} else {
|
|
515
|
+
resultType = toReturn.type === "point" ? "Point" : "Rect";
|
|
516
|
+
resultHandleCode = `let result: any = {}`;
|
|
517
|
+
resultHandleType = "struct";
|
|
518
|
+
passArgs.push(`result`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (["LPWSTR", "LPRECT", "LPPOINT"].includes(argType)) return;
|
|
524
|
+
if (!argTypes.hasOwnProperty(argType)) {
|
|
525
|
+
throw { message: `type '${argType}' not found` };
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
let defaultValue = "";
|
|
529
|
+
|
|
530
|
+
if (defaultArgs.hasOwnProperty(defaultArgKey)) {
|
|
531
|
+
if (defaultArgs[defaultArgKey].hasOwnProperty(i)) {
|
|
532
|
+
let val = defaultArgs[defaultArgKey][i];
|
|
533
|
+
if (typeof val === "string") {
|
|
534
|
+
val = JSON.stringify(val);
|
|
535
|
+
}
|
|
536
|
+
defaultValue = ` = ${val}`;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
passArgs.push(`arg${i}`);
|
|
541
|
+
|
|
542
|
+
return `arg${i}: ${argTypes[argType]}${defaultValue}`;
|
|
543
|
+
})
|
|
544
|
+
.filter((v) => !!v);
|
|
545
|
+
|
|
546
|
+
const getResolve = () => {
|
|
547
|
+
if (resultHandleCode) {
|
|
548
|
+
if (resultHandleType === "string") {
|
|
549
|
+
return "else resolve(getWString(result));";
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return "else resolve(result);";
|
|
553
|
+
}
|
|
554
|
+
return "else resolve(res);";
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const generated = `
|
|
558
|
+
export const ${key} = (${gen_arguments.join(", ")}): Promise<${resultType}> => {
|
|
559
|
+
if (!fn.hasOwnProperty("${key}")) {
|
|
560
|
+
fn["${key}"] = ${fn};
|
|
561
|
+
}
|
|
562
|
+
${resultHandleCode}
|
|
563
|
+
|
|
564
|
+
return new Promise((resolve, reject) => {
|
|
565
|
+
fn["${key}"].async(${passArgs.length ? passArgs.join(", ") + ", " : ""}(err: Error, ${resultHandleCode ? "_" : "res"}: any) => {
|
|
566
|
+
if (err) reject(err);
|
|
567
|
+
${getResolve()}
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
`.trim();
|
|
572
|
+
|
|
573
|
+
console.log(generated);
|
|
574
|
+
console.log("");
|
|
575
|
+
saveContent.push(generated);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
fs.writeFileSync("gen.ts", saveContent.join("\n\n"));
|