Skip to content

Commit ed381fe

Browse files
committed
Merge pull request #2560 from zspitz/master
JSDoc for WScript members
2 parents e13dc1d + a7dad34 commit ed381fe

File tree

1 file changed

+149
-3
lines changed

1 file changed

+149
-3
lines changed

src/lib/scriptHost.d.ts

Lines changed: 149 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,157 @@ interface ITextWriter {
1616
Close(): void;
1717
}
1818

19+
interface TextStreamBase {
20+
/**
21+
* The column number of the current character position in an input stream.
22+
*/
23+
Column: number;
24+
/**
25+
* The current line number in an input stream.
26+
*/
27+
Line: number;
28+
/**
29+
* Closes a text stream.
30+
* 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.
31+
*/
32+
Close(): void;
33+
}
34+
35+
interface TextStreamWriter extends TextStreamBase {
36+
/**
37+
* Sends a string to an output stream.
38+
*/
39+
Write(s: string): void;
40+
/**
41+
* Sends a specified number of blank lines (newline characters) to an output stream.
42+
*/
43+
WriteBlankLines(intLines: number): void;
44+
/**
45+
* Sends a string followed by a newline character to an output stream.
46+
*/
47+
WriteLine(s: string): void;
48+
}
49+
50+
interface TextStreamReader extends TextStreamBase {
51+
/**
52+
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
53+
* Does not return until the ENTER key is pressed.
54+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
55+
*/
56+
Read(characters: number): string;
57+
/**
58+
* Returns all characters from an input stream.
59+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
60+
*/
61+
ReadAll(): string;
62+
/**
63+
* Returns an entire line from an input stream.
64+
* Although this method extracts the newline character, it does not add it to the returned string.
65+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
66+
*/
67+
ReadLine(): string;
68+
/**
69+
* Skips a specified number of characters when reading from an input text stream.
70+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
71+
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
72+
*/
73+
Skip(characters: number): void;
74+
/**
75+
* Skips the next line when reading from an input text stream.
76+
* Can only be used on a stream in reading mode, not writing or appending mode.
77+
*/
78+
SkipLine(): void;
79+
/**
80+
* Indicates whether the stream pointer position is at the end of a line.
81+
*/
82+
AtEndOfLine: boolean;
83+
/**
84+
* Indicates whether the stream pointer position is at the end of a stream.
85+
*/
86+
AtEndOfStream: boolean;
87+
}
88+
1989
declare var WScript: {
90+
/**
91+
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
92+
*/
2093
Echo(s: any): void;
21-
StdErr: ITextWriter;
22-
StdOut: ITextWriter;
94+
/**
95+
* Exposes the write-only error output stream for the current script.
96+
* Can be accessed only while using CScript.exe.
97+
*/
98+
StdErr: TextStreamWriter;
99+
/**
100+
* Exposes the write-only output stream for the current script.
101+
* Can be accessed only while using CScript.exe.
102+
*/
103+
StdOut: TextStreamWriter;
23104
Arguments: { length: number; Item(n: number): string; };
105+
/**
106+
* The full path of the currently running script.
107+
*/
24108
ScriptFullName: string;
109+
/**
110+
* Forces the script to stop immediately, with an optional exit code.
111+
*/
25112
Quit(exitCode?: number): number;
26-
}
113+
/**
114+
* The Windows Script Host build version number.
115+
*/
116+
BuildVersion: number;
117+
/**
118+
* Fully qualified path of the host executable.
119+
*/
120+
FullName: string;
121+
/**
122+
* Gets/sets the script mode - interactive(true) or batch(false).
123+
*/
124+
Interactive: boolean;
125+
/**
126+
* The name of the host executable (WScript.exe or CScript.exe).
127+
*/
128+
Name: string;
129+
/**
130+
* Path of the directory containing the host executable.
131+
*/
132+
Path: string;
133+
/**
134+
* The filename of the currently running script.
135+
*/
136+
ScriptName: string;
137+
/**
138+
* Exposes the read-only input stream for the current script.
139+
* Can be accessed only while using CScript.exe.
140+
*/
141+
StdIn: TextStreamReader;
142+
/**
143+
* Windows Script Host version
144+
*/
145+
Version: string;
146+
/**
147+
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
148+
*/
149+
ConnectObject(objEventSource: any, strPrefix: string): void;
150+
/**
151+
* Creates a COM object.
152+
* @param strProgiID
153+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
154+
*/
155+
CreateObject(strProgID: string, strPrefix?: string): any;
156+
/**
157+
* Disconnects a COM object from its event sources.
158+
*/
159+
DisconnectObject(obj: any): void;
160+
/**
161+
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
162+
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
163+
* @param strProgID
164+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
165+
*/
166+
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
167+
/**
168+
* Suspends script execution for a specified length of time, then continues execution.
169+
* @param intTime Interval (in milliseconds) to suspend script execution.
170+
*/
171+
Sleep(intTime: number): void;
172+
};

0 commit comments

Comments
 (0)