@@ -37,13 +37,16 @@ interface TextStreamBase {
3737 * The column number of the current character position in an input stream.
3838 */
3939 Column : number ;
40+
4041 /**
4142 * The current line number in an input stream.
4243 */
4344 Line : number ;
45+
4446 /**
4547 * 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.
4750 */
4851 Close ( ) : void ;
4952}
@@ -53,10 +56,12 @@ interface TextStreamWriter extends TextStreamBase {
5356 * Sends a string to an output stream.
5457 */
5558 Write ( s : string ) : void ;
59+
5660 /**
5761 * Sends a specified number of blank lines (newline characters) to an output stream.
5862 */
5963 WriteBlankLines ( intLines : number ) : void ;
64+
6065 /**
6166 * Sends a string followed by a newline character to an output stream.
6267 */
@@ -65,37 +70,43 @@ interface TextStreamWriter extends TextStreamBase {
6570
6671interface TextStreamReader extends TextStreamBase {
6772 /**
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.
6974 * Does not return until the ENTER key is pressed.
7075 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
7176 */
7277 Read ( characters : number ) : string ;
78+
7379 /**
7480 * Returns all characters from an input stream.
7581 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
7682 */
7783 ReadAll ( ) : string ;
84+
7885 /**
7986 * Returns an entire line from an input stream.
8087 * Although this method extracts the newline character, it does not add it to the returned string.
8188 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
8289 */
8390 ReadLine ( ) : string ;
91+
8492 /**
8593 * Skips a specified number of characters when reading from an input text stream.
8694 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
8795 * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
8896 */
8997 Skip ( characters : number ) : void ;
98+
9099 /**
91100 * Skips the next line when reading from an input text stream.
92101 * Can only be used on a stream in reading mode, not writing or appending mode.
93102 */
94103 SkipLine ( ) : void ;
104+
95105 /**
96106 * Indicates whether the stream pointer position is at the end of a line.
97107 */
98108 AtEndOfLine : boolean ;
109+
99110 /**
100111 * Indicates whether the stream pointer position is at the end of a stream.
101112 */
@@ -104,85 +115,180 @@ interface TextStreamReader extends TextStreamBase {
104115
105116declare var WScript : {
106117 /**
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).
108120 */
109121 Echo ( s : any ) : void ;
122+
110123 /**
111124 * Exposes the write-only error output stream for the current script.
112125 * Can be accessed only while using CScript.exe.
113126 */
114127 StdErr : TextStreamWriter ;
128+
115129 /**
116130 * Exposes the write-only output stream for the current script.
117131 * Can be accessed only while using CScript.exe.
118132 */
119133 StdOut : TextStreamWriter ;
120134 Arguments : { length : number ; Item ( n : number ) : string ; } ;
135+
121136 /**
122137 * The full path of the currently running script.
123138 */
124139 ScriptFullName : string ;
140+
125141 /**
126142 * Forces the script to stop immediately, with an optional exit code.
127143 */
128144 Quit ( exitCode ?: number ) : number ;
145+
129146 /**
130147 * The Windows Script Host build version number.
131148 */
132149 BuildVersion : number ;
150+
133151 /**
134152 * Fully qualified path of the host executable.
135153 */
136154 FullName : string ;
155+
137156 /**
138157 * Gets/sets the script mode - interactive(true) or batch(false).
139158 */
140159 Interactive : boolean ;
160+
141161 /**
142162 * The name of the host executable (WScript.exe or CScript.exe).
143163 */
144164 Name : string ;
165+
145166 /**
146167 * Path of the directory containing the host executable.
147168 */
148169 Path : string ;
170+
149171 /**
150172 * The filename of the currently running script.
151173 */
152174 ScriptName : string ;
175+
153176 /**
154177 * Exposes the read-only input stream for the current script.
155178 * Can be accessed only while using CScript.exe.
156179 */
157180 StdIn : TextStreamReader ;
181+
158182 /**
159183 * Windows Script Host version
160184 */
161185 Version : string ;
186+
162187 /**
163188 * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
164189 */
165190 ConnectObject ( objEventSource : any , strPrefix : string ) : void ;
191+
166192 /**
167193 * Creates a COM object.
168194 * @param strProgiID
169195 * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
170196 */
171197 CreateObject ( strProgID : string , strPrefix ?: string ) : any ;
198+
172199 /**
173200 * Disconnects a COM object from its event sources.
174201 */
175202 DisconnectObject ( obj : any ) : void ;
203+
176204 /**
177205 * 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.
179208 * @param strProgID
180209 * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
181210 */
182211 GetObject ( strPathname : string , strProgID ?: string , strPrefix ?: string ) : any ;
212+
183213 /**
184214 * Suspends script execution for a specified length of time, then continues execution.
185215 * @param intTime Interval (in milliseconds) to suspend script execution.
186216 */
187217 Sleep ( intTime : number ) : void ;
188218} ;
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