Merge pull request #23676 from zspitz/activex-faxcomexlib

activex-faxcomexlib, activex-iwshruntimlibrary default properties
This commit is contained in:
Daniel Rosenwasser
2018-02-15 13:00:33 -08:00
committed by GitHub
4 changed files with 123 additions and 164 deletions
@@ -27,7 +27,7 @@ const getServer = () => {
return server;
};
(() => {
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693376(v=vs.85).aspx
const server = new ActiveXObject('FaxComEx.FaxServer');
const document = new ActiveXObject('FaxComEx.FaxDocument');
@@ -35,10 +35,10 @@ const getServer = () => {
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692919(v=vs.85).aspx
server.Connect('');
server.Connect('computername');
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx
(() => {
{
const getInitializedDevice = () => {
const ret = getServer().GetDevices().ItemById(1);
ret.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER;
@@ -54,17 +54,17 @@ const getServer = () => {
// abandoning changes to configuration, using the Refresh method
device = getInitializedDevice();
device.Refresh();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx
(() => {
{
const incomingJob = getServer().Folders.IncomingQueue.GetJobs().Item(1);
incomingJob.Refresh();
const currentPage = incomingJob.CurrentPage;
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692922(v=vs.85).aspx
(() => {
{
const server = getServer();
WScript.Echo(`Server information:
@@ -72,10 +72,10 @@ API Version: ${server.APIVersion}
Debug: ${server.Debug}
Build and version: ${server.MajorBuild}.${server.MinorBuild}.${server.MajorVersion}.${server.MinorVersion}
Server name: ${server.ServerName}`);
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693455(v=vs.85).aspx
(() => {
{
const activity = getServer().Activity;
activity.Refresh();
@@ -84,10 +84,10 @@ ${activity.IncomingMessages} incoming messages
${activity.OutgoingMessages} outgoing messages
${activity.RoutingMessages} routing messages
${activity.QueuedMessages} queued messages`);
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693400(v=vs.85).aspx
(() => {
{
const device = getServer().GetDevices().Item(1);
device.CSID = 'Accounts payable';
device.Description = 'Primary fax device';
@@ -96,10 +96,10 @@ ${activity.QueuedMessages} queued messages`);
device.SendEnabled = true;
device.TSID = 'Accounts payable';
device.Save();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692985(v=vs.85).aspx
(() => {
{
const devices = getServer().GetDevices();
WScript.Echo(`This server has ${devices.Count} fax devices`);
for (let i = 1; i <= devices.Count; i++) {
@@ -124,10 +124,10 @@ Sending now: ${device.SendingNow}`);
device.UseRoutingMethod(routingMethods[0], false);
device.Save();
});
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693486(v=vs.85).aspx
(() => {
{
const outputRuleInfo = (rule: FAXCOMEXLib.FaxOutboundRoutingRule, index?: number) => {
WScript.Echo(`
Outbound routing rule number: ${index || 'unknown'}
@@ -193,13 +193,11 @@ Input 1, 2, 3, 4, or 0 to exit
areaCode = parseInt(VB.InputBox('Enter the area code'), 10);
rule = outboundRoutingRules.Add(countryCode, areaCode, true, '', id);
break;
default:
return;
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693408(v=vs.85).aspx
(() => {
{
const server = getServer();
const outboundRouting = server.OutboundRouting;
const outboundRoutingGroups = outboundRouting.GetGroups();
@@ -233,13 +231,14 @@ Device status: ${routingGroup.Status}
});
// allow user to remove a routing group
if (VB.InputBox('Do you want to remove a routing group (Y/N)?') === 'N') { return; }
const itemNumber = VB.InputBox('Enter the item number for the group you want to remove');
outboundRoutingGroups.Remove(itemNumber);
})();
if (VB.InputBox('Do you want to remove a routing group (Y/N)?') === 'Y') {
const itemNumber = VB.InputBox('Enter the item number for the group you want to remove');
outboundRoutingGroups.Remove(itemNumber);
}
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa964960(v=vs.85).aspx
(() => {
{
const accountSet = getServer().FaxAccountSet;
const accounts = collectionToArray(accountSet.GetAccounts());
WScript.Echo(`Number of accounts: ${accounts.length}`);
@@ -248,10 +247,10 @@ Device status: ${routingGroup.Status}
const accountName = VB.InputBox('Enter an account name');
accountSet.AddAccount(accountName);
accountSet.RemoveAccount(accountName);
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692952(v=vs.85).aspx
(() => {
{
const incomingJobs = collectionToArray(getServer().Folders.IncomingQueue.GetJobs());
WScript.Echo(`There are ${incomingJobs.length} jobs in the incoming queue.`);
const n = parseInt(VB.InputBox('Input the number of a job for which you want information'), 10);
@@ -284,10 +283,10 @@ TSID: ${job.TSID}
job.CopyTiff(fileName);
new ActiveXObject('WScript.Shell').Run(fileName);
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692914(v=vs.85).aspx
(() => {
{
const server = new ActiveXObject('FaxComEx.FaxServer');
server.Connect('');
const outgoingQueue = server.Folders.OutgoingQueue;
@@ -300,10 +299,10 @@ TSID: ${job.TSID}
outgoingQueue.DiscountRateStart = new Date(0, 0, 0, 1).getVarDate();
outgoingQueue.UseDeviceTSID = true;
outgoingQueue.Save();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693393(v=vs.85).aspx
(() => {
{
const outgoingQueue = getServer().Folders.OutgoingQueue;
outgoingQueue.Refresh();
WScript.Echo(`There are ${outgoingQueue.GetJobs().Count} faxes in the outgoing queue`);
@@ -357,10 +356,10 @@ the job?
job.Resume();
break;
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692936(v=vs.85).aspx
(() => {
{
const document = new ActiveXObject('FaxComEx.FaxDocument');
document.Body = 'C:\\docs\\body.txt';
document.DocumentName = 'My First Fax';
@@ -401,10 +400,10 @@ the job?
WScript.Echo(`The job ID is ${jobID}`);
server.Disconnect();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693479(v=vs.85).aspx
(() => {
{
const document = new ActiveXObject('FaxComEx.FaxDocument');
document.Body = 'C:\\docs\\body.txt';
document.DocumentName = 'My First Fax';
@@ -428,10 +427,10 @@ the job?
while (recipients.Count > 0) {
recipients.Remove(1);
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa964962(v=vs.85).aspx
(() => {
{
const server = getServer();
const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10);
server.CurrentAccount.Folders.IncomingArchive.Refresh();
@@ -442,7 +441,7 @@ the job?
const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage;
if (messageIterator.AtEOF) {
WScript.Echo(`End of file reached`);
return;
break;
}
if (!message.WasReAssigned) {
if (VB.InputBox('Message not reassigned. Reassign (Y/N)?') === 'Y') {
@@ -455,10 +454,10 @@ the job?
}
messageIterator.MoveNext();
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693402(v=vs.85).aspx
(() => {
{
const server = getServer();
const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10);
server.Folders.OutgoingArchive.Refresh();
@@ -468,7 +467,7 @@ the job?
if (i > 1 && VB.InputBox('View next message? (Y/N)') !== 'Y') { break; }
if (messageIterator.AtEOF) {
WScript.Echo(`End of file reached`);
return;
break;
}
const message = messageIterator.Message as FAXCOMEXLib.FaxOutgoingMessage;
@@ -498,10 +497,10 @@ TSID: ${message.TSID}`);
message.Delete();
}
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693472(v=vs.85).aspx
(() => {
{
const server = getServer();
const outgoingArchive = server.Folders.OutgoingArchive;
WScript.Echo(`
@@ -526,12 +525,11 @@ Is archive used? ${outgoingArchive.UseArchive}`.trim()
outgoingArchive.GetMessage(messageID).CopyTiff(fileName);
new ActiveXObject('WScript.Shell').Run(fileName);
}
})();
}
(() => {
{
const server = getServer();
const messageIterator = server.Folders.OutgoingArchive.GetMessages();
if (messageIterator.AtEOF) { return; }
messageIterator.MoveFirst();
while (!messageIterator.AtEOF) {
const message = messageIterator.Message;
@@ -543,10 +541,10 @@ Transmission start: ${new Date(message.TransmissionStart)}
`.trim());
messageIterator.MoveNext();
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms692976(v=vs.85).aspx
(() => {
{
const server = getServer();
const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10);
server.Folders.IncomingArchive.Refresh();
@@ -557,7 +555,7 @@ Transmission start: ${new Date(message.TransmissionStart)}
const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage;
if (messageIterator.AtEOF) {
WScript.Echo(`End of file reached`);
return;
break;
}
const fileName = VB.InputBox('Enter path to save TIFF file');
message.CopyTiff(fileName);
@@ -565,10 +563,10 @@ Transmission start: ${new Date(message.TransmissionStart)}
messageIterator.MoveNext();
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693406(v=vs.85).aspx
(() => {
{
const server = getServer();
const incomingArchive = server.Folders.IncomingArchive;
incomingArchive.Refresh();
@@ -587,9 +585,9 @@ Is archive used? ${incomingArchive.UseArchive}
incomingArchive.Save();
const messageID = VB.InputBox('Message ID to retrieve information? (Leave empty, or Cancel, to exit)');
if (messageID === '') { return; }
const message = incomingArchive.GetMessage(messageID);
WScript.Echo(`
if (messageID !== '') {
const message = incomingArchive.GetMessage(messageID);
WScript.Echo(`
Caller ID: ${message.CallerId}
CSID: ${message.CSID}
Device name: ${message.DeviceName}
@@ -603,13 +601,14 @@ Transmission end: ${new Date(message.TransmissionEnd)}
TSID: ${message.TSID}
`.trim());
if (VB.InputBox('Delete this message from the archive (Y/N)?') === 'Y') {
message.Delete();
if (VB.InputBox('Delete this message from the archive (Y/N)?') === 'Y') {
message.Delete();
}
}
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693401(v=vs.85).aspx
(() => {
{
const server = getServer();
const loggingOptions = server.LoggingOptions;
const activityLogging = loggingOptions.ActivityLogging;
@@ -626,10 +625,10 @@ TSID: ${message.TSID}
eventLogging.InitEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllMAX;
eventLogging.OutboundEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllNONE;
eventLogging.Save();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693387(v=vs.85).aspx
(() => {
{
const server = getServer();
const receiptOptions = server.ReceiptOptions;
receiptOptions.Refresh();
@@ -649,10 +648,10 @@ Use for inbound routing? ${receiptOptions.UseForInboundRouting}
receiptOptions.SMTPServer = 'My SMTP Server';
receiptOptions.UseForInboundRouting = true;
receiptOptions.Save();
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693462(v=vs.85).aspx
(() => {
{
const server = getServer();
collectionToArray(server.GetDeviceProviders()).forEach((provider, index) => {
WScript.Echo(`
@@ -668,29 +667,29 @@ Unique name: ${provider.UniqueName}
new VBArray(provider.DeviceIds).toArray().forEach(id => WScript.Echo(id));
});
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device
(() => {
{
const server = getServer();
const device = server.GetDevices().Item(1);
const deviceProperty = toSafeArray(1, 2, 3);
const propertyName = '{B1F944B9-9A16-45d1-933A-4060A4871AB0}';
device.SetExtensionProperty(propertyName, deviceProperty);
new VBArray(device.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x));
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device
(() => {
{
const server = getServer();
const serverProperty = toSafeArray(4, 2, 3);
const propertyName = `{AC7D0DEE-B6E5-4a44-AF45-835C58CB44D2}`;
server.SetExtensionProperty(propertyName, serverProperty);
new VBArray(server.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x));
})();
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms693013(v=vs.85).aspx
(() => {
{
const server = getServer();
ActiveXObject.on(server, 'OnOutgoingJobAdded', ['pFaxServer', 'bstrJobId'], prm => WScript.Echo('New job added to queue'));
@@ -727,4 +726,4 @@ TSID: ${status.TSID}
FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetFXSSVC_ENDED +
FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE
);
})();
}
+46 -79
View File
@@ -7,7 +7,7 @@
/// <reference types="activex-stdole" />
declare namespace FAXCOMEXLib {
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_ACCESS_RIGHTS_ENUM {
farMANAGE_CONFIG = 64,
farMANAGE_IN_ARCHIVE = 256,
@@ -22,7 +22,7 @@ declare namespace FAXCOMEXLib {
farSUBMIT_NORMAL = 2,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_ACCESS_RIGHTS_ENUM_2 {
far2MANAGE_ARCHIVES = 256,
far2MANAGE_CONFIG = 64,
@@ -36,7 +36,7 @@ declare namespace FAXCOMEXLib {
far2SUBMIT_NORMAL = 2,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_ACCOUNT_EVENTS_TYPE_ENUM {
faetFXSSVC_ENDED = 16,
faetIN_ARCHIVE = 4,
@@ -46,21 +46,21 @@ declare namespace FAXCOMEXLib {
faetOUT_QUEUE = 2,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_COVERPAGE_TYPE_ENUM {
fcptLOCAL = 1,
fcptNONE = 0,
fcptSERVER = 2,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_DEVICE_RECEIVE_MODE_ENUM {
fdrmAUTO_ANSWER = 1,
fdrmMANUAL_ANSWER = 2,
fdrmNO_ANSWER = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_GROUP_STATUS_ENUM {
fgsALL_DEV_NOT_VALID = 2,
fgsALL_DEV_VALID = 0,
@@ -68,7 +68,7 @@ declare namespace FAXCOMEXLib {
fgsSOME_DEV_NOT_VALID = 3,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_JOB_EXTENDED_STATUS_ENUM {
fjesANSWERED = 5,
fjesBAD_ADDRESS = 10,
@@ -93,7 +93,7 @@ declare namespace FAXCOMEXLib {
fjesTRANSMITTING = 4,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_JOB_OPERATIONS_ENUM {
fjoDELETE = 16,
fjoPAUSE = 2,
@@ -104,7 +104,7 @@ declare namespace FAXCOMEXLib {
fjoVIEW = 1,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_JOB_STATUS_ENUM {
fjsCANCELED = 512,
fjsCANCELING = 1024,
@@ -119,14 +119,14 @@ declare namespace FAXCOMEXLib {
fjsROUTING = 2048,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_JOB_TYPE_ENUM {
fjtRECEIVE = 1,
fjtROUTING = 2,
fjtSEND = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_LOG_LEVEL_ENUM {
fllMAX = 3,
fllMED = 2,
@@ -134,14 +134,14 @@ declare namespace FAXCOMEXLib {
fllNONE = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_PRIORITY_TYPE_ENUM {
fptHIGH = 2,
fptLOW = 0,
fptNORMAL = 1,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_PROVIDER_STATUS_ENUM {
fpsBAD_GUID = 2,
fpsBAD_VERSION = 3,
@@ -152,19 +152,19 @@ declare namespace FAXCOMEXLib {
fpsSUCCESS = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_RECEIPT_TYPE_ENUM {
frtMAIL = 1,
frtMSGBOX = 4,
frtNONE = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_ROUTING_RULE_CODE_ENUM {
frrcANY_CODE = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_RULE_STATUS_ENUM {
frsALL_GROUP_DEV_NOT_VALID = 2,
frsBAD_DEVICE = 4,
@@ -173,14 +173,14 @@ declare namespace FAXCOMEXLib {
frsVALID = 0,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_SCHEDULE_TYPE_ENUM {
fstDISCOUNT_PERIOD = 2,
fstNOW = 0,
fstSPECIFIC_TIME = 1,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_SERVER_APIVERSION_ENUM {
fsAPI_VERSION_0 = 0,
fsAPI_VERSION_1 = 65536,
@@ -188,7 +188,7 @@ declare namespace FAXCOMEXLib {
fsAPI_VERSION_3 = 196608,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_SERVER_EVENTS_TYPE_ENUM {
fsetACTIVITY = 8,
fsetCONFIG = 4,
@@ -203,14 +203,14 @@ declare namespace FAXCOMEXLib {
fsetQUEUE_STATE = 16,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FAX_SMTP_AUTHENTICATION_TYPE_ENUM {
fsatANONYMOUS = 0,
fsatBASIC = 1,
fsatNTLM = 2,
}
// tslint:disable-next-line no-const-enum
// tslint:disable-next-line:no-const-enum
const enum FaxConstants {
bstrGROUPNAME_ALLDEVICES = '<All Devices>',
lDEFAULT_PREFETCH_SIZE = 100,
@@ -326,11 +326,10 @@ declare namespace FAXCOMEXLib {
}
/** FaxAccounts Class */
class FaxAccounts {
private 'FAXCOMEXLib.FaxAccounts_typekey': FaxAccounts;
private constructor();
interface FaxAccounts {
readonly Count: number;
Item(vIndex: any): FaxAccount;
(vIndex: any): FaxAccount;
}
/** FaxAccountSet Class */
@@ -535,10 +534,7 @@ declare namespace FAXCOMEXLib {
}
/** FaxDeviceIds Class */
class FaxDeviceIds {
private 'FAXCOMEXLib.FaxDeviceIds_typekey': FaxDeviceIds;
private constructor();
interface FaxDeviceIds {
/** Add a device */
Add(lDeviceId: number): void;
readonly Count: number;
@@ -549,6 +545,7 @@ declare namespace FAXCOMEXLib {
/** Set order of the device */
SetOrder(lDeviceId: number, lNewOrder: number): void;
(lIndex: number): number;
}
/** FaxDeviceProvider Class */
@@ -594,22 +591,20 @@ declare namespace FAXCOMEXLib {
}
/** FaxDeviceProviders Class */
class FaxDeviceProviders {
private 'FAXCOMEXLib.FaxDeviceProviders_typekey': FaxDeviceProviders;
private constructor();
interface FaxDeviceProviders {
readonly Count: number;
Item(vIndex: any): FaxDeviceProvider;
(vIndex: any): FaxDeviceProvider;
}
/** FaxDevices Class */
class FaxDevices {
private 'FAXCOMEXLib.FaxDevices_typekey': FaxDevices;
private constructor();
interface FaxDevices {
readonly Count: number;
Item(vIndex: any): FaxDevice;
/** Get device by its ID */
ItemById(lId: number): FaxDevice;
(vIndex: any): FaxDevice;
}
/** FaxDocument Class */
@@ -630,10 +625,10 @@ declare namespace FAXCOMEXLib {
CallHandle: number;
/** Submit the fax document on the already connected server */
ConnectedSubmit(pFaxServer: IFaxServer): any;
ConnectedSubmit(pFaxServer: IFaxServer): SafeArray<string>;
/** Submit the fax document on the already connected server */
ConnectedSubmit2(pFaxServer: IFaxServer, pvFaxOutgoingJobIDs: any): number;
ConnectedSubmit2(pFaxServer: IFaxServer, pvFaxOutgoingJobIDs: SafeArray<string>): number;
/** Cover page file path */
CoverPage: string;
@@ -765,7 +760,7 @@ declare namespace FAXCOMEXLib {
readonly MajorVersion: number;
/** Array of methods exposed by extension */
readonly Methods: any;
readonly Methods: SafeArray<string>;
/** The minor part of extension's build number */
readonly MinorBuild: number;
@@ -781,11 +776,10 @@ declare namespace FAXCOMEXLib {
}
/** FaxInboundRoutingExtensions Class */
class FaxInboundRoutingExtensions {
private 'FAXCOMEXLib.FaxInboundRoutingExtensions_typekey': FaxInboundRoutingExtensions;
private constructor();
interface FaxInboundRoutingExtensions {
readonly Count: number;
Item(vIndex: any): FaxInboundRoutingExtension;
(vIndex: any): FaxInboundRoutingExtension;
}
/** FaxInboundRoutingMethod Class */
@@ -819,11 +813,10 @@ declare namespace FAXCOMEXLib {
}
/** FaxInboundRoutingMethods Class */
class FaxInboundRoutingMethods {
private 'FAXCOMEXLib.FaxInboundRoutingMethods_typekey': FaxInboundRoutingMethods;
private constructor();
interface FaxInboundRoutingMethods {
readonly Count: number;
Item(vIndex: any): FaxInboundRoutingMethod;
(vIndex: any): FaxInboundRoutingMethod;
}
/** FaxIncomingArchive Class */
@@ -935,11 +928,10 @@ declare namespace FAXCOMEXLib {
}
/** FaxIncomingJobs Class */
class FaxIncomingJobs {
private 'FAXCOMEXLib.FaxIncomingJobs_typekey': FaxIncomingJobs;
private constructor();
interface FaxIncomingJobs {
readonly Count: number;
Item(vIndex: any): FaxIncomingJob;
(vIndex: any): FaxIncomingJob;
}
/** FaxIncomingMessage Class */
@@ -1117,10 +1109,7 @@ declare namespace FAXCOMEXLib {
}
/** FaxOutboundRoutingGroups Class */
class FaxOutboundRoutingGroups {
private 'FAXCOMEXLib.FaxOutboundRoutingGroups_typekey': FaxOutboundRoutingGroups;
private constructor();
interface FaxOutboundRoutingGroups {
/** Add a group */
Add(bstrName: string): FaxOutboundRoutingGroup;
readonly Count: number;
@@ -1128,6 +1117,7 @@ declare namespace FAXCOMEXLib {
/** Remove a group */
Remove(vIndex: number | string): void;
(vIndex: number | string): FaxOutboundRoutingGroup;
}
/** FaxOutboundRoutingRule Class */
@@ -1161,10 +1151,7 @@ declare namespace FAXCOMEXLib {
}
/** FaxOutboundRoutingRules Class */
class FaxOutboundRoutingRules {
private 'FAXCOMEXLib.FaxOutboundRoutingRules_typekey': FaxOutboundRoutingRules;
private constructor();
interface FaxOutboundRoutingRules {
/** Add a rule */
Add(lCountryCode: number, lAreaCode: number, bUseDevice: boolean, bstrGroupName: string, lDeviceId: number): FaxOutboundRoutingRule;
readonly Count: number;
@@ -1178,6 +1165,7 @@ declare namespace FAXCOMEXLib {
/** Remove a rule by criteria */
RemoveByCountryAndArea(lCountryCode: number, lAreaCode: number): void;
(lIndex: number): FaxOutboundRoutingRule;
}
/** FaxOutgoingArchive Class */
@@ -1334,11 +1322,10 @@ declare namespace FAXCOMEXLib {
}
/** FaxOutgoingJobs Class */
class FaxOutgoingJobs {
private 'FAXCOMEXLib.FaxOutgoingJobs_typekey': FaxOutgoingJobs;
private constructor();
interface FaxOutgoingJobs {
readonly Count: number;
Item(vIndex: any): IFaxOutgoingJob;
(vIndex: any): IFaxOutgoingJob;
}
/** FaxOutgoingMessage Class */
@@ -1486,10 +1473,7 @@ declare namespace FAXCOMEXLib {
}
/** FaxRecipients Class */
class FaxRecipients {
private 'FAXCOMEXLib.FaxRecipients_typekey': FaxRecipients;
private constructor();
interface FaxRecipients {
/**
* Add a recipient
* @param string [bstrRecipientName='']
@@ -1500,6 +1484,7 @@ declare namespace FAXCOMEXLib {
/** Remove a recipient */
Remove(lIndex: number): void;
(lIndex: number): FaxRecipient;
}
/** FaxSecurity Class */
@@ -2033,21 +2018,3 @@ interface ActiveXObjectNameMap {
'FaxComEx.FaxDocument': FAXCOMEXLib.FaxDocument;
'FaxComEx.FaxServer': FAXCOMEXLib.FaxServer;
}
interface EnumeratorConstructor {
new(col: FAXCOMEXLib.FaxAccounts): Enumerator<FAXCOMEXLib.FaxAccount>;
new(col: FAXCOMEXLib.FaxDeviceIds): Enumerator<number>;
new(col: FAXCOMEXLib.FaxDeviceProviders): Enumerator<FAXCOMEXLib.FaxDeviceProvider>;
new(col: FAXCOMEXLib.FaxDevices): Enumerator<FAXCOMEXLib.FaxDevice>;
new(col: FAXCOMEXLib.FaxInboundRoutingExtensions): Enumerator<FAXCOMEXLib.FaxInboundRoutingExtension>;
new(col: FAXCOMEXLib.FaxInboundRoutingMethods): Enumerator<FAXCOMEXLib.FaxInboundRoutingMethod>;
new(col: FAXCOMEXLib.FaxIncomingJobs): Enumerator<FAXCOMEXLib.FaxIncomingJob>;
new(col: FAXCOMEXLib.FaxOutboundRoutingGroups): Enumerator<FAXCOMEXLib.FaxOutboundRoutingGroup>;
new(col: FAXCOMEXLib.FaxOutboundRoutingRules): Enumerator<FAXCOMEXLib.FaxOutboundRoutingRule>;
new(col: FAXCOMEXLib.FaxOutgoingJobs): Enumerator<FAXCOMEXLib.IFaxOutgoingJob>;
new(col: FAXCOMEXLib.FaxRecipients): Enumerator<FAXCOMEXLib.FaxRecipient>;
}
interface SafeArray<T = any> {
_brand: SafeArray<T>;
}
@@ -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
View File
@@ -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>;
}