dts fixes

This commit is contained in:
Zev Spitz
2018-01-31 19:09:46 +02:00
parent 9ad4f0a744
commit 8b4bf26d7b
8 changed files with 251 additions and 11 deletions
@@ -39,22 +39,21 @@ const getServer = () => {
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx
(() => {
let device: FAXCOMEXLib.FaxDevice;
const init = () => {
device = getServer().GetDevices().ItemById(1);
device.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER;
device.RingsBeforeAnswer = 5;
device.SendEnabled = true;
const getInitializedDevice = () => {
const ret = getServer().GetDevices().ItemById(1);
ret.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER;
ret.RingsBeforeAnswer = 5;
ret.SendEnabled = true;
return ret;
};
// saving configuration
init();
device!.Save();
let device = getInitializedDevice();
device.Save();
// abandoning changes to configuration, using the Refresh method
init();
device!.Refresh();
device = getInitializedDevice();
device.Refresh();
})();
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx
+1
View File
@@ -2,6 +2,7 @@
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684513(v=vs.85).aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="activex-stdole" />
+1
View File
@@ -6,6 +6,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -0,0 +1,3 @@
let obj1 = new ActiveXObject('WScript.Network');
let obj2 = new ActiveXObject('WScript.Shell');
+201
View File
@@ -0,0 +1,201 @@
// Type definitions for Windows Script Host Object Model - IWshRuntimeLibrary 1.0
// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84).aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
declare namespace IWshRuntimeLibrary {
const enum ButtonType {
OK,
OKCancel,
AbortRetryIgnore,
YesNoCancel,
YesNo,
RetryCancel,
CancelTryagainContinue
}
const enum IconType {
Stop = 16,
QuestionMark = 32,
ExclamationMakr = 48,
InformationMark = 64,
}
const enum PopupType {
SecondButtonDefault = 256,
ThirdButtonDefault = 512,
Modal = 4096,
RightJustified = 524288,
RTL = 1048576,
}
const enum PopupSelection {
NoButton = -1,
OK = 1,
Cancel = 2,
Abort = 3,
Retry = 4,
Ignore = 5,
Yes = 6,
No = 7,
TryAgain = 10,
Continue = 11,
}
const enum WshExecStatus {
WshFailed = 2,
WshFinished = 1,
WshRunning = 0,
}
const enum WshWindowStyle {
WshHide = 0,
WshMaximizedFocus = 3,
WshMinimizedFocus = 2,
WshMinimizedNoFocus = 6,
WshNormalFocus = 1,
WshNormalNoFocus = 4,
}
class TextStream {
private 'IWshRuntimeLibrary.TextStream_typekey': TextStream;
private constructor();
readonly AtEndOfLine: boolean;
readonly AtEndOfStream: boolean;
Close(): void;
readonly Column: number;
readonly Line: number;
Read(Characters: number): string;
ReadAll(): string;
ReadLine(): string;
Skip(Characters: number): void;
SkipLine(): void;
Write(Text: string): void;
WriteBlankLines(Lines: number): void;
/** @param string [Text=''] */
WriteLine(Text?: string): void;
}
/** Generic Collection Object */
class WshCollection {
private 'IWshRuntimeLibrary.WshCollection_typekey': WshCollection;
private constructor();
Count(): number;
Item(Index: any): any;
readonly length: number;
}
/** Environment Variables Collection Object */
class WshEnvironment {
private 'IWshRuntimeLibrary.WshEnvironment_typekey': WshEnvironment;
private constructor();
Count(): number;
Item(Name: string): string;
readonly length: number;
Remove(Name: string): void;
}
/** WSHExec object */
class WshExec {
private 'IWshRuntimeLibrary.WshExec_typekey': WshExec;
private constructor();
readonly ExitCode: number;
readonly ProcessID: number;
readonly Status: WshExecStatus;
readonly StdErr: TextStream;
readonly StdIn: TextStream;
readonly StdOut: TextStream;
Terminate(): void;
}
/** Network Object */
class WshNetwork {
private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork;
private constructor();
AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: any, UserName?: any, Password?: any): void;
/**
* @param string [DriverName='']
* @param string [Port='LPT1']
*/
AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void;
readonly ComputerName: string;
EnumNetworkDrives(): WshCollection;
EnumPrinterConnections(): WshCollection;
MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: any, UserName?: any, Password?: any): void;
readonly Organization: string;
RemoveNetworkDrive(Name: string, Force?: any, UpdateProfile?: any): void;
RemovePrinterConnection(Name: string, Force?: any, UpdateProfile?: any): void;
SetDefaultPrinter(Name: string): void;
readonly Site: string;
readonly UserDomain: string;
readonly UserName: string;
readonly UserProfile: string;
}
/** Shell Object */
class WshShell {
private 'IWshRuntimeLibrary.WshShell_typekey': WshShell;
private constructor();
AppActivate(App: any, Wait?: any): boolean;
CreateShortcut(PathLink: string): any;
CurrentDirectory: string;
Environment(Type?: any): WshEnvironment;
Exec(Command: string): WshExec;
ExpandEnvironmentStrings(Src: string): string;
/** @param string [Target=''] */
LogEvent(Type: any, Message: string, Target?: string): boolean;
Popup(Text: any, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection;
RegDelete(Name: string): void;
RegRead(Name: string): any;
RegWrite(Name: string, Value: any, Type?: any): void;
Run(Command: string, WindowStyle?: any, WaitOnReturn?: any): number;
SendKeys(Keys: string, Wait?: any): void;
readonly SpecialFolders: WshCollection;
}
/** Shortcut Object */
class WshShortcut {
private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut;
private constructor();
Arguments: string;
Description: string;
readonly FullName: string;
Hotkey: string;
IconLocation: string;
Load(PathLink: string): void;
readonly RelativePath: string;
Save(): void;
TargetPath: string;
WindowStyle: number;
WorkingDirectory: string;
}
/** URLShortcut Object */
class WshURLShortcut {
private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut;
private constructor();
readonly FullName: string;
Load(PathLink: string): void;
Save(): void;
TargetPath: string;
}
}
interface ActiveXObject {
set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void;
new <K extends keyof ActiveXObjectNameMap = any>(progid: K): ActiveXObjectNameMap[K];
}
interface ActiveXObjectNameMap {
'WScript.Network': IWshRuntimeLibrary.WshNetwork;
'WScript.Shell': IWshRuntimeLibrary.WshShell;
}
interface EnumeratorConstructor {
new(col: IWshRuntimeLibrary.WshCollection): Enumerator;
new(col: IWshRuntimeLibrary.WshEnvironment): Enumerator<string>;
}
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"activex-helpers": "*"
}
}
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-iwshruntimelibrary-tests.ts"
]
}
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"interface-name": [false],
"no-const-enum": false
}
}