Pinsave/counterstrike
1
1/*! *****************************************************************************2Copyright (c) Microsoft Corporation. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License"); you may not use4this file except in compliance with the License. You may obtain a copy of the5License at http://www.apache.org/licenses/LICENSE-2.06 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,10MERCHANTABLITY OR NON-INFRINGEMENT.11 12See the Apache Version 2.0 License for specific language governing permissions13and limitations under the License.14***************************************************************************** */15 16 17/// <reference no-default-lib="true"/>18 19/////////////////////////////20/// Windows Script Host APIS21/////////////////////////////22 23interface ActiveXObject {24 new (s: string): any;25}26declare var ActiveXObject: ActiveXObject;27 28interface ITextWriter {29 Write(s: string): void;30 WriteLine(s: string): void;31 Close(): void;32}33 34interface TextStreamBase {35 /**36 * The column number of the current character position in an input stream.37 */38 Column: number;39 40 /**41 * The current line number in an input stream.42 */43 Line: number;44 45 /**46 * Closes a text stream.47 * It is not necessary to close standard streams; they close automatically when the process ends. If48 * you close a standard stream, be aware that any other pointers to that standard stream become invalid.49 */50 Close(): void;51}52 53interface TextStreamWriter extends TextStreamBase {54 /**55 * Sends a string to an output stream.56 */57 Write(s: string): void;58 59 /**60 * Sends a specified number of blank lines (newline characters) to an output stream.61 */62 WriteBlankLines(intLines: number): void;63 64 /**65 * Sends a string followed by a newline character to an output stream.66 */67 WriteLine(s: string): void;68}69 70interface TextStreamReader extends TextStreamBase {71 /**72 * Returns a specified number of characters from an input stream, starting at the current pointer position.73 * Does not return until the ENTER key is pressed.74 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.75 */76 Read(characters: number): string;77 78 /**79 * Returns all characters from an input stream.80 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.81 */82 ReadAll(): string;83 84 /**85 * Returns an entire line from an input stream.86 * Although this method extracts the newline character, it does not add it to the returned string.87 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.88 */89 ReadLine(): string;90 91 /**92 * Skips a specified number of characters when reading from an input text stream.93 * Can only be used on a stream in reading mode; causes an error in writing or appending mode.94 * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)95 */96 Skip(characters: number): void;97 98 /**99 * Skips the next line when reading from an input text stream.100 * Can only be used on a stream in reading mode, not writing or appending mode.101 */102 SkipLine(): void;103 104 /**105 * Indicates whether the stream pointer position is at the end of a line.106 */107 AtEndOfLine: boolean;108 109 /**110 * Indicates whether the stream pointer position is at the end of a stream.111 */112 AtEndOfStream: boolean;113}114 115declare var WScript: {116 /**117 * Outputs text to either a message box (under WScript.exe) or the command console window followed by118 * a newline (under CScript.exe).119 */120 Echo(s: any): void;121 122 /**123 * Exposes the write-only error output stream for the current script.124 * Can be accessed only while using CScript.exe.125 */126 StdErr: TextStreamWriter;127 128 /**129 * Exposes the write-only output stream for the current script.130 * Can be accessed only while using CScript.exe.131 */132 StdOut: TextStreamWriter;133 Arguments: { length: number; Item(n: number): string; };134 135 /**136 * The full path of the currently running script.137 */138 ScriptFullName: string;139 140 /**141 * Forces the script to stop immediately, with an optional exit code.142 */143 Quit(exitCode?: number): number;144 145 /**146 * The Windows Script Host build version number.147 */148 BuildVersion: number;149 150 /**151 * Fully qualified path of the host executable.152 */153 FullName: string;154 155 /**156 * Gets/sets the script mode - interactive(true) or batch(false).157 */158 Interactive: boolean;159 160 /**161 * The name of the host executable (WScript.exe or CScript.exe).162 */163 Name: string;164 165 /**166 * Path of the directory containing the host executable.167 */168 Path: string;169 170 /**171 * The filename of the currently running script.172 */173 ScriptName: string;174 175 /**176 * Exposes the read-only input stream for the current script.177 * Can be accessed only while using CScript.exe.178 */179 StdIn: TextStreamReader;180 181 /**182 * Windows Script Host version183 */184 Version: string;185 186 /**187 * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.188 */189 ConnectObject(objEventSource: any, strPrefix: string): void;190 191 /**192 * Creates a COM object.193 * @param strProgiID194 * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.195 */196 CreateObject(strProgID: string, strPrefix?: string): any;197 198 /**199 * Disconnects a COM object from its event sources.200 */201 DisconnectObject(obj: any): void;202 203 /**204 * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.205 * @param strPathname Fully qualified path to the file containing the object persisted to disk.206 * For objects in memory, pass a zero-length string.207 * @param strProgID208 * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.209 */210 GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;211 212 /**213 * Suspends script execution for a specified length of time, then continues execution.214 * @param intTime Interval (in milliseconds) to suspend script execution.215 */216 Sleep(intTime: number): void;217};218 219/**220 * WSH is an alias for WScript under Windows Script Host221 */222declare var WSH: typeof WScript;223 224/**225 * Represents an Automation SAFEARRAY226 */227declare class SafeArray<T = any> {228 private constructor();229 private SafeArray_typekey: SafeArray<T>;230}231 232/**233 * Allows enumerating over a COM collection, which may not have indexed item access.234 */235interface Enumerator<T = any> {236 /**237 * Returns true if the current item is the last one in the collection, or the collection is empty,238 * or the current item is undefined.239 */240 atEnd(): boolean;241 242 /**243 * Returns the current item in the collection244 */245 item(): T;246 247 /**248 * Resets the current item in the collection to the first item. If there are no items in the collection,249 * the current item is set to undefined.250 */251 moveFirst(): void;252 253 /**254 * Moves the current item to the next item in the collection. If the enumerator is at the end of255 * the collection or the collection is empty, the current item is set to undefined.256 */257 moveNext(): void;258}259 260interface EnumeratorConstructor {261 new <T = any>(safearray: SafeArray<T>): Enumerator<T>;262 new <T = any>(collection: { Item(index: any): T; }): Enumerator<T>;263 new <T = any>(collection: any): Enumerator<T>;264}265 266declare var Enumerator: EnumeratorConstructor;267 268/**269 * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.270 */271interface VBArray<T = any> {272 /**273 * Returns the number of dimensions (1-based).274 */275 dimensions(): number;276 277 /**278 * Takes an index for each dimension in the array, and returns the item at the corresponding location.279 */280 getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;281 282 /**283 * Returns the smallest available index for a given dimension.284 * @param dimension 1-based dimension (defaults to 1)285 */286 lbound(dimension?: number): number;287 288 /**289 * Returns the largest available index for a given dimension.290 * @param dimension 1-based dimension (defaults to 1)291 */292 ubound(dimension?: number): number;293 294 /**295 * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,296 * each successive dimension is appended to the end of the array.297 * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]298 */299 toArray(): T[];300}301 302interface VBArrayConstructor {303 new <T = any>(safeArray: SafeArray<T>): VBArray<T>;304}305 306declare var VBArray: VBArrayConstructor;307 308/**309 * Automation date (VT_DATE)310 */311declare class VarDate {312 private constructor();313 private VarDate_typekey: VarDate;314}315 316interface DateConstructor {317 new (vd: VarDate): Date;318}319 320interface Date {321 getVarDate: () => VarDate;322}323 