-
Notifications
You must be signed in to change notification settings - Fork 21
/
Application.d.ts
223 lines (182 loc) · 7.16 KB
/
Application.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import { StandardAdditions } from "./core/StandardAdditions";
import { TextEdit } from "./core/TextEdit";
import { VoiceOver } from "./core/VoiceOver";
import { Terminal } from "./core/Terminal";
import { SystemEvents } from "./core/SystemEvents";
import { SpeechRecognitionServer } from "./core/SpeechRecognitionServer";
import { ScriptEditor } from "./core/ScriptEditor";
import { Calendar } from "./core/Calendar";
import { Contacts } from "./core/Contacts";
import { DatabaseEvents } from "./core/DatabaseEvents";
import { Finder } from "./core/Finder";
import { FontBook } from "./core/FontBook";
import { ImageEvents } from "./core/ImageEvents";
import { Keynote } from "./core/Keynote";
import { Mail } from "./core/Mail";
import { Messages } from "./core/Messages";
import { Notes } from "./core/Notes";
import { Numbers } from "./core/Numbers";
import { Pages } from "./core/Pages";
import { Photos } from "./core/Photos";
import { QuickTimePlayer } from "./core/QuickTimePlayer";
import { Reminders } from "./core/Reminders";
import { Safari } from "./core/Safari";
import { DVDPlayer } from "./core/DVDPlayer";
import { iTunes } from "./core/iTunes";
export = Application;
export as namespace Application;
type App = typeof Application & Application._StandardAdditions & Application.AnyValue;
/**
* bundle ID or name or path or remote machine
*/
declare function Application(name: string): typeof Application & Application._StandardAdditions & Application.AnyValue;
declare function Application(name: "Calendar"): App & Application._Calendar;
declare function Application(name: "Contacts"): App & Application._Contacts;
declare function Application(name: "Database Events"): App & Application._DatabaseEvents;
declare function Application(name: "DVD Player"): App & Application._DVDPlayer;
declare function Application(name: "Finder"): App & Application._Finder;
declare function Application(name: "Font Book"): App & Application._FontBook;
declare function Application(name: "Image Events"): App & Application._ImageEvents;
declare function Application(name: "iTunes"): App & Application._iTunes;
declare function Application(name: "Keynote"): App & Application._Keynote;
declare function Application(name: "Mail"): App & Application._Mail;
declare function Application(name: "Messages"): App & Application._Messages;
declare function Application(name: "Notes"): App & Application._Notes;
declare function Application(name: "Numbers"): App & Application._Numbers;
declare function Application(name: "Pages"): App & Application._Pages;
declare function Application(name: "Photos"): App & Application._Photos;
declare function Application(name: "QuickTime Player"): App & Application._QuickTimePlayer;
declare function Application(name: "Reminders"): App & Application._Reminders;
declare function Application(name: "Safari"): App & Application._Safari;
declare function Application(name: "Script Editor"): App & Application._ScriptEditor;
declare function Application(name: "SpeechRecognitionServer"): App & Application._SpeechRecognitionServer;
declare function Application(name: "System Events"): App & Application._SystemEvents;
declare function Application(name: "Terminal"): App & Application._Terminal;
declare function Application(name: "TextEdit"): App & Application._TextEdit;
declare function Application(name: "VoiceOver"): App & Application._VoiceOver;
/**
* process ID
*/
declare function Application(id: number): typeof Application & Application._StandardAdditions & Application.AnyValue;
declare namespace Application {
// FIXME: very hack to avoid the Error
// Error:(10, 5) TS4023: Exported variable 'TextEdit' has or is using name 'TextEdit' from external module "...TextEdit" but cannot be named.
export interface _StandardAdditions extends StandardAdditions {
}
export interface _Calendar extends Calendar {
}
export interface _Contacts extends Contacts {
}
export interface _DatabaseEvents extends DatabaseEvents {
}
export interface _DVDPlayer extends DVDPlayer {
}
export interface _Finder extends Finder {
}
export interface _FontBook extends FontBook {
}
export interface _ImageEvents extends ImageEvents {
}
export interface _iTunes extends iTunes {
}
export interface _Keynote extends Keynote {
}
export interface _Mail extends Mail {
}
export interface _Messages extends Messages {
}
export interface _Notes extends Notes {
}
export interface _Numbers extends Numbers {
}
export interface _Pages extends Pages {
}
export interface _Photos extends Photos {
}
export interface _QuickTimePlayer extends QuickTimePlayer {
}
export interface _Reminders extends Reminders {
}
export interface _Safari extends Safari {
}
export interface _TextEdit extends TextEdit {
}
export interface _ScriptEditor extends ScriptEditor {
}
export interface _SpeechRecognitionServer extends SpeechRecognitionServer {
}
export interface _SystemEvents extends SystemEvents {
}
export interface _Terminal extends Terminal {
}
export interface _VoiceOver extends VoiceOver {
}
// Any Value
export interface AnyValue {
[index: string]: any;
[index: number]: any;
}
/**
* Return current app
*/
export function currentApplication<T = any>(): typeof Application &
Application._StandardAdditions & Application.AnyValue
/**
* It should be true if you use StandardAdditions
*/
export var includeStandardAdditions: boolean;
// Add OS X 10.11
// https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-11.html#//apple_ref/doc/uid/TP40014508-CH110-SW1
export function id(): number;
export function name(): string;
/**
* Return true if the app is running
* @returns {boolean}
*/
export function running(): boolean;
/**
* active the app
*/
export function activate(): void;
/**
* quit the app
*/
export function quit(): void;
/**
* launch the app
*/
export function launch(): void;
// https://qiita.com/zakuroishikuro/items/a7def965f49a2ab55be4
/**
* get command names
*/
export function commandsOfClass(): string[];
/**
* get element names
*/
export function elementsOfClass(className: string): string[];
/**
* get property names
*/
export function propertiesOfClass(className: string): string[];
/**
* get parent object name
* @param {string} className
* @returns {string}
*/
export function parentOfClass(className: string): string;
export var windows: any;
// https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-10.html#//apple_ref/doc/uid/TP40014508-CH109-SW1
// TODO :should be define ApplicationWindow
// export interface ApplicationWindows {
// [index: number]: any;
//
// [index: string]: any;
//
// at(index: number): any;
//
// byName(name: string): any;
//
// byId(id: number): any;
// }
}