Skip to content

Commit 843adf7

Browse files
committed
Merge pull request #3 from zspitz/WScriptFullAPI
JSDoc for WScript members
2 parents 71a5868 + 41547dc commit 843adf7

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

src/lib/scriptHost.d.ts

+111
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,156 @@ interface ActiveXObject {
1111
declare var ActiveXObject: ActiveXObject;
1212

1313
interface ITextStreamBase {
14+
/**
15+
* The column number of the current character position in an input stream.
16+
*/
1417
Column: number;
18+
/**
19+
* The current line number in an input stream.
20+
*/
1521
Line: number;
22+
/**
23+
* Closes a text stream.
24+
* 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.
25+
*/
1626
Close(): void;
1727
}
1828

1929
interface ITextWriter extends ITextStreamBase {
30+
/**
31+
* Sends a string to an output stream.
32+
*/
2033
Write(s: string): void;
34+
/**
35+
* Sends a specified number of blank lines (newline characters) to an output stream.
36+
*/
2137
WriteBlankLines(intLines: number): void;
38+
/**
39+
* Sends a string followed by a newline character to an output stream.
40+
*/
2241
WriteLine(s: string): void;
2342
}
2443

2544
interface ITextReader extends ITextStreamBase {
45+
/**
46+
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
47+
* Does not return until the ENTER key is pressed.
48+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
49+
*/
2650
Read(characters: number): string;
51+
/**
52+
* Returns all characters from an input stream.
53+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
54+
*/
2755
ReadAll(): string;
56+
/**
57+
* Returns an entire line from an input stream.
58+
* Although this method extracts the newline character, it does not add it to the returned string.
59+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
60+
*/
2861
ReadLine(): string;
62+
/**
63+
* Skips a specified number of characters when reading from an input text stream.
64+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
65+
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
66+
*/
2967
Skip(characters: number): void;
68+
/**
69+
* Skips the next line when reading from an input text stream.
70+
* Can only be used on a stream in reading mode, not writing or appending mode.
71+
*/
3072
SkipLine(): void;
73+
/**
74+
* Indicates whether the stream pointer position is at the end of a line.
75+
*/
3176
AtEndOfLine: boolean;
77+
/**
78+
* Indicates whether the stream pointer position is at the end of a stream.
79+
*/
3280
AtEndOfStream: boolean;
3381
}
3482

3583
declare var WScript: {
84+
/**
85+
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
86+
*/
3687
Echo(s: any): void;
88+
/**
89+
* Exposes the write-only error output stream for the current script.
90+
* Can be accessed only while using CScript.exe.
91+
*/
3792
StdErr: ITextWriter;
93+
/**
94+
* Exposes the write-only output stream for the current script.
95+
* Can be accessed only while using CScript.exe.
96+
*/
3897
StdOut: ITextWriter;
3998
Arguments: { length: number; Item(n: number): string; };
99+
/**
100+
* The full path of the currently running script.
101+
*/
40102
ScriptFullName: string;
103+
/**
104+
* Forces the script to stop immediately, with an optional exit code.
105+
*/
41106
Quit(exitCode?: number): number;
107+
/**
108+
* The Windows Script Host build version number.
109+
*/
42110
BuildVersion: number;
111+
/**
112+
* Fully qualified path of the host executable.
113+
*/
43114
FullName: string;
115+
/**
116+
* Gets/sets the script mode - interactive(true) or batch(false).
117+
*/
44118
Interactive: boolean;
119+
/**
120+
* The name of the host executable (WScript.exe or CScript.exe).
121+
*/
45122
Name: string;
123+
/**
124+
* Path of the directory containing the host executable.
125+
*/
46126
Path: string;
127+
/**
128+
* The filename of the currently running script.
129+
*/
47130
ScriptName: string;
131+
/**
132+
* Exposes the read-only input stream for the current script.
133+
* Can be accessed only while using CScript.exe.
134+
*/
48135
StdIn: ITextReader;
136+
/**
137+
* Windows Script Host version
138+
*/
49139
Version: string;
140+
/**
141+
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
142+
*/
50143
ConnectObject(objEventSource: any, strPrefix: string): void;
144+
/**
145+
* Creates a COM object.
146+
* @param strProgiID
147+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
148+
*/
51149
CreateObject(strProgID: string, strPrefix?: string): any;
150+
/**
151+
* Disconnects a COM object from its event sources.
152+
*/
52153
DisconnectObject(obj: any): void;
154+
/**
155+
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
156+
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
157+
* @param strProgID
158+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
159+
*/
53160
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
161+
/**
162+
* Suspends script execution for a specified length of time, then continues execution.
163+
* @param intTime Interval (in milliseconds) to suspend script execution.
164+
*/
54165
Sleep(intTime: number): void;
55166
}

0 commit comments

Comments
 (0)