mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
Default properties
This commit is contained in:
@@ -4,11 +4,11 @@ const wshn = new ActiveXObject('WScript.Network');
|
||||
// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx
|
||||
// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx
|
||||
// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx
|
||||
(() => {
|
||||
{
|
||||
WScript.Echo('Domain = ' + wshn.UserDomain);
|
||||
WScript.Echo('Computer Name = ' + wshn.ComputerName);
|
||||
WScript.Echo('User Name = ' + wshn.UserName);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx
|
||||
wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter');
|
||||
@@ -18,7 +18,7 @@ wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1");
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx
|
||||
// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx
|
||||
(() => {
|
||||
{
|
||||
const drives = wshn.EnumNetworkDrives();
|
||||
const printers = wshn.EnumPrinterConnections();
|
||||
WScript.Echo("Network drive mappings:");
|
||||
@@ -30,7 +30,7 @@ wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1");
|
||||
for (let i = 0; i < printers.length; i += 2) {
|
||||
WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx
|
||||
wshn.MapNetworkDrive('E:', '\\\\Server\\Public');
|
||||
@@ -42,8 +42,8 @@ wshn.RemoveNetworkDrive('E:');
|
||||
wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true);
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx
|
||||
(() => {
|
||||
{
|
||||
const printerPath = "\\\\research\\library1";
|
||||
wshn.AddWindowsPrinterConnection(printerPath);
|
||||
wshn.SetDefaultPrinter(printerPath);
|
||||
})();
|
||||
}
|
||||
|
||||
+4
-11
@@ -98,22 +98,20 @@ declare namespace IWshRuntimeLibrary {
|
||||
}
|
||||
|
||||
/** Generic Collection Object */
|
||||
class WshCollection {
|
||||
private 'IWshRuntimeLibrary.WshCollection_typekey': WshCollection;
|
||||
private constructor();
|
||||
interface WshCollection {
|
||||
Count(): number;
|
||||
Item(Index: any): any;
|
||||
readonly length: number;
|
||||
(Index: any): any;
|
||||
}
|
||||
|
||||
/** Environment Variables Collection Object */
|
||||
class WshEnvironment {
|
||||
private 'IWshRuntimeLibrary.WshEnvironment_typekey': WshEnvironment;
|
||||
private constructor();
|
||||
interface WshEnvironment {
|
||||
Count(): number;
|
||||
Item(Name: string): string;
|
||||
readonly length: number;
|
||||
Remove(Name: string): void;
|
||||
(Name: string): string;
|
||||
}
|
||||
|
||||
/** WSHExec object */
|
||||
@@ -348,8 +346,3 @@ interface ActiveXObjectNameMap {
|
||||
'WScript.Network': IWshRuntimeLibrary.WshNetwork;
|
||||
'WScript.Shell': IWshRuntimeLibrary.WshShell;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: IWshRuntimeLibrary.WshCollection): Enumerator;
|
||||
new(col: IWshRuntimeLibrary.WshEnvironment): Enumerator<string>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user