mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #9868 from zspitz/ActiveX-WIA
Created typings for ActiveX libraries (Scripting Runtime and WIA)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/// <reference path="jscript-extensions.d.ts" />
|
||||
|
||||
var x: VarDate;
|
||||
var dte = new Date(x);
|
||||
x = dte.getVarDate();
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for Microsoft JScript extensions
|
||||
// Project: https://msdn.microsoft.com/en-us/library/yek4tbz0(v=vs.84).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
//These will become unnecessary with the next version of Typescript
|
||||
|
||||
interface VarDate { }
|
||||
|
||||
interface DateConstructor {
|
||||
new (vd: VarDate): Date;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
getVarDate: () => VarDate;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/// <reference path="microsoft-scripting-runtime.d.ts" />
|
||||
|
||||
|
||||
//source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
|
||||
|
||||
//Generates a string describing the drive type of a given Drive object.
|
||||
var showDriveType = (drive: Scripting.Drive) => {
|
||||
switch (drive.DriveType) {
|
||||
case Scripting.DriveTypeConst.Removable:
|
||||
return 'Removeable';
|
||||
case Scripting.DriveTypeConst.Fixed:
|
||||
return 'Fixecd';
|
||||
case Scripting.DriveTypeConst.Remote:
|
||||
return 'Network';
|
||||
case Scripting.DriveTypeConst.CDRom:
|
||||
return 'CD-ROM';
|
||||
case Scripting.DriveTypeConst.RamDisk:
|
||||
return 'RAM Disk';
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Generates a string describing the attributes of a file or folder.
|
||||
var showFileAttributes = (file: Scripting.File) => {
|
||||
var attr = file.Attributes;
|
||||
if (attr == 0) {
|
||||
return 'Normal';
|
||||
}
|
||||
var attributeStrings: string[] = [];
|
||||
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
|
||||
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
|
||||
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
|
||||
if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); }
|
||||
if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); }
|
||||
if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); }
|
||||
if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); }
|
||||
if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); }
|
||||
return attributeStrings.join(',');
|
||||
};
|
||||
|
||||
|
||||
//source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
var showFreeSpace = (drvPath: string) => {
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
var s = "Drive " + drvPath + " - ";
|
||||
s += d.VolumeName + "<br>";
|
||||
s += "Free Space: " + d.FreeSpace / 1024 + " Kbytes";
|
||||
return (s);
|
||||
};
|
||||
|
||||
|
||||
//source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
var getALine = (filespec: string) => {
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
var s = "";
|
||||
while (!file.AtEndOfLine) {
|
||||
s += file.Read(1);
|
||||
}
|
||||
file.Close();
|
||||
return (s);
|
||||
}
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
// Type definitions for Microsoft Scripting Runtime
|
||||
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx?f=255&MSPPError=-2147217396
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="jscript-extensions.d.ts" />
|
||||
|
||||
declare namespace Scripting {
|
||||
|
||||
//Enums
|
||||
const enum CompareMethod {
|
||||
BinaryCompare = 0,
|
||||
DatabaseCompare = 2,
|
||||
TextCompare = 1
|
||||
}
|
||||
|
||||
const enum DriveTypeConst {
|
||||
CDRom = 4,
|
||||
Fixed = 2,
|
||||
RamDisk = 5,
|
||||
Remote = 3,
|
||||
Removable = 1,
|
||||
UnknownType = 0
|
||||
}
|
||||
|
||||
const enum FileAttribute {
|
||||
Alias = 1024,
|
||||
Archive = 32,
|
||||
Compressed = 2048,
|
||||
Directory = 16,
|
||||
Hidden = 2,
|
||||
Normal = 0,
|
||||
ReadOnly = 1,
|
||||
System = 4,
|
||||
Volume = 8
|
||||
}
|
||||
|
||||
const enum IOMode {
|
||||
ForAppending = 8,
|
||||
ForReading = 1,
|
||||
ForWriting = 2
|
||||
}
|
||||
|
||||
const enum SpecialFolderConst {
|
||||
SystemFolder = 1,
|
||||
TemporaryFolder = 2,
|
||||
WindowsFolder = 0
|
||||
}
|
||||
|
||||
const enum StandardStreamTypes {
|
||||
StdErr = 2,
|
||||
StdIn = 0,
|
||||
StdOut = 1
|
||||
}
|
||||
|
||||
const enum Tristate {
|
||||
TristateFalse = 0,
|
||||
TristateMixed = -2,
|
||||
TristateTrue = -1,
|
||||
TristateUseDefault = -2
|
||||
}
|
||||
|
||||
//Classes
|
||||
interface Dictionary {
|
||||
Add: (Key: any, Item: any) => void;
|
||||
CompareMode: CompareMethod;
|
||||
Count: number;
|
||||
Exists: (Key: any) => boolean;
|
||||
HashVal: (Key: any) => any;
|
||||
Item: (Key: any) => any //Also has setter with parameters;
|
||||
Items: () => any;
|
||||
Key: (Key: any) => any;
|
||||
Keys: () => any;
|
||||
Remove: (Key: any) => void;
|
||||
RemoveAll: () => void;
|
||||
}
|
||||
|
||||
interface Drive {
|
||||
AvailableSpace: any;
|
||||
DriveLetter: string;
|
||||
DriveType: DriveTypeConst;
|
||||
FileSystem: string;
|
||||
FreeSpace: any;
|
||||
IsReady: boolean;
|
||||
Path: string;
|
||||
RootFolder: Folder;
|
||||
SerialNumber: number;
|
||||
ShareName: string;
|
||||
TotalSize: any;
|
||||
VolumeName: string;
|
||||
}
|
||||
|
||||
interface Drives {
|
||||
Count: number;
|
||||
Item: (Key: any) => Drive;
|
||||
}
|
||||
|
||||
interface Encoder {
|
||||
EncodeScriptFile: (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string) => string;
|
||||
}
|
||||
|
||||
interface File {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
OpenAsTextStream: (IOMode?: IOMode, Format?: Tristate) => TextStream;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Files {
|
||||
Count: number;
|
||||
Item: (Key: any) => File;
|
||||
}
|
||||
|
||||
interface FileSystemObject {
|
||||
BuildPath: (Path: string, Name: string) => string;
|
||||
CopyFile: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CopyFolder: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateFolder: (Path: string) => Folder;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DeleteFile: (FileSpec: string, Force?: boolean) => void;
|
||||
DeleteFolder: (FolderSpec: string, Force?: boolean) => void;
|
||||
DriveExists: (DriveSpec: string) => boolean;
|
||||
Drives: Drives;
|
||||
FileExists: (FileSpec: string) => boolean;
|
||||
FolderExists: (FolderSpec: string) => boolean;
|
||||
GetAbsolutePathName: (Path: string) => string;
|
||||
GetBaseName: (Path: string) => string;
|
||||
GetDrive: (DriveSpec: string) => Drive;
|
||||
GetDriveName: (Path: string) => string;
|
||||
GetExtensionName: (Path: string) => string;
|
||||
GetFile: (FilePath: string) => File;
|
||||
GetFileName: (Path: string) => string;
|
||||
GetFileVersion: (FileName: string) => string;
|
||||
GetFolder: (FolderPath: string) => Folder;
|
||||
GetParentFolderName: (Path: string) => string;
|
||||
GetSpecialFolder: (SpecialFolder: SpecialFolderConst) => Folder;
|
||||
GetStandardStream: (StandardStreamType: StandardStreamTypes, Unicode?: boolean) => TextStream;
|
||||
GetTempName: () => string;
|
||||
MoveFile: (Source: string, Destination: string) => void;
|
||||
MoveFolder: (Source: string, Destination: string) => void;
|
||||
OpenTextFile: (FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate) => TextStream;
|
||||
}
|
||||
|
||||
interface Folder {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Files: Files;
|
||||
IsRootFolder: boolean;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
SubFolders: Folders;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Folders {
|
||||
Add: (Name: string) => Folder;
|
||||
Count: number;
|
||||
Item: (Key: any) => Folder;
|
||||
}
|
||||
|
||||
interface TextStream {
|
||||
AtEndOfLine: boolean;
|
||||
AtEndOfStream: boolean;
|
||||
Close: () => void;
|
||||
Column: number;
|
||||
Line: number;
|
||||
Read: (Characters: number) => string;
|
||||
ReadAll: () => string;
|
||||
ReadLine: () => string;
|
||||
Skip: (Characters: number) => void;
|
||||
SkipLine: () => void;
|
||||
Write: (Text: string) => void;
|
||||
WriteBlankLines: (Lines: number) => void;
|
||||
WriteLine: (Text?: string) => void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'Scripting.Dictionary'): Scripting.Dictionary;
|
||||
new (progID: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
|
||||
new (progID: 'Scripting.Encoder'): Scripting.Encoder;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/// <reference path="microsoft-windows-image-acquisition.d.ts" />
|
||||
|
||||
//source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
|
||||
|
||||
|
||||
//Convert a file
|
||||
var commonDialog = new ActiveXObject('WIA.CommonDialog');
|
||||
var img = commonDialog.ShowAcquireImage();
|
||||
if (img.FormatID != WIA.FormatID.wiaFormatJPEG) {
|
||||
var ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item("FormatID").Value = WIA.FormatID.wiaFormatJPEG;
|
||||
img = ip.Apply(img);
|
||||
}
|
||||
|
||||
|
||||
//Take a picture
|
||||
var dev = commonDialog.ShowSelectDevice();
|
||||
if (dev.Type == WIA.WiaDeviceType.CameraDeviceType) {
|
||||
var itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
}
|
||||
|
||||
|
||||
//Display detailed property information
|
||||
dev = commonDialog.ShowSelectDevice();
|
||||
var e = new Enumerator<WIA.Property>(dev.Properties); //no foreach over ActiveX collections
|
||||
e.moveFirst();
|
||||
while (!e.atEnd()) {
|
||||
var p = e.item();
|
||||
var s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
if (p.IsVector) {
|
||||
s += '[vector of data]';
|
||||
} else {
|
||||
s += p.Value;
|
||||
if (p.SubType != WIA.WiaSubType.UnspecifiedSubType) {
|
||||
if (p.Value != p.SubTypeDefault) {
|
||||
s += ' (Default = ' + p.SubTypeDefault + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p.IsReadOnly) {
|
||||
s += ' [READ ONLY]';
|
||||
} else {
|
||||
switch (p.SubType) {
|
||||
case WIA.WiaSubType.FlagSubType:
|
||||
case WIA.WiaSubType.ListSubType:
|
||||
if (p.SubType == WIA.WiaSubType.FlagSubType) {
|
||||
s += ' [valid flags include: ';
|
||||
} else {
|
||||
s += ' [valid values include: ';
|
||||
}
|
||||
var count = p.SubTypeValues.Count;
|
||||
for (var i = 1; i <= count; i++) {
|
||||
s += p.SubTypeValues.Item(i);
|
||||
if (i < count) {
|
||||
s += ', ';
|
||||
}
|
||||
}
|
||||
s += ']';
|
||||
break;
|
||||
case WIA.WiaSubType.RangeSubType:
|
||||
s += ' [valid values in the range from ' + p.SubTypeMin + ' to ' + p.SubTypeMax + ' in increments of ' + p.SubTypeStep + ']';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (WScript) {
|
||||
WScript.Echo(s);
|
||||
} else if (window) {
|
||||
window.alert(s);
|
||||
}
|
||||
}
|
||||
+380
@@ -0,0 +1,380 @@
|
||||
// Type definitions for Microsoft Windows Image Acquisition
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630827(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="jscript-extensions.d.ts" />
|
||||
|
||||
declare namespace WIA {
|
||||
|
||||
//Enums
|
||||
type CommandID =
|
||||
"{04E725B0-ACAE-11D2-A093-00C04F72DC3C}" //wiaCommandChangeDocument
|
||||
| "{E208C170-ACAD-11D2-A093-00C04F72DC3C}" //wiaCommandDeleteAllItems
|
||||
| "{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}" //wiaCommandSynchronize
|
||||
| "{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}" //wiaCommandTakePicture
|
||||
| "{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}" //wiaCommandUnloadDocument
|
||||
const CommandID: {
|
||||
wiaCommandChangeDocument: CommandID,
|
||||
wiaCommandDeleteAllItems: CommandID,
|
||||
wiaCommandSynchronize: CommandID,
|
||||
wiaCommandTakePicture: CommandID,
|
||||
wiaCommandUnloadDocument: CommandID
|
||||
}
|
||||
|
||||
type EventID =
|
||||
"{A28BBADE-64B6-11D2-A231-00C04FA31809}" //wiaEventDeviceConnected
|
||||
| "{143E4E83-6497-11D2-A231-00C04FA31809}" //wiaEventDeviceDisconnected
|
||||
| "{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}" //wiaEventItemCreated
|
||||
| "{1D22A559-E14F-11D2-B326-00C04F68CE61}" //wiaEventItemDeleted
|
||||
| "{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}" //wiaEventScanEmailImage
|
||||
| "{C00EB793-8C6E-11D2-977A-0000F87A926F}" //wiaEventScanFaxImage
|
||||
| "{9B2B662C-6185-438C-B68B-E39EE25E71CB}" //wiaEventScanFilmImage
|
||||
| "{A6C5A715-8C6E-11D2-977A-0000F87A926F}" //wiaEventScanImage
|
||||
| "{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}" //wiaEventScanImage2
|
||||
| "{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}" //wiaEventScanImage3
|
||||
| "{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}" //wiaEventScanImage4
|
||||
| "{9D095B89-37D6-4877-AFED-62A297DC6DBE}" //wiaEventScanOCRImage
|
||||
| "{B441F425-8C6E-11D2-977A-0000F87A926F}" //wiaEventScanPrintImage
|
||||
const EventID: {
|
||||
wiaEventDeviceConnected: EventID,
|
||||
wiaEventDeviceDisconnected: EventID,
|
||||
wiaEventItemCreated: EventID,
|
||||
wiaEventItemDeleted: EventID,
|
||||
wiaEventScanEmailImage: EventID,
|
||||
wiaEventScanFaxImage: EventID,
|
||||
wiaEventScanFilmImage: EventID,
|
||||
wiaEventScanImage: EventID,
|
||||
wiaEventScanImage2: EventID,
|
||||
wiaEventScanImage3: EventID,
|
||||
wiaEventScanImage4: EventID,
|
||||
wiaEventScanOCRImage: EventID,
|
||||
wiaEventScanPrintImage: EventID
|
||||
}
|
||||
|
||||
type FormatID =
|
||||
"{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}" //wiaFormatBMP
|
||||
| "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}" //wiaFormatGIF
|
||||
| "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}" //wiaFormatJPEG
|
||||
| "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}" //wiaFormatPNG
|
||||
| "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}" //wiaFormatTIFF
|
||||
const FormatID: {
|
||||
wiaFormatBMP: FormatID,
|
||||
wiaFormatGIF: FormatID,
|
||||
wiaFormatJPEG: FormatID,
|
||||
wiaFormatPNG: FormatID,
|
||||
wiaFormatTIFF: FormatID
|
||||
}
|
||||
|
||||
type Miscellaneous =
|
||||
"*" //wiaAnyDeviceID
|
||||
| "{00000000-0000-0000-0000-000000000000}" //wiaIDUnknown
|
||||
const Miscellaneous: {
|
||||
wiaAnyDeviceID: Miscellaneous,
|
||||
wiaIDUnknown: Miscellaneous
|
||||
}
|
||||
|
||||
const enum WiaDeviceType {
|
||||
CameraDeviceType = 2,
|
||||
ScannerDeviceType = 1,
|
||||
UnspecifiedDeviceType = 0,
|
||||
VideoDeviceType = 3
|
||||
}
|
||||
|
||||
const enum WiaEventFlag {
|
||||
ActionEvent = 2,
|
||||
NotificationEvent = 1
|
||||
}
|
||||
|
||||
const enum WiaImageBias {
|
||||
MaximizeQuality = 131072,
|
||||
MinimizeSize = 65536
|
||||
}
|
||||
|
||||
const enum WiaImageIntent {
|
||||
ColorIntent = 1,
|
||||
GrayscaleIntent = 2,
|
||||
TextIntent = 4,
|
||||
UnspecifiedIntent = 0
|
||||
}
|
||||
|
||||
const enum WiaImagePropertyType {
|
||||
ByteImagePropertyType = 1001,
|
||||
LongImagePropertyType = 1004,
|
||||
RationalImagePropertyType = 1006,
|
||||
StringImagePropertyType = 1002,
|
||||
UndefinedImagePropertyType = 1000,
|
||||
UnsignedIntegerImagePropertyType = 1003,
|
||||
UnsignedLongImagePropertyType = 1005,
|
||||
UnsignedRationalImagePropertyType = 1007,
|
||||
VectorOfBytesImagePropertyType = 1101,
|
||||
VectorOfLongsImagePropertyType = 1103,
|
||||
VectorOfRationalsImagePropertyType = 1105,
|
||||
VectorOfUndefinedImagePropertyType = 1100,
|
||||
VectorOfUnsignedIntegersImagePropertyType = 1102,
|
||||
VectorOfUnsignedLongsImagePropertyType = 1104,
|
||||
VectorOfUnsignedRationalsImagePropertyType = 1106
|
||||
}
|
||||
|
||||
const enum WiaItemFlag {
|
||||
AnalyzeItemFlag = 16,
|
||||
AudioItemFlag = 32,
|
||||
BurstItemFlag = 2048,
|
||||
DeletedItemFlag = 128,
|
||||
DeviceItemFlag = 64,
|
||||
DisconnectedItemFlag = 256,
|
||||
FileItemFlag = 2,
|
||||
FolderItemFlag = 4,
|
||||
FreeItemFlag = 0,
|
||||
GeneratedItemFlag = 16384,
|
||||
HasAttachmentsItemFlag = 32768,
|
||||
HPanoramaItemFlag = 512,
|
||||
ImageItemFlag = 1,
|
||||
RemovedItemFlag = -2147483648,
|
||||
RootItemFlag = 8,
|
||||
StorageItemFlag = 4096,
|
||||
TransferItemFlag = 8192,
|
||||
VideoItemFlag = 65536,
|
||||
VPanoramaItemFlag = 1024
|
||||
}
|
||||
|
||||
const enum WiaPropertyType {
|
||||
BooleanPropertyType = 1,
|
||||
BytePropertyType = 2,
|
||||
ClassIDPropertyType = 15,
|
||||
CurrencyPropertyType = 12,
|
||||
DatePropertyType = 13,
|
||||
DoublePropertyType = 11,
|
||||
ErrorCodePropertyType = 7,
|
||||
FileTimePropertyType = 14,
|
||||
HandlePropertyType = 18,
|
||||
IntegerPropertyType = 3,
|
||||
LargeIntegerPropertyType = 8,
|
||||
LongPropertyType = 5,
|
||||
ObjectPropertyType = 17,
|
||||
SinglePropertyType = 10,
|
||||
StringPropertyType = 16,
|
||||
UnsignedIntegerPropertyType = 4,
|
||||
UnsignedLargeIntegerPropertyType = 9,
|
||||
UnsignedLongPropertyType = 6,
|
||||
UnsupportedPropertyType = 0,
|
||||
VariantPropertyType = 19,
|
||||
VectorOfBooleansPropertyType = 101,
|
||||
VectorOfBytesPropertyType = 102,
|
||||
VectorOfClassIDsPropertyType = 115,
|
||||
VectorOfCurrenciesPropertyType = 112,
|
||||
VectorOfDatesPropertyType = 113,
|
||||
VectorOfDoublesPropertyType = 111,
|
||||
VectorOfErrorCodesPropertyType = 107,
|
||||
VectorOfFileTimesPropertyType = 114,
|
||||
VectorOfIntegersPropertyType = 103,
|
||||
VectorOfLargeIntegersPropertyType = 108,
|
||||
VectorOfLongsPropertyType = 105,
|
||||
VectorOfSinglesPropertyType = 110,
|
||||
VectorOfStringsPropertyType = 116,
|
||||
VectorOfUnsignedIntegersPropertyType = 104,
|
||||
VectorOfUnsignedLargeIntegersPropertyType = 109,
|
||||
VectorOfUnsignedLongsPropertyType = 106,
|
||||
VectorOfVariantsPropertyType = 119
|
||||
}
|
||||
|
||||
const enum WiaSubType {
|
||||
FlagSubType = 3,
|
||||
ListSubType = 2,
|
||||
RangeSubType = 1,
|
||||
UnspecifiedSubType = 0
|
||||
}
|
||||
|
||||
//Classes
|
||||
interface CommonDialog {
|
||||
ShowAcquireImage: (DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => ImageFile;
|
||||
ShowAcquisitionWizard: (Device: Device) => any;
|
||||
ShowDeviceProperties: (Device: Device, CancelError?: boolean) => void;
|
||||
ShowItemProperties: (Item: Item, CancelError?: boolean) => void;
|
||||
ShowPhotoPrintingWizard: (Files: any) => void;
|
||||
ShowSelectDevice: (DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean) => Device;
|
||||
ShowSelectItems: (Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => Items;
|
||||
ShowTransfer: (Item: Item, FormatID?: string, CancelError?: boolean) => any;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
Commands: DeviceCommands;
|
||||
DeviceID: string;
|
||||
Events: DeviceEvents;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
GetItem: (ItemID: string) => Item;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface DeviceCommand {
|
||||
CommandID: string;
|
||||
Description: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface DeviceCommands {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceCommand;
|
||||
}
|
||||
|
||||
interface DeviceEvent {
|
||||
Description: string;
|
||||
EventID: string;
|
||||
Name: string;
|
||||
Type: WiaEventFlag;
|
||||
}
|
||||
|
||||
interface DeviceEvents {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceEvent;
|
||||
}
|
||||
|
||||
interface DeviceInfo {
|
||||
Connect: () => Device;
|
||||
DeviceID: string;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
}
|
||||
|
||||
interface DeviceInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => DeviceInfo;
|
||||
}
|
||||
|
||||
interface DeviceManager {
|
||||
DeviceInfos: DeviceInfos;
|
||||
RegisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
RegisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
UnregisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
UnregisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
Properties: Properties;
|
||||
}
|
||||
|
||||
interface FilterInfo {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface FilterInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => FilterInfo;
|
||||
}
|
||||
|
||||
interface Filters {
|
||||
Add: (FilterID: string, Index?: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Filter;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Formats {
|
||||
Count: number;
|
||||
Item: (Index: number) => string;
|
||||
}
|
||||
|
||||
interface ImageFile {
|
||||
ActiveFrame: number;
|
||||
ARGBData: Vector;
|
||||
FileData: Vector;
|
||||
FileExtension: string;
|
||||
FormatID: string;
|
||||
FrameCount: number;
|
||||
Height: number;
|
||||
HorizontalResolution: number;
|
||||
IsAlphaPixelFormat: boolean;
|
||||
IsAnimated: boolean;
|
||||
IsExtendedPixelFormat: boolean;
|
||||
IsIndexedPixelFormat: boolean;
|
||||
LoadFile: (Filename: string) => void;
|
||||
PixelDepth: number;
|
||||
Properties: Properties;
|
||||
SaveFile: (Filename: string) => void;
|
||||
VerticalResolution: number;
|
||||
Width: number;
|
||||
}
|
||||
|
||||
interface ImageProcess {
|
||||
Apply: (Source: ImageFile) => ImageFile;
|
||||
FilterInfos: FilterInfos;
|
||||
Filters: Filters;
|
||||
}
|
||||
|
||||
interface Item {
|
||||
Commands: DeviceCommands;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
Formats: Formats;
|
||||
ItemID: string;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Transfer: (FormatID?: string) => any;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface Items {
|
||||
Add: (Name: string, Flags: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Item;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
Count: number;
|
||||
Exists: (Index: any) => boolean;
|
||||
Item: (Index: any) => Property;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
IsReadOnly: boolean;
|
||||
IsVector: boolean;
|
||||
Name: string;
|
||||
PropertyID: number;
|
||||
SubType: WiaSubType;
|
||||
SubTypeDefault: any;
|
||||
SubTypeMax: number;
|
||||
SubTypeMin: number;
|
||||
SubTypeStep: number;
|
||||
SubTypeValues: Vector;
|
||||
Type: number;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Rational {
|
||||
Denominator: number;
|
||||
Numerator: number;
|
||||
Value: number;
|
||||
}
|
||||
|
||||
interface Vector {
|
||||
Add: (Value: any, Index?: number) => void;
|
||||
BinaryData: any;
|
||||
Clear: () => void;
|
||||
Count: number;
|
||||
Date: VarDate;
|
||||
ImageFile: (Width?: number, Height?: number) => ImageFile;
|
||||
Item: (Index: number) => any //Also has setter with parameters;
|
||||
Picture: (Width?: number, Height?: number) => any;
|
||||
Remove: (Index: number) => any;
|
||||
SetFromString: (Value: string, Resizable?: boolean, Unicode?: boolean) => void;
|
||||
String: (Unicode?: boolean) => string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'WIA.Rational'): WIA.Rational;
|
||||
new (progID: 'WIA.Vector'): WIA.Vector;
|
||||
new (progID: 'WIA.ImageFile'): WIA.ImageFile;
|
||||
new (progID: 'WIA.ImageProcess'): WIA.ImageProcess;
|
||||
new (progID: 'WIA.CommonDialog'): WIA.CommonDialog;
|
||||
new (progID: 'WIA.DeviceManager'): WIA.DeviceManager;
|
||||
}
|
||||
Reference in New Issue
Block a user