Skip to content

Commit b2dbaec

Browse files
committed
Add types
1 parent 474d7ac commit b2dbaec

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

index.d.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
export const enum WindowSetState {
2+
Hide = 0,
3+
Show = 5,
4+
Minimize = 6,
5+
Maximize = 3,
6+
Restore = 9,
7+
Enable = 64,
8+
Disable = 65,
9+
}
10+
11+
export const enum WindowGetState {
12+
Failure = 0,
13+
Exists = 1,
14+
Visible = 2,
15+
Enabled = 4,
16+
Active = 8,
17+
Minimized = 16,
18+
Maximized = 32,
19+
}
20+
21+
export interface RectAnchors {
22+
left: number
23+
top: number
24+
right: number
25+
bottom: number
26+
}
27+
28+
export interface RectSize {
29+
width: number
30+
height: number
31+
}
32+
33+
export interface RectPosition extends RectSize {
34+
x: number
35+
y: number
36+
}
37+
38+
export interface Functions {
39+
ClipGet: () => Promise<string>
40+
ClipPut: (value: string) => Promise<void>
41+
Send: (keys: string, flag: 0 | 1) => void
42+
WinExists: (title: string, text: string | null) => number
43+
WinGetClassList: (title: string, text: string | null, timeout: number) => string
44+
WinGetPos: (title: string, text: string | null) => RectAnchors
45+
WinGetTitle: (title: string, text: string | null, magic: 512) => string
46+
WinGetClientSize: (title: string, text: string | null) => RectAnchors
47+
WinMenuSelectItem: (
48+
title: string,
49+
text: string | null,
50+
item0: string,
51+
item1: string,
52+
item2: string,
53+
item3: string,
54+
item4: string,
55+
item5: string,
56+
item6: string,
57+
item7: string,
58+
) => number
59+
WinActivate: (title: string, text: string | null) => number
60+
WinActive: (title: string, text: string | null) => number
61+
WinWaitActive: (title: string, text: string | null, timeout: number) => number
62+
WinWaitNotActive: (title: string, text: string | null, timeout: number) => number
63+
WinWaitClose: (title: string, text: string | null, timeout: number) => number
64+
WinSetState: (title: string, text: string | null, flag: WindowSetState) => number
65+
[name: string]: any
66+
}
67+
68+
const functions: Functions
69+
70+
export default functions

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var au = require('./index');
22

3-
au.Init();
3+
// au.Init();
44
au.Run("notepad.exe");
55
au.WinWait("[Class:Notepad2]");
66
au.Send("Hello, autoit & nodejs!");

0 commit comments

Comments
 (0)