@@ -37,13 +37,16 @@ interface TextStreamBase {
37
37
* The column number of the current character position in an input stream.
38
38
*/
39
39
Column : number ;
40
+
40
41
/**
41
42
* The current line number in an input stream.
42
43
*/
43
44
Line : number ;
45
+
44
46
/**
45
47
* Closes a text stream.
46
- * It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
48
+ * It is not necessary to close standard streams; they close automatically when the process ends. If
49
+ * you close a standard stream, be aware that any other pointers to that standard stream become invalid.
47
50
*/
48
51
Close ( ) : void ;
49
52
}
@@ -53,10 +56,12 @@ interface TextStreamWriter extends TextStreamBase {
53
56
* Sends a string to an output stream.
54
57
*/
55
58
Write ( s : string ) : void ;
59
+
56
60
/**
57
61
* Sends a specified number of blank lines (newline characters) to an output stream.
58
62
*/
59
63
WriteBlankLines ( intLines : number ) : void ;
64
+
60
65
/**
61
66
* Sends a string followed by a newline character to an output stream.
62
67
*/
@@ -65,37 +70,43 @@ interface TextStreamWriter extends TextStreamBase {
65
70
66
71
interface TextStreamReader extends TextStreamBase {
67
72
/**
68
- * Returns a specified number of characters from an input stream, beginning at the current pointer position.
73
+ * Returns a specified number of characters from an input stream, starting at the current pointer position.
69
74
* Does not return until the ENTER key is pressed.
70
75
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
71
76
*/
72
77
Read ( characters : number ) : string ;
78
+
73
79
/**
74
80
* Returns all characters from an input stream.
75
81
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
76
82
*/
77
83
ReadAll ( ) : string ;
84
+
78
85
/**
79
86
* Returns an entire line from an input stream.
80
87
* Although this method extracts the newline character, it does not add it to the returned string.
81
88
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
82
89
*/
83
90
ReadLine ( ) : string ;
91
+
84
92
/**
85
93
* Skips a specified number of characters when reading from an input text stream.
86
94
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
87
95
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
88
96
*/
89
97
Skip ( characters : number ) : void ;
98
+
90
99
/**
91
100
* Skips the next line when reading from an input text stream.
92
101
* Can only be used on a stream in reading mode, not writing or appending mode.
93
102
*/
94
103
SkipLine ( ) : void ;
104
+
95
105
/**
96
106
* Indicates whether the stream pointer position is at the end of a line.
97
107
*/
98
108
AtEndOfLine : boolean ;
109
+
99
110
/**
100
111
* Indicates whether the stream pointer position is at the end of a stream.
101
112
*/
@@ -104,85 +115,180 @@ interface TextStreamReader extends TextStreamBase {
104
115
105
116
declare var WScript : {
106
117
/**
107
- * Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
118
+ * Outputs text to either a message box (under WScript.exe) or the command console window followed by
119
+ * a newline (under CScript.exe).
108
120
*/
109
121
Echo ( s : any ) : void ;
122
+
110
123
/**
111
124
* Exposes the write-only error output stream for the current script.
112
125
* Can be accessed only while using CScript.exe.
113
126
*/
114
127
StdErr : TextStreamWriter ;
128
+
115
129
/**
116
130
* Exposes the write-only output stream for the current script.
117
131
* Can be accessed only while using CScript.exe.
118
132
*/
119
133
StdOut : TextStreamWriter ;
120
134
Arguments : { length : number ; Item ( n : number ) : string ; } ;
135
+
121
136
/**
122
137
* The full path of the currently running script.
123
138
*/
124
139
ScriptFullName : string ;
140
+
125
141
/**
126
142
* Forces the script to stop immediately, with an optional exit code.
127
143
*/
128
144
Quit ( exitCode ?: number ) : number ;
145
+
129
146
/**
130
147
* The Windows Script Host build version number.
131
148
*/
132
149
BuildVersion : number ;
150
+
133
151
/**
134
152
* Fully qualified path of the host executable.
135
153
*/
136
154
FullName : string ;
155
+
137
156
/**
138
157
* Gets/sets the script mode - interactive(true) or batch(false).
139
158
*/
140
159
Interactive : boolean ;
160
+
141
161
/**
142
162
* The name of the host executable (WScript.exe or CScript.exe).
143
163
*/
144
164
Name : string ;
165
+
145
166
/**
146
167
* Path of the directory containing the host executable.
147
168
*/
148
169
Path : string ;
170
+
149
171
/**
150
172
* The filename of the currently running script.
151
173
*/
152
174
ScriptName : string ;
175
+
153
176
/**
154
177
* Exposes the read-only input stream for the current script.
155
178
* Can be accessed only while using CScript.exe.
156
179
*/
157
180
StdIn : TextStreamReader ;
181
+
158
182
/**
159
183
* Windows Script Host version
160
184
*/
161
185
Version : string ;
186
+
162
187
/**
163
188
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
164
189
*/
165
190
ConnectObject ( objEventSource : any , strPrefix : string ) : void ;
191
+
166
192
/**
167
193
* Creates a COM object.
168
194
* @param strProgiID
169
195
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
170
196
*/
171
197
CreateObject ( strProgID : string , strPrefix ?: string ) : any ;
198
+
172
199
/**
173
200
* Disconnects a COM object from its event sources.
174
201
*/
175
202
DisconnectObject ( obj : any ) : void ;
203
+
176
204
/**
177
205
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
178
- * @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
206
+ * @param strPathname Fully qualified path to the file containing the object persisted to disk.
207
+ * For objects in memory, pass a zero-length string.
179
208
* @param strProgID
180
209
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
181
210
*/
182
211
GetObject ( strPathname : string , strProgID ?: string , strPrefix ?: string ) : any ;
212
+
183
213
/**
184
214
* Suspends script execution for a specified length of time, then continues execution.
185
215
* @param intTime Interval (in milliseconds) to suspend script execution.
186
216
*/
187
217
Sleep ( intTime : number ) : void ;
188
218
} ;
219
+
220
+ /**
221
+ * Allows enumerating over a COM collection, which may not have indexed item access.
222
+ */
223
+ interface Enumerator < T > {
224
+ /**
225
+ * Returns true if the current item is the last one in the collection, or the collection is empty,
226
+ * or the current item is undefined.
227
+ */
228
+ atEnd ( ) : boolean ;
229
+
230
+ /**
231
+ * Returns the current item in the collection
232
+ */
233
+ item ( ) : T ;
234
+
235
+ /**
236
+ * Resets the current item in the collection to the first item. If there are no items in the collection,
237
+ * the current item is set to undefined.
238
+ */
239
+ moveFirst ( ) : void ;
240
+
241
+ /**
242
+ * Moves the current item to the next item in the collection. If the enumerator is at the end of
243
+ * the collection or the collection is empty, the current item is set to undefined.
244
+ */
245
+ moveNext ( ) : void ;
246
+ }
247
+
248
+ interface EnumeratorConstructor {
249
+ new < T > ( collection : any ) : Enumerator < T > ;
250
+ new ( collection : any ) : Enumerator < any > ;
251
+ }
252
+
253
+ declare var Enumerator : EnumeratorConstructor ;
254
+
255
+ /**
256
+ * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
257
+ */
258
+ interface VBArray < T > {
259
+ /**
260
+ * Returns the number of dimensions (1-based).
261
+ */
262
+ dimensions ( ) : number ;
263
+
264
+ /**
265
+ * Takes an index for each dimension in the array, and returns the item at the corresponding location.
266
+ */
267
+ getItem ( dimension1Index : number , ...dimensionNIndexes : number [ ] ) : T ;
268
+
269
+ /**
270
+ * Returns the smallest available index for a given dimension.
271
+ * @param dimension 1-based dimension (defaults to 1)
272
+ */
273
+ lbound ( dimension ?: number ) : number ;
274
+
275
+ /**
276
+ * Returns the largest available index for a given dimension.
277
+ * @param dimension 1-based dimension (defaults to 1)
278
+ */
279
+ ubound ( dimension ?: number ) : number ;
280
+
281
+ /**
282
+ * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
283
+ * each successive dimension is appended to the end of the array.
284
+ * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
285
+ */
286
+ toArray ( ) : T [ ] ;
287
+ }
288
+
289
+ interface VBArrayConstructor {
290
+ new < T > ( safeArray : any ) : VBArray < T > ;
291
+ new ( safeArray : any ) : VBArray < any > ;
292
+ }
293
+
294
+ declare var VBArray : VBArrayConstructor ;
0 commit comments