From ed48fab28e2f91d244fbc2b1fa3034fe5a54fa02 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sun, 25 Jun 2017 23:03:34 +0200 Subject: [PATCH 01/17] Updated existing activex definitions --- .../activex-adodb-tests.ts} | 12 + .../index.d.ts | 433 +++++++---- types/activex-adodb/package.json | 1 + .../tsconfig.json | 13 +- types/activex-adodb/tslint.json | 1 + types/activex-scripting-runtime/index.d.ts | 205 ------ .../activex-scripting-tests.ts | 64 ++ .../activex-scripting.ts} | 0 types/activex-scripting/index.d.ts | 513 +++++++++++++ types/activex-scripting/package.json | 1 + .../tsconfig.json | 13 +- types/activex-scripting/tslint.json | 1 + .../activex-wia-tests.ts} | 6 +- types/activex-wia/index.d.ts | 697 ++++++++++++++++++ types/activex-wia/package.json | 1 + .../tsconfig.json | 13 +- types/activex-wia/tslint.json | 1 + .../index.d.ts | 379 ---------- 18 files changed, 1598 insertions(+), 756 deletions(-) rename types/{activex-data-objects/activex-data-objects-tests.ts => activex-adodb/activex-adodb-tests.ts} (69%) rename types/{activex-data-objects => activex-adodb}/index.d.ts (52%) create mode 100644 types/activex-adodb/package.json rename types/{activex-data-objects => activex-adodb}/tsconfig.json (55%) create mode 100644 types/activex-adodb/tslint.json delete mode 100644 types/activex-scripting-runtime/index.d.ts create mode 100644 types/activex-scripting/activex-scripting-tests.ts rename types/{activex-scripting-runtime/activex-scripting-runtime-tests.ts => activex-scripting/activex-scripting.ts} (100%) create mode 100644 types/activex-scripting/index.d.ts create mode 100644 types/activex-scripting/package.json rename types/{activex-scripting-runtime => activex-scripting}/tsconfig.json (54%) create mode 100644 types/activex-scripting/tslint.json rename types/{activex-windows-image-acquisition/activex-windows-image-acquisition-tests.ts => activex-wia/activex-wia-tests.ts} (95%) create mode 100644 types/activex-wia/index.d.ts create mode 100644 types/activex-wia/package.json rename types/{activex-windows-image-acquisition => activex-wia}/tsconfig.json (53%) create mode 100644 types/activex-wia/tslint.json delete mode 100644 types/activex-windows-image-acquisition/index.d.ts diff --git a/types/activex-data-objects/activex-data-objects-tests.ts b/types/activex-adodb/activex-adodb-tests.ts similarity index 69% rename from types/activex-data-objects/activex-data-objects-tests.ts rename to types/activex-adodb/activex-adodb-tests.ts index 6298298a48..341bf83108 100644 --- a/types/activex-data-objects/activex-data-objects-tests.ts +++ b/types/activex-adodb/activex-adodb-tests.ts @@ -1,3 +1,15 @@ +let obj0 = new ActiveXObject('ADODB.Command'); + +let obj1 = new ActiveXObject('ADODB.Connection'); + +let obj2 = new ActiveXObject('ADODB.Parameter'); + +let obj3 = new ActiveXObject('ADODB.Record'); + +let obj4 = new ActiveXObject('ADODB.Recordset'); + +let obj5 = new ActiveXObject('ADODB.Stream'); + //open connection to an Excel file var pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx'; var conn = new ActiveXObject('ADODB.Connection'); diff --git a/types/activex-data-objects/index.d.ts b/types/activex-adodb/index.d.ts similarity index 52% rename from types/activex-data-objects/index.d.ts rename to types/activex-adodb/index.d.ts index d3ccf7a6c7..8d6190363a 100644 --- a/types/activex-data-objects/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,8 +1,7 @@ -// Type definitions for Microsoft ActiveX Data Objects -// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms675532(v=vs.85).aspx -// Definitions by: Zev Spitz +// Type definitions for ADODB - +// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx +// Defintions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace ADODB { //Enums @@ -598,237 +597,391 @@ declare namespace ADODB { //Interfaces interface Command { ActiveConnection: Connection; - Cancel: () => void; - CommandStream: any /*VT_UNKNOWN*/; + Cancel(): void; + CommandStream: any; CommandText: string; CommandTimeout: number; CommandType: CommandTypeEnum; - CreateParameter: (Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any) => Parameter; + + /** + * @param string [Name=''] + * @param ADODB.DataTypeEnum [Type=0] + * @param ADODB.ParameterDirectionEnum [Direction=1] + * @param number [Size=0] + */ + CreateParameter(Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any): Parameter; Dialect: string; - Execute: (RecordsAffected?: any, Parameters?: any, Options?: number) => Recordset; + + /** @param number [Options=-1] */ + Execute(RecordsAffected?: any, Parameters?: any[], Options?: number): Recordset; Name: string; NamedParameters: boolean; - Parameters: Parameters; + readonly Parameters: Parameters; Prepared: boolean; - Properties: Properties; - State: number; + readonly Properties: Properties; + readonly State: number; } interface Connection { Attributes: number; - BeginTrans: () => number; - Cancel: () => void; - Close: () => void; + BeginTrans(): number; + Cancel(): void; + Close(): void; CommandTimeout: number; - CommitTrans: () => void; + CommitTrans(): void; ConnectionString: string; ConnectionTimeout: number; CursorLocation: CursorLocationEnum; DefaultDatabase: string; - Errors: Errors; - Execute: (CommandText: string, RecordsAffected: any, Options?: number) => Recordset; + readonly Errors: Errors; + + /** @param number [Options=-1] */ + Execute(CommandText: string, RecordsAffected: any, Options?: number): Recordset; IsolationLevel: IsolationLevelEnum; Mode: ConnectModeEnum; - Open: (ConnectionString?: string, UserID?: string, Password?: string, Options?: number) => void; - OpenSchema: (Schema: SchemaEnum, Restrictions?: any, SchemaID?: any) => Recordset; - Properties: Properties; + + /** + * @param string [ConnectionString=''] + * @param string [UserID=''] + * @param string [Password=''] + * @param number [Options=-1] + */ + Open(ConnectionString?: string, UserID?: string, Password?: string, Options?: number): void; + OpenSchema(Schema: SchemaEnum, Restrictions?: any, SchemaID?: any): Recordset; + readonly Properties: Properties; Provider: string; - RollbackTrans: () => void; - State: number; - Version: string; + RollbackTrans(): void; + readonly State: number; + readonly Version: string; } interface Error { - Description: string; - HelpContext: number; - HelpFile: string; - NativeError: number; - Number: number; - Source: string; - SQLState: string; + readonly Description: string; + readonly HelpContext: number; + readonly HelpFile: string; + readonly NativeError: number; + readonly Number: number; + readonly Source: string; + readonly SQLState: string; } interface Errors { - Clear: () => void; - Count: number; - Item: (Index: any) => Error; - Refresh: () => void; + Clear(): void; + readonly Count: number; + Item(Index: any): Error; + Refresh(): void; } interface Field { - ActualSize: number; - AppendChunk: (Data: any) => void; + readonly ActualSize: number; + AppendChunk(Data: any): void; Attributes: number; - DataFormat: any /*VT_UNKNOWN*/; + DataFormat: any; DefinedSize: number; - GetChunk: (Length: number) => any; - Name: string; + GetChunk(Length: number): any; + readonly Name: string; NumericScale: number; - OriginalValue: any; + readonly OriginalValue: any; Precision: number; - Properties: Properties; - Status: number; + readonly Properties: Properties; + readonly Status: number; Type: DataTypeEnum; - UnderlyingValue: any; + readonly UnderlyingValue: any; Value: any; } interface Fields { - _Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum) => void; - Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any) => void; - CancelUpdate: () => void; - Count: number; - Delete: (Index: any) => void; - Item: (Index: any) => Field; - Refresh: () => void; - Resync: (ResyncValues?: ResyncEnum) => void; - Update: () => void; + + /** + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ + _Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum): void; + + /** + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ + Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any): void; + CancelUpdate(): void; + readonly Count: number; + Delete(Index: any): void; + Item(Index: any): Field; + Refresh(): void; + + /** @param ADODB.ResyncEnum [ResyncValues=2] */ + Resync(ResyncValues?: ResyncEnum): void; + Update(): void; } interface Parameter { - AppendChunk: (Val: any) => void; + AppendChunk(Val: any): void; Attributes: number; Direction: ParameterDirectionEnum; Name: string; NumericScale: number; Precision: number; - Properties: Properties; + readonly Properties: Properties; Size: number; Type: DataTypeEnum; Value: any; } interface Parameters { - Append: (Object: any /*VT_DISPATCH*/) => void; - Count: number; - Delete: (Index: any) => void; - Item: (Index: any) => Parameter; - Refresh: () => void; + Append(Object: any): void; + readonly Count: number; + Delete(Index: any): void; + Item(Index: any): Parameter; + Refresh(): void; } interface Properties { - Count: number; - Item: (Index: any) => Property; - Refresh: () => void; + readonly Count: number; + Item(Index: any): Property; + Refresh(): void; } interface Property { Attributes: number; - Name: string; - Type: DataTypeEnum; + readonly Name: string; + readonly Type: DataTypeEnum; Value: any; } interface Record { ActiveConnection: any; - Cancel: () => void; - Close: () => void; - CopyRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean) => string; - DeleteRecord: (Source?: string, Async?: boolean) => void; - Fields: Fields; - GetChildren: () => Recordset; + Cancel(): void; + Close(): void; + + /** + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.CopyRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ + CopyRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean): string; + + /** + * @param string [Source=''] + * @param boolean [Async=false] + */ + DeleteRecord(Source?: string, Async?: boolean): void; + readonly Fields: Fields; + GetChildren(): Recordset; Mode: ConnectModeEnum; - MoveRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean) => string; - Open: (Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string) => void; - ParentURL: string; - Properties: Properties; - RecordType: RecordTypeEnum; + + /** + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.MoveRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ + MoveRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean): string; + + /** + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1] + * @param ADODB.RecordOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ + Open(Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string): void; + readonly ParentURL: string; + readonly Properties: Properties; + readonly RecordType: RecordTypeEnum; Source: any; - State: ObjectStateEnum; + readonly State: ObjectStateEnum; } interface Recordset { - _xClone: () => Recordset; - _xResync: (AffectRecords?: AffectEnum) => void; - _xSave: (FileName?: string, PersistFormat?: PersistFormatEnum) => void; + _xClone(): Recordset; + + /** @param ADODB.AffectEnum [AffectRecords=3] */ + _xResync(AffectRecords?: AffectEnum): void; + + /** + * @param string [FileName=''] + * @param ADODB.PersistFormatEnum [PersistFormat=0] + */ + _xSave(FileName?: string, PersistFormat?: PersistFormatEnum): void; AbsolutePage: PositionEnum; AbsolutePosition: PositionEnum; - ActiveCommand: any /*VT_DISPATCH*/; - ActiveConnection: any /*VT_DISPATCH*/; - AddNew: (FieldList?: any, Values?: any) => void; - BOF: boolean; + readonly ActiveCommand: any; + ActiveConnection: any; + AddNew(FieldList?: any, Values?: any): void; + readonly BOF: boolean; Bookmark: any; CacheSize: number; - Cancel: () => void; - CancelBatch: (AffectRecords?: AffectEnum) => void; - CancelUpdate: () => void; - Clone: (LockType?: LockTypeEnum) => Recordset; - Close: () => void; - Collect: (Index: any) => any; //Also has setter with parameters - CompareBookmarks: (Bookmark1: any, Bookmark2: any) => CompareEnum; + Cancel(): void; + + /** @param ADODB.AffectEnum [AffectRecords=3] */ + CancelBatch(AffectRecords?: AffectEnum): void; + CancelUpdate(): void; + + /** @param ADODB.LockTypeEnum [LockType=-1] */ + Clone(LockType?: LockTypeEnum): Recordset; + Close(): void; + Collect(Index: any): any; + CompareBookmarks(Bookmark1: any, Bookmark2: any): CompareEnum; CursorLocation: CursorLocationEnum; CursorType: CursorTypeEnum; DataMember: string; - DataSource: any /*VT_UNKNOWN*/; - Delete: (AffectRecords?: AffectEnum) => void; - EditMode: EditModeEnum; - EOF: boolean; - Fields: Fields; + DataSource: any; + + /** @param ADODB.AffectEnum [AffectRecords=1] */ + Delete(AffectRecords?: AffectEnum): void; + readonly EditMode: EditModeEnum; + readonly EOF: boolean; + readonly Fields: Fields; Filter: any; - Find: (Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any) => void; - GetRows: (Rows?: number, Start?: any, Fields?: any) => any; - GetString: (StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string) => string; + + /** + * @param number [SkipRecords=0] + * @param ADODB.SearchDirectionEnum [SearchDirection=1] + */ + Find(Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any): void; + + /** @param number [Rows=-1] */ + GetRows(Rows?: number, Start?: any, Fields?: any): any; + + /** + * @param ADODB.StringFormatEnum [StringFormat=2] + * @param number [NumRows=-1] + * @param string [ColumnDelimeter=''] + * @param string [RowDelimeter=''] + * @param string [NullExpr=''] + */ + GetString(StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string): string; Index: string; LockType: LockTypeEnum; MarshalOptions: MarshalOptionsEnum; MaxRecords: number; - Move: (NumRecords: number, Start?: any) => void; - MoveFirst: () => void; - MoveLast: () => void; - MoveNext: () => void; - MovePrevious: () => void; - NextRecordset: (RecordsAffected?: any) => Recordset; - Open: (Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number) => void; - PageCount: number; + Move(NumRecords: number, Start?: any): void; + MoveFirst(): void; + MoveLast(): void; + MoveNext(): void; + MovePrevious(): void; + NextRecordset(RecordsAffected?: any): Recordset; + + /** + * @param ADODB.CursorTypeEnum [CursorType=-1] + * @param ADODB.LockTypeEnum [LockType=-1] + * @param number [Options=-1] + */ + Open(Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number): void; + readonly PageCount: number; PageSize: number; - Properties: Properties; - RecordCount: number; - Requery: (Options?: number) => void; - Resync: (AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum) => void; - Save: (Destination: any, PersistFormat?: PersistFormatEnum) => void; - Seek: (KeyValues: any, SeekOption?: SeekEnum) => void; + readonly Properties: Properties; + readonly RecordCount: number; + + /** @param number [Options=-1] */ + Requery(Options?: number): void; + + /** + * @param ADODB.AffectEnum [AffectRecords=3] + * @param ADODB.ResyncEnum [ResyncValues=2] + */ + Resync(AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum): void; + + /** @param ADODB.PersistFormatEnum [PersistFormat=0] */ + Save(Destination: any, PersistFormat?: PersistFormatEnum): void; + + /** @param ADODB.SeekEnum [SeekOption=1] */ + Seek(KeyValues: any, SeekOption?: SeekEnum): void; Sort: string; - Source: any /*VT_DISPATCH*/; - State: number; - Status: number; + Source: any; + readonly State: number; + readonly Status: number; StayInSync: boolean; - Supports: (CursorOptions: CursorOptionEnum) => boolean; - Update: (Fields?: any, Values?: any) => void; - UpdateBatch: (AffectRecords?: AffectEnum) => void; + Supports(CursorOptions: CursorOptionEnum): boolean; + Update(Fields?: any, Values?: any): void; + + /** @param ADODB.AffectEnum [AffectRecords=3] */ + UpdateBatch(AffectRecords?: AffectEnum): void; } interface Stream { - Cancel: () => void; + Cancel(): void; Charset: string; - Close: () => void; - CopyTo: (DestStream: Stream, CharNumber?: number) => void; - EOS: boolean; - Flush: () => void; + Close(): void; + + /** @param number [CharNumber=-1] */ + CopyTo(DestStream: Stream, CharNumber?: number): void; + readonly EOS: boolean; + Flush(): void; LineSeparator: LineSeparatorEnum; - LoadFromFile: (FileName: string) => void; + LoadFromFile(FileName: string): void; Mode: ConnectModeEnum; - Open: (Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string) => void; + + /** + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.StreamOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ + Open(Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string): void; Position: number; - Read: (NumBytes?: number) => any; - ReadText: (NumChars?: number) => string; - SaveToFile: (FileName: string, Options?: SaveOptionsEnum) => void; - SetEOS: () => void; - Size: number; - SkipLine: () => void; - State: ObjectStateEnum; + + /** @param number [NumBytes=-1] */ + Read(NumBytes?: number): any; + + /** @param number [NumChars=-1] */ + ReadText(NumChars?: number): string; + + /** @param ADODB.SaveOptionsEnum [Options=1] */ + SaveToFile(FileName: string, Options?: SaveOptionsEnum): void; + SetEOS(): void; + readonly Size: number; + SkipLine(): void; + readonly State: ObjectStateEnum; Type: StreamTypeEnum; - Write: (Buffer: any) => void; - WriteText: (Data: string, Options?: StreamWriteEnum) => void; + Write(Buffer: any): void; + + /** @param ADODB.StreamWriteEnum [Options=0] */ + WriteText(Data: string, Options?: StreamWriteEnum): void; } } +//Global interfaces interface ActiveXObject { - new (progID: 'ADODB.Connection'): ADODB.Connection; - new (progID: 'ADODB.Record'): ADODB.Record; - new (progID: 'ADODB.Stream'): ADODB.Stream; - new (progID: 'ADODB.Command'): ADODB.Command; - new (progID: 'ADODB.Recordset'): ADODB.Recordset; - new (progID: 'ADODB.Parameter'): ADODB.Parameter; + on(obj: ADODB.Connection, eventName: 'BeginTransComplete', eventArgs: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'CommitTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'ConnectComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'Disconnect', eventArgs: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'ExecuteComplete', eventArgs: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'InfoMessage', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'RollbackTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'WillConnect', eventArgs: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, eventName: 'WillExecute', eventArgs: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Recordset, eventName: 'EndOfRecordset', eventArgs: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'FetchComplete', eventArgs: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'FetchProgress', eventArgs: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'FieldChangeComplete', eventArgs: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'MoveComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'RecordChangeComplete', eventArgs: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'RecordsetChangeComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'WillChangeField', eventArgs: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'WillChangeRecord', eventArgs: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'WillChangeRecordset', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, eventName: 'WillMove', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void; + new(progid: 'ADODB.Command'): ADODB.Command; + new(progid: 'ADODB.Connection'): ADODB.Connection; + new(progid: 'ADODB.Parameter'): ADODB.Parameter; + new(progid: 'ADODB.Record'): ADODB.Record; + new(progid: 'ADODB.Recordset'): ADODB.Recordset; + new(progid: 'ADODB.Stream'): ADODB.Stream; +} + +interface EnumeratorConstructor { + new(col: ADODB.Errors): ADODB.Error; + new(col: ADODB.Fields): ADODB.Field; + new(col: ADODB.Parameters): ADODB.Parameter; + new(col: ADODB.Properties): ADODB.Property; } diff --git a/types/activex-adodb/package.json b/types/activex-adodb/package.json new file mode 100644 index 0000000000..d798f99261 --- /dev/null +++ b/types/activex-adodb/package.json @@ -0,0 +1 @@ +{ "dependencies": { "activex-helpers": "*"}} \ No newline at end of file diff --git a/types/activex-data-objects/tsconfig.json b/types/activex-adodb/tsconfig.json similarity index 55% rename from types/activex-data-objects/tsconfig.json rename to types/activex-adodb/tsconfig.json index aa81742f09..22b6f9e045 100644 --- a/types/activex-data-objects/tsconfig.json +++ b/types/activex-adodb/tsconfig.json @@ -1,14 +1,9 @@ + { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom", - "scripthost" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, + "lib": ["scripthost"], + "strict": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,6 +14,6 @@ }, "files": [ "index.d.ts", - "activex-data-objects-tests.ts" + "activex-adodb-tests.ts" ] } \ No newline at end of file diff --git a/types/activex-adodb/tslint.json b/types/activex-adodb/tslint.json new file mode 100644 index 0000000000..1d0e17119e --- /dev/null +++ b/types/activex-adodb/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint / dt.json" } \ No newline at end of file diff --git a/types/activex-scripting-runtime/index.d.ts b/types/activex-scripting-runtime/index.d.ts deleted file mode 100644 index 54065e1bd7..0000000000 --- a/types/activex-scripting-runtime/index.d.ts +++ /dev/null @@ -1,205 +0,0 @@ -// Type definitions for Microsoft Scripting Runtime -// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx -// Definitions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -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 - } - - //Interfaces - 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; -} - diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts new file mode 100644 index 0000000000..6b460f6347 --- /dev/null +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -0,0 +1,64 @@ +//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 + '
'; + 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); +}; \ No newline at end of file diff --git a/types/activex-scripting-runtime/activex-scripting-runtime-tests.ts b/types/activex-scripting/activex-scripting.ts similarity index 100% rename from types/activex-scripting-runtime/activex-scripting-runtime-tests.ts rename to types/activex-scripting/activex-scripting.ts diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts new file mode 100644 index 0000000000..55bf6bd661 --- /dev/null +++ b/types/activex-scripting/index.d.ts @@ -0,0 +1,513 @@ +// Type definitions for Scripting - +// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx +// Defintions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare namespace Scripting { + + //Enums + const enum __MIDL___MIDL_itf_scrrun_0000_0000_0001 { + Alias = 1024, + Archive = 32, + Compressed = 2048, + Directory = 16, + Hidden = 2, + Normal = 0, + ReadOnly = 1, + System = 4, + Volume = 8 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0001 { + CDRom = 4, + Fixed = 2, + RamDisk = 5, + Remote = 3, + Removable = 1, + UnknownType = 0 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0002 { + SystemFolder = 1, + TemporaryFolder = 2, + WindowsFolder = 0 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0003 { + StdErr = 2, + StdIn = 0, + StdOut = 1 + } + + 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 + } + + //Interfaces + /** Scripting.Dictionary */ + interface Dictionary { + + /** Add a new key and item to the dictionary. */ + Add(Key: any, Item: any): void; + + /** Set or get the string comparison method. */ + CompareMode: CompareMethod; + + /** Get the number of items in the dictionary. */ + readonly Count: number; + + /** Determine if a given key is in the dictionary. */ + Exists(Key: any): boolean; + HashVal(Key: any): any; + + /** Set or get the item for a given key */ + Item(Key: any): any; + + /** Get an array containing all items in the dictionary. */ + Items(): any; + + /** Change a key to a different key. */ + Key(Key: any): any; + + /** Get an array containing all keys in the dictionary. */ + Keys(): any; + + /** Remove a given key from the dictionary. */ + Remove(Key: any): void; + + /** Remove all information from the dictionary. */ + RemoveAll(): void; + } + + /** Drive Object */ + interface Drive { + + /** Get available space */ + readonly AvailableSpace: any; + + /** Drive letter */ + readonly DriveLetter: string; + + /** Drive type */ + readonly DriveType: DriveTypeConst; + + /** Filesystem type */ + readonly FileSystem: string; + + /** Get drive free space */ + readonly FreeSpace: any; + + /** Check if disk is available */ + readonly IsReady: boolean; + + /** Path */ + readonly Path: string; + + /** Root folder */ + readonly RootFolder: Folder; + + /** Serial number */ + readonly SerialNumber: number; + + /** Share name */ + readonly ShareName: string; + + /** Get total drive size */ + readonly TotalSize: any; + + /** Name of volume */ + VolumeName: string; + } + + /** Collection of drives associated with drive letters */ + interface Drives { + + /** Number of drives */ + readonly Count: number; + + /** Get drive */ + Item(Key: any): Drive; + } + + /** Script Encoder Object */ + interface Encoder { + + /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ + EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; + } + + /** File object */ + interface File { + + /** File attributes */ + Attributes: FileAttribute; + + /** + * Copy this file + * @param boolean [OverWriteFiles=true] + */ + Copy(Destination: string, OverWriteFiles?: boolean): void; + + /** Date file was created */ + readonly DateCreated: VarDate; + + /** Date file was last accessed */ + readonly DateLastAccessed: VarDate; + + /** Date file was last modified */ + readonly DateLastModified: VarDate; + + /** + * Delete this file + * @param boolean [Force=false] + */ + Delete(Force?: boolean): void; + + /** Get drive that contains file */ + readonly Drive: Drive; + + /** Move this file */ + Move(Destination: string): void; + + /** Get name of file */ + Name: string; + + /** + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param Scripting.Tristate [Format=0] + */ + OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream; + + /** Get folder that contains file */ + readonly ParentFolder: Folder; + + /** Path to the file */ + readonly Path: string; + + /** Short name */ + readonly ShortName: string; + + /** Short path */ + readonly ShortPath: string; + + /** File size */ + readonly Size: any; + + /** Type description */ + readonly Type: string; + } + + /** Collection of files in a folder */ + interface Files { + + /** Number of folders */ + readonly Count: number; + + /** Get file */ + Item(Key: any): File; + } + + /** FileSystem Object */ + interface FileSystemObject { + + /** Generate a path from an existing path and a name */ + BuildPath(Path: string, Name: string): string; + + /** + * Copy a file + * @param boolean [OverWriteFiles=true] + */ + CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void; + + /** + * Copy a folder + * @param boolean [OverWriteFiles=true] + */ + CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void; + + /** Create a folder */ + CreateFolder(Path: string): Folder; + + /** + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ + CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; + + /** + * Delete a file + * @param boolean [Force=false] + */ + DeleteFile(FileSpec: string, Force?: boolean): void; + + /** + * Delete a folder + * @param boolean [Force=false] + */ + DeleteFolder(FolderSpec: string, Force?: boolean): void; + + /** Check if a drive or a share exists */ + DriveExists(DriveSpec: string): boolean; + + /** Get drives collection */ + readonly Drives: Drives; + + /** Check if a file exists */ + FileExists(FileSpec: string): boolean; + + /** Check if a path exists */ + FolderExists(FolderSpec: string): boolean; + + /** Return the canonical representation of the path */ + GetAbsolutePathName(Path: string): string; + + /** Return base name from a path */ + GetBaseName(Path: string): string; + + /** Get drive or UNC share */ + GetDrive(DriveSpec: string): Drive; + + /** Return drive from a path */ + GetDriveName(Path: string): string; + + /** Return extension from path */ + GetExtensionName(Path: string): string; + + /** Get file */ + GetFile(FilePath: string): File; + + /** Return the file name from a path */ + GetFileName(Path: string): string; + + /** Retrieve the file version of the specified file into a string */ + GetFileVersion(FileName: string): string; + + /** Get folder */ + GetFolder(FolderPath: string): Folder; + + /** Return path to the parent folder */ + GetParentFolderName(Path: string): string; + + /** Get location of various system folders */ + GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder; + + /** + * Retrieve the standard input, output or error stream + * @param boolean [Unicode=false] + */ + GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream; + + /** Generate name that can be used to name a temporary file */ + GetTempName(): string; + + /** Move a file */ + MoveFile(Source: string, Destination: string): void; + + /** Move a folder */ + MoveFolder(Source: string, Destination: string): void; + + /** + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param boolean [Create=false] + * @param Scripting.Tristate [Format=0] + */ + OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream; + } + + /** Folder object */ + interface Folder { + + /** Folder attributes */ + Attributes: FileAttribute; + + /** + * Copy this folder + * @param boolean [OverWriteFiles=true] + */ + Copy(Destination: string, OverWriteFiles?: boolean): void; + + /** + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ + CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; + + /** Date folder was created */ + readonly DateCreated: VarDate; + + /** Date folder was last accessed */ + readonly DateLastAccessed: VarDate; + + /** Date folder was last modified */ + readonly DateLastModified: VarDate; + + /** + * Delete this folder + * @param boolean [Force=false] + */ + Delete(Force?: boolean): void; + + /** Get drive that contains folder */ + readonly Drive: Drive; + + /** Get files collection */ + readonly Files: Files; + + /** True if folder is root */ + readonly IsRootFolder: boolean; + + /** Move this folder */ + Move(Destination: string): void; + + /** Get name of folder */ + Name: string; + + /** Get parent folder */ + readonly ParentFolder: Folder; + + /** Path to folder */ + readonly Path: string; + + /** Short name */ + readonly ShortName: string; + + /** Short path */ + readonly ShortPath: string; + + /** Sum of files and subfolders */ + readonly Size: any; + + /** Get folders collection */ + readonly SubFolders: Folders; + + /** Type description */ + readonly Type: string; + } + + /** Collection of subfolders in a folder */ + interface Folders { + + /** Create a new folder */ + Add(Name: string): Folder; + + /** Number of folders */ + readonly Count: number; + + /** Get folder */ + Item(Key: any): Folder; + } + + /** TextStream object */ + interface TextStream { + + /** Is the current position at the end of a line? */ + readonly AtEndOfLine: boolean; + + /** Is the current position at the end of the stream? */ + readonly AtEndOfStream: boolean; + + /** Close a text stream */ + Close(): void; + + /** Current column number */ + readonly Column: number; + + /** Current line number */ + readonly Line: number; + + /** Read a specific number of characters into a string */ + Read(Characters: number): string; + + /** Read the entire stream into a string */ + ReadAll(): string; + + /** Read an entire line into a string */ + ReadLine(): string; + + /** Skip a specific number of characters */ + Skip(Characters: number): void; + + /** Skip a line */ + SkipLine(): void; + + /** Write a string to the stream */ + Write(Text: string): void; + + /** Write a number of blank lines to the stream */ + WriteBlankLines(Lines: number): void; + + /** + * Write a string and an end of line to the stream + * @param string [Text=''] + */ + WriteLine(Text?: string): void; + } + +} + +//Global interfaces +interface ActiveXObject { + set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; + new(progid: 'Scripting.Dictionary'): Scripting.Dictionary; + new(progid: 'Scripting.Encoder'): Scripting.Encoder; + new(progid: 'Scripting.FileSystemObject'): Scripting.FileSystemObject; +} + +interface EnumeratorConstructor { + new(col: Scripting.Dictionary): any; + new(col: Scripting.Drives): Scripting.Drive; + new(col: Scripting.Files): Scripting.File; + new(col: Scripting.Folders): Scripting.Folder; +} + diff --git a/types/activex-scripting/package.json b/types/activex-scripting/package.json new file mode 100644 index 0000000000..d798f99261 --- /dev/null +++ b/types/activex-scripting/package.json @@ -0,0 +1 @@ +{ "dependencies": { "activex-helpers": "*"}} \ No newline at end of file diff --git a/types/activex-scripting-runtime/tsconfig.json b/types/activex-scripting/tsconfig.json similarity index 54% rename from types/activex-scripting-runtime/tsconfig.json rename to types/activex-scripting/tsconfig.json index f5e74f9dd6..badf87e17e 100644 --- a/types/activex-scripting-runtime/tsconfig.json +++ b/types/activex-scripting/tsconfig.json @@ -1,14 +1,9 @@ + { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom", - "scripthost" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, + "lib": ["scripthost"], + "strict": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,6 +14,6 @@ }, "files": [ "index.d.ts", - "activex-scripting-runtime-tests.ts" + "activex-scripting-tests.ts" ] } \ No newline at end of file diff --git a/types/activex-scripting/tslint.json b/types/activex-scripting/tslint.json new file mode 100644 index 0000000000..1d0e17119e --- /dev/null +++ b/types/activex-scripting/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint / dt.json" } \ No newline at end of file diff --git a/types/activex-windows-image-acquisition/activex-windows-image-acquisition-tests.ts b/types/activex-wia/activex-wia-tests.ts similarity index 95% rename from types/activex-windows-image-acquisition/activex-windows-image-acquisition-tests.ts rename to types/activex-wia/activex-wia-tests.ts index 549bb4433f..e775ec9239 100644 --- a/types/activex-windows-image-acquisition/activex-windows-image-acquisition-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -63,9 +63,5 @@ while (!e.atEnd()) { } } - if (WScript) { - WScript.Echo(s); - } else if (window) { - window.alert(s); - } + WScript.Echo(s); } \ No newline at end of file diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts new file mode 100644 index 0000000000..d79adff2a4 --- /dev/null +++ b/types/activex-wia/index.d.ts @@ -0,0 +1,697 @@ +// Type definitions for WIA - +// Project: +// Defintions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare namespace WIA { + + //Enums + /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ + const enum CommandID { + wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', + wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}', + wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}', + wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}', + wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}' + } + + /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ + const enum EventID { + wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}', + wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}', + wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}', + wiaEventItemDeleted = '{1D22A559-E14F-11D2-B326-00C04F68CE61}', + wiaEventScanEmailImage = '{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}', + wiaEventScanFaxImage = '{C00EB793-8C6E-11D2-977A-0000F87A926F}', + wiaEventScanFilmImage = '{9B2B662C-6185-438C-B68B-E39EE25E71CB}', + wiaEventScanImage = '{A6C5A715-8C6E-11D2-977A-0000F87A926F}', + wiaEventScanImage2 = '{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}', + wiaEventScanImage3 = '{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}', + wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}', + wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}', + wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}' + } + + /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ + const enum FormatID { + wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}', + wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}', + wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}', + wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}', + wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}' + } + + /** Miscellaneous string constants */ + const enum Miscellaneous { + wiaAnyDeviceID = '*', + wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' + } + + /** The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device object to obtain these values from the device. */ + const enum WiaDeviceType { + CameraDeviceType = 2, + ScannerDeviceType = 1, + UnspecifiedDeviceType = 0, + VideoDeviceType = 3 + } + + /** A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ + const enum WiaEventFlag { + ActionEvent = 2, + NotificationEvent = 1 + } + + /** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */ + const enum WiaImageBias { + MaximizeQuality = 131072, + MinimizeSize = 65536 + } + + /** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */ + const enum WiaImageIntent { + ColorIntent = 1, + GrayscaleIntent = 2, + TextIntent = 4, + UnspecifiedIntent = 0 + } + + /** The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection of an ImageFile object. */ + 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 + } + + /** An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ + 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 + } + + /** The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Device or Item object. */ + 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 + } + + /** The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for the property. */ + const enum WiaSubType { + FlagSubType = 3, + ListSubType = 2, + RangeSubType = 1, + UnspecifiedSubType = 0 + } + + //Interfaces + /** The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. */ + interface CommonDialog { + + /** + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ + ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; + + /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ + ShowAcquisitionWizard(Device: Device): any; + + /** + * Displays the properties dialog box for the specified Device + * @param boolean [CancelError=false] + */ + ShowDeviceProperties(Device: Device, CancelError?: boolean): void; + + /** + * Displays the properties dialog box for the specified Item + * @param boolean [CancelError=false] + */ + ShowItemProperties(Item: Item, CancelError?: boolean): void; + + /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ + ShowPhotoPrintingWizard(Files: any): void; + + /** + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [CancelError=false] + */ + ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; + + /** + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param boolean [SingleSelect=true] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ + ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; + + /** + * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [CancelError=false] + */ + ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any; + } + + /** The Device object represents an active connection to an imaging device. */ + interface Device { + + /** A collection of all commands for this imaging device */ + readonly Commands: DeviceCommands; + + /** Returns the DeviceID for this Device */ + readonly DeviceID: string; + + /** A collection of all events for this imaging device */ + readonly Events: DeviceEvents; + + /** Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the Commands collection. */ + ExecuteCommand(CommandID: string): Item; + + /** Returns the Item object specified by ItemID if it exists */ + GetItem(ItemID: string): Item; + + /** A collection of all items for this imaging device */ + readonly Items: Items; + + /** A collection of all properties for this imaging device */ + readonly Properties: Properties; + + /** Returns the Type of Device */ + readonly Type: WiaDeviceType; + + /** Returns the underlying IWiaItem interface for this Device object */ + readonly WiaItem: any; + } + + /** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */ + interface DeviceCommand { + + /** Returns the commandID for this Command */ + readonly CommandID: string; + + /** Returns the command Description */ + readonly Description: string; + + /** Returns the command Name */ + readonly Name: string; + } + + /** The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item object for more details on determining the collection of supported device commands. */ + interface DeviceCommands { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection by position */ + Item(Index: number): DeviceCommand; + } + + /** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */ + interface DeviceEvent { + + /** Returns the event Description */ + readonly Description: string; + + /** Returns the EventID for this Event */ + readonly EventID: string; + + /** Returns the event Name */ + readonly Name: string; + + /** Returns the Type of this Event */ + readonly Type: WiaEventFlag; + } + + /** The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more details on determining the collection of supported device events. */ + interface DeviceEvents { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection by position */ + Item(Index: number): DeviceEvent; + } + + /** The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer. */ + interface DeviceInfo { + + /** Establish a connection with this device and return a Device object */ + Connect(): Device; + + /** Returns the DeviceID for this Device */ + readonly DeviceID: string; + + /** A collection of all properties for this imaging device that are applicable when the device is not connected */ + readonly Properties: Properties; + + /** Returns the Type of Device */ + readonly Type: WiaDeviceType; + } + + /** The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManager object for detail on accessing the DeviceInfos object. */ + interface DeviceInfos { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection either by position or Device ID */ + Item(Index: any): DeviceInfo; + } + + /** The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. */ + interface DeviceManager { + + /** A collection of all imaging devices connected to this computer */ + readonly DeviceInfos: DeviceInfos; + + /** + * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * @param string [DeviceID='*'] + */ + RegisterEvent(EventID: string, DeviceID?: string): void; + + /** + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. + * @param string [DeviceID='*'] + */ + RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; + + /** + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. + * @param string [DeviceID='*'] + */ + UnregisterEvent(EventID: string, DeviceID?: string): void; + + /** + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * @param string [DeviceID='*'] + */ + UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; + } + + /** The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's properties and finally use the Apply method of the ImageProcess object to filter an ImageFile. */ + interface Filter { + + /** Returns a Description of what the filter does */ + readonly Description: string; + + /** Returns the FilterID for this Filter */ + readonly FilterID: string; + + /** Returns the Filter Name */ + readonly Name: string; + + /** A collection of all properties for this filter */ + readonly Properties: Properties; + } + + /** The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos property on the ImageProcess object for details on accessing FilterInfo objects. */ + interface FilterInfo { + + /** Returns a technical Description of what the filter does and how to use it in a filter chain */ + readonly Description: string; + + /** Returns the FilterID for this filter */ + readonly FilterID: string; + + /** Returns the FilterInfo Name */ + readonly Name: string; + } + + /** The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on accessing the FilterInfos object. */ + interface FilterInfos { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection either by position or name */ + Item(Index: any): FilterInfo; + } + + /** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */ + interface Filters { + + /** + * Appends/Inserts a new Filter of the specified FilterID into a Filter collection + * @param number [Index=0] + */ + Add(FilterID: string, Index?: number): void; + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection by position or FilterID */ + Item(Index: number): Filter; + + /** Removes the designated filter */ + Remove(Index: number): void; + } + + /** The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog object for this Item. */ + interface Formats { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection by position */ + Item(Index: number): string; + } + + /** The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files through LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. */ + interface ImageFile { + + /** Returns/Sets the current frame in the image */ + ActiveFrame: number; + + /** Returns the raw image bits as a Vector of Long values */ + readonly ARGBData: Vector; + + /** Returns the raw image file as a Vector of Bytes */ + readonly FileData: Vector; + + /** Returns the file extension for this image file type */ + readonly FileExtension: string; + + /** Returns the FormatID for this file type */ + readonly FormatID: string; + + /** Returns the number of frames in the image */ + readonly FrameCount: number; + + /** Returns the Height of the image in pixels */ + readonly Height: number; + + /** Returns the Horizontal pixels per inch of the image */ + readonly HorizontalResolution: number; + + /** Indicates if the pixel format has an alpha component */ + readonly IsAlphaPixelFormat: boolean; + + /** Indicates whether the image is animated */ + readonly IsAnimated: boolean; + + /** Indicates if the pixel format is extended (16 bits/channel) */ + readonly IsExtendedPixelFormat: boolean; + + /** Indicates if the pixel data is an index into a palette or the actual color data */ + readonly IsIndexedPixelFormat: boolean; + + /** Loads the ImageFile object with the specified File */ + LoadFile(Filename: string): void; + + /** Returns the depth of the pixels of the image in bits per pixel */ + readonly PixelDepth: number; + + /** A collection of all properties for this image */ + readonly Properties: Properties; + + /** Save the ImageFile object to the specified File */ + SaveFile(Filename: string): void; + + /** Returns the Vertical pixels per inch of the image */ + readonly VerticalResolution: number; + + /** Returns the Width of the image in pixels */ + readonly Width: number; + } + + /** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */ + interface ImageProcess { + + /** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */ + Apply(Source: ImageFile): ImageFile; + + /** A collection of all available filters */ + readonly FilterInfos: FilterInfos; + + /** A collection of the filters to be applied in this process */ + readonly Filters: Filters; + } + + /** The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing Item objects. */ + interface Item { + + /** A collection of all commands for this item */ + readonly Commands: DeviceCommands; + + /** Issues the command specified by CommandID. CommandIDs are device dependent. Valid CommandIDs for this Item are contained in the Commands collection. */ + ExecuteCommand(CommandID: string): Item; + + /** A collection of all supported format types for this item */ + readonly Formats: Formats; + + /** Returns the ItemID for this Item */ + readonly ItemID: string; + + /** A collection of all child items for this item */ + readonly Items: Items; + + /** A collection of all properties for this item */ + readonly Properties: Properties; + + /** + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + */ + Transfer(FormatID?: string): any; + + /** Returns the underlying IWiaItem interface for this Item object */ + readonly WiaItem: any; + } + + /** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */ + interface Items { + + /** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */ + Add(Name: string, Flags: number): void; + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Returns the specified item in the collection by position */ + Item(Index: number): Item; + + /** Removes the designated Item */ + Remove(Index: number): void; + } + + /** The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property on any of these objects for detail on accessing the Properties object. */ + interface Properties { + + /** Returns the number of members in the collection */ + readonly Count: number; + + /** Indicates whether the specified Property exists in the collection */ + Exists(Index: any): boolean; + + /** Returns the specified item in the collection either by position or name. */ + Item(Index: any): Property; + } + + /** The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property on any of these objects for details on accessing Property objects. */ + interface Property { + + /** Indicates whether the Property Value is read only */ + readonly IsReadOnly: boolean; + + /** Indicates whether the Property Value is a vector */ + readonly IsVector: boolean; + + /** Returns the Property Name */ + readonly Name: string; + + /** Returns the PropertyID of this Property */ + readonly PropertyID: number; + + /** Returns the SubType of the Property, if any */ + readonly SubType: WiaSubType; + + /** Returns the default Property Value if the SubType is not UnspecifiedSubType */ + readonly SubTypeDefault: any; + + /** Returns the maximum valid Property Value if the SubType is RangeSubType */ + readonly SubTypeMax: number; + + /** Returns the minimum valid Property Value if the SubType is RangeSubType */ + readonly SubTypeMin: number; + + /** Returns the step increment of Property Values if the SubType is RangeSubType */ + readonly SubTypeStep: number; + + /** Returns a Vector of valid Property Values if the SubType is ListSubType or valid flag Values that can be ored together if the SubType is FlagSubType */ + readonly SubTypeValues: Vector; + + /** Returns either a WiaPropertyType or a WiaImagePropertyType */ + readonly Type: number; + + /** Returns/Sets the Property Value */ + Value: any; + } + + /** The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created using "WIA.Rational" in a call to CreateObject. */ + interface Rational { + + /** Returns/Sets the Rational Value Denominator */ + Denominator: number; + + /** Returns/Sets the Rational Value Numerator */ + Numerator: number; + + /** Returns the Rational Value as a Double */ + readonly Value: number; + } + + /** The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be created using "WIA.Vector" in a call to CreateObject. */ + interface Vector { + + /** + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. + * @param number [Index=0] + */ + Add(Value: any, Index?: number): void; + + /** Returns/Sets the Vector of Bytes as an array of bytes */ + BinaryData: any; + + /** Removes all elements. */ + Clear(): void; + + /** Returns the number of members in the vector */ + readonly Count: number; + + /** Returns/Sets the Vector of Integers from a Date */ + Date: VarDate; + + /** + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ + ImageFile(Width?: number, Height?: number): ImageFile; + + /** Returns/Sets the specified item in the vector by position */ + Item(Index: number): any; + + /** + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ + Picture(Width?: number, Height?: number): any; + + /** Removes the designated element and returns it if successful */ + Remove(Index: number): any; + + /** + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * @param boolean [Resizable=true] + * @param boolean [Unicode=true] + */ + SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void; + + /** + * Returns a Vector of Bytes as a String + * @param boolean [Unicode=true] + */ + String(Unicode?: boolean): string; + } + +} + +//Global interfaces +interface ActiveXObject { + on(obj: WIA.DeviceManager, eventName: 'OnEvent', eventArgs: ['EventID', 'DeviceID', 'ItemID'], handler: (this: WIA.DeviceManager, parameter: {EventID: string, DeviceID: string, ItemID: string}) => void): void; + set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void; + new(progid: 'WIA.CommonDialog'): WIA.CommonDialog; + new(progid: 'WIA.DeviceManager'): WIA.DeviceManager; + new(progid: 'WIA.ImageFile'): WIA.ImageFile; + new(progid: 'WIA.ImageProcess'): WIA.ImageProcess; + new(progid: 'WIA.Rational'): WIA.Rational; + new(progid: 'WIA.Vector'): WIA.Vector; +} + +interface EnumeratorConstructor { + new(col: WIA.DeviceCommands): WIA.DeviceCommand; + new(col: WIA.DeviceEvents): WIA.DeviceEvent; + new(col: WIA.DeviceInfos): WIA.DeviceInfo; + new(col: WIA.FilterInfos): WIA.FilterInfo; + new(col: WIA.Filters): WIA.Filter; + new(col: WIA.Formats): string; + new(col: WIA.Items): WIA.Item; + new(col: WIA.Properties): WIA.Property; + new(col: WIA.Vector): any; +} + diff --git a/types/activex-wia/package.json b/types/activex-wia/package.json new file mode 100644 index 0000000000..d798f99261 --- /dev/null +++ b/types/activex-wia/package.json @@ -0,0 +1 @@ +{ "dependencies": { "activex-helpers": "*"}} \ No newline at end of file diff --git a/types/activex-windows-image-acquisition/tsconfig.json b/types/activex-wia/tsconfig.json similarity index 53% rename from types/activex-windows-image-acquisition/tsconfig.json rename to types/activex-wia/tsconfig.json index 486d95921c..70a07b894d 100644 --- a/types/activex-windows-image-acquisition/tsconfig.json +++ b/types/activex-wia/tsconfig.json @@ -1,14 +1,9 @@ + { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom", - "scripthost" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, + "lib": ["scripthost"], + "strict": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,6 +14,6 @@ }, "files": [ "index.d.ts", - "activex-windows-image-acquisition-tests.ts" + "activex-wia-tests.ts" ] } \ No newline at end of file diff --git a/types/activex-wia/tslint.json b/types/activex-wia/tslint.json new file mode 100644 index 0000000000..1d0e17119e --- /dev/null +++ b/types/activex-wia/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint / dt.json" } \ No newline at end of file diff --git a/types/activex-windows-image-acquisition/index.d.ts b/types/activex-windows-image-acquisition/index.d.ts deleted file mode 100644 index af32d8a865..0000000000 --- a/types/activex-windows-image-acquisition/index.d.ts +++ /dev/null @@ -1,379 +0,0 @@ -// Type definitions for Microsoft Windows Image Acquisition Library v2.0 -// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630827(v=vs.85).aspx -// Definitions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -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 - } - - //Interfaces - 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; -} - From b3ce2941b4ebd10d46846a3de29e5f3b06c7bc21 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 26 Jun 2017 07:59:11 +0200 Subject: [PATCH 02/17] Fixed whitespace after header --- types/activex-adodb/index.d.ts | 6 ++--- types/activex-scripting/index.d.ts | 37 +----------------------------- types/activex-wia/index.d.ts | 32 ++++++++++++-------------- 3 files changed, 18 insertions(+), 57 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 8d6190363a..0fe592c2d8 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for ADODB - +// Type definitions for ADODB // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx // Defintions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace ADODB { - //Enums const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, adPriorityBelowNormal = 2, @@ -594,7 +594,6 @@ declare namespace ADODB { adXactSyncPhaseOne = 1048576 } - //Interfaces interface Command { ActiveConnection: Connection; Cancel(): void; @@ -947,7 +946,6 @@ declare namespace ADODB { } -//Global interfaces interface ActiveXObject { on(obj: ADODB.Connection, eventName: 'BeginTransComplete', eventArgs: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; on(obj: ADODB.Connection, eventName: 'CommitTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 55bf6bd661..4eafd1f924 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -2,42 +2,9 @@ // Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx // Defintions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace Scripting { - //Enums - const enum __MIDL___MIDL_itf_scrrun_0000_0000_0001 { - Alias = 1024, - Archive = 32, - Compressed = 2048, - Directory = 16, - Hidden = 2, - Normal = 0, - ReadOnly = 1, - System = 4, - Volume = 8 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0001 { - CDRom = 4, - Fixed = 2, - RamDisk = 5, - Remote = 3, - Removable = 1, - UnknownType = 0 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0002 { - SystemFolder = 1, - TemporaryFolder = 2, - WindowsFolder = 0 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0003 { - StdErr = 2, - StdIn = 0, - StdOut = 1 - } - const enum CompareMethod { BinaryCompare = 0, DatabaseCompare = 2, @@ -90,7 +57,6 @@ declare namespace Scripting { TristateUseDefault = -2 } - //Interfaces /** Scripting.Dictionary */ interface Dictionary { @@ -496,7 +462,6 @@ declare namespace Scripting { } -//Global interfaces interface ActiveXObject { set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; new(progid: 'Scripting.Dictionary'): Scripting.Dictionary; diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index d79adff2a4..46f1f285af 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for WIA - -// Project: +// Type definitions for WIA +// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx // Defintions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace WIA { - //Enums - /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ + /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ const enum CommandID { wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}', @@ -14,7 +14,7 @@ declare namespace WIA { wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}' } - /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ + /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ const enum EventID { wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}', wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}', @@ -31,7 +31,7 @@ declare namespace WIA { wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}' } - /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ + /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ const enum FormatID { wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}', wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}', @@ -40,13 +40,13 @@ declare namespace WIA { wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}' } - /** Miscellaneous string constants */ + /** Miscellaneous string constants */ const enum Miscellaneous { wiaAnyDeviceID = '*', wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' } - /** The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device object to obtain these values from the device. */ + /** The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device object to obtain these values from the device. */ const enum WiaDeviceType { CameraDeviceType = 2, ScannerDeviceType = 1, @@ -54,19 +54,19 @@ declare namespace WIA { VideoDeviceType = 3 } - /** A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ + /** A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ const enum WiaEventFlag { ActionEvent = 2, NotificationEvent = 1 } - /** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */ + /** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */ const enum WiaImageBias { MaximizeQuality = 131072, MinimizeSize = 65536 } - /** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */ + /** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */ const enum WiaImageIntent { ColorIntent = 1, GrayscaleIntent = 2, @@ -74,7 +74,7 @@ declare namespace WIA { UnspecifiedIntent = 0 } - /** The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection of an ImageFile object. */ + /** The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection of an ImageFile object. */ const enum WiaImagePropertyType { ByteImagePropertyType = 1001, LongImagePropertyType = 1004, @@ -93,7 +93,7 @@ declare namespace WIA { VectorOfUnsignedRationalsImagePropertyType = 1106 } - /** An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ + /** An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ const enum WiaItemFlag { AnalyzeItemFlag = 16, AudioItemFlag = 32, @@ -116,7 +116,7 @@ declare namespace WIA { VPanoramaItemFlag = 1024 } - /** The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Device or Item object. */ + /** The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Device or Item object. */ const enum WiaPropertyType { BooleanPropertyType = 1, BytePropertyType = 2, @@ -157,7 +157,7 @@ declare namespace WIA { VectorOfVariantsPropertyType = 119 } - /** The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for the property. */ + /** The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for the property. */ const enum WiaSubType { FlagSubType = 3, ListSubType = 2, @@ -165,7 +165,6 @@ declare namespace WIA { UnspecifiedSubType = 0 } - //Interfaces /** The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. */ interface CommonDialog { @@ -671,7 +670,6 @@ declare namespace WIA { } -//Global interfaces interface ActiveXObject { on(obj: WIA.DeviceManager, eventName: 'OnEvent', eventArgs: ['EventID', 'DeviceID', 'ItemID'], handler: (this: WIA.DeviceManager, parameter: {EventID: string, DeviceID: string, ItemID: string}) => void): void; set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void; From a5216b75cbd88c52ac8433fae2473c4bae187d7c Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 26 Jun 2017 08:31:56 +0200 Subject: [PATCH 03/17] Fixed spelling of "Defintions" --- types/activex-adodb/index.d.ts | 4 ++-- types/activex-scripting/index.d.ts | 4 ++-- types/activex-wia/index.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 0fe592c2d8..8d27b7c706 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for ADODB +// Type definitions for Microsoft ActiveX Data Objects // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx -// Defintions by: Zev Spitz +// Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ADODB { diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 4eafd1f924..7911113175 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Scripting - +// Type definitions for Microsoft Scripting Runtime // Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx -// Defintions by: Zev Spitz +// Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Scripting { diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 46f1f285af..266902a683 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for WIA +// Type definitions for Windows Image Acquisition // Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx -// Defintions by: Zev Spitz +// Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace WIA { From de094e27e520b991e90d286c3d6e959c5ce0ef95 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 26 Jun 2017 08:36:54 +0200 Subject: [PATCH 04/17] Removed extra file --- types/activex-scripting/activex-scripting.ts | 64 -------------------- 1 file changed, 64 deletions(-) delete mode 100644 types/activex-scripting/activex-scripting.ts diff --git a/types/activex-scripting/activex-scripting.ts b/types/activex-scripting/activex-scripting.ts deleted file mode 100644 index 1510b98e1b..0000000000 --- a/types/activex-scripting/activex-scripting.ts +++ /dev/null @@ -1,64 +0,0 @@ -//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 + '
'; - 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); -}; From 5e86ce784cdea8f7e0036f8957b4e4b53b2c0d67 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 26 Jun 2017 08:42:34 +0200 Subject: [PATCH 05/17] Fixed tslint.json whitespace --- types/activex-adodb/tslint.json | 2 +- types/activex-scripting/tslint.json | 2 +- types/activex-wia/tslint.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/activex-adodb/tslint.json b/types/activex-adodb/tslint.json index 1d0e17119e..2750cc0197 100644 --- a/types/activex-adodb/tslint.json +++ b/types/activex-adodb/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint / dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/activex-scripting/tslint.json b/types/activex-scripting/tslint.json index 1d0e17119e..2750cc0197 100644 --- a/types/activex-scripting/tslint.json +++ b/types/activex-scripting/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint / dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/activex-wia/tslint.json b/types/activex-wia/tslint.json index 1d0e17119e..2750cc0197 100644 --- a/types/activex-wia/tslint.json +++ b/types/activex-wia/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint / dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } \ No newline at end of file From dc164b94fb06f67ff0423d2592407e9a07599c3e Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 26 Jun 2017 09:16:01 +0200 Subject: [PATCH 06/17] Fixed tsconfig.json --- types/activex-adodb/tsconfig.json | 3 +++ types/activex-scripting/tsconfig.json | 3 +++ types/activex-wia/tsconfig.json | 3 +++ 3 files changed, 9 insertions(+) diff --git a/types/activex-adodb/tsconfig.json b/types/activex-adodb/tsconfig.json index 22b6f9e045..01ef1659e1 100644 --- a/types/activex-adodb/tsconfig.json +++ b/types/activex-adodb/tsconfig.json @@ -3,6 +3,9 @@ "compilerOptions": { "module": "commonjs", "lib": ["scripthost"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, "strict": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/activex-scripting/tsconfig.json b/types/activex-scripting/tsconfig.json index badf87e17e..454fc20695 100644 --- a/types/activex-scripting/tsconfig.json +++ b/types/activex-scripting/tsconfig.json @@ -3,6 +3,9 @@ "compilerOptions": { "module": "commonjs", "lib": ["scripthost"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, "strict": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/activex-wia/tsconfig.json b/types/activex-wia/tsconfig.json index 70a07b894d..321e40e36c 100644 --- a/types/activex-wia/tsconfig.json +++ b/types/activex-wia/tsconfig.json @@ -3,6 +3,9 @@ "compilerOptions": { "module": "commonjs", "lib": ["scripthost"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, "strict": true, "baseUrl": "../", "typeRoots": [ From c26957ea20882c5b804659d1c9349b2968eebd93 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Tue, 27 Jun 2017 02:55:43 +0200 Subject: [PATCH 07/17] dtslint fixes --- types/activex-adodb/index.d.ts | 260 +++++++++++++++-------------- types/activex-scripting/index.d.ts | 97 ++++++----- types/activex-wia/index.d.ts | 137 ++++++++------- 3 files changed, 253 insertions(+), 241 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 8d27b7c706..28e7d7f8ff 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,10 +1,4 @@ -// Type definitions for Microsoft ActiveX Data Objects -// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx -// Definitions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace ADODB { - const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, adPriorityBelowNormal = 2, @@ -601,18 +595,18 @@ declare namespace ADODB { CommandText: string; CommandTimeout: number; CommandType: CommandTypeEnum; - + /** - * @param string [Name=''] - * @param ADODB.DataTypeEnum [Type=0] - * @param ADODB.ParameterDirectionEnum [Direction=1] - * @param number [Size=0] - */ + * @param string [Name=''] + * @param ADODB.DataTypeEnum [Type=0] + * @param ADODB.ParameterDirectionEnum [Direction=1] + * @param number [Size=0] + */ CreateParameter(Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any): Parameter; Dialect: string; - + /** @param number [Options=-1] */ - Execute(RecordsAffected?: any, Parameters?: any[], Options?: number): Recordset; + Execute(RecordsAffected?: any, Parameters?: any, Options?: number): Recordset; Name: string; NamedParameters: boolean; readonly Parameters: Parameters; @@ -633,18 +627,18 @@ declare namespace ADODB { CursorLocation: CursorLocationEnum; DefaultDatabase: string; readonly Errors: Errors; - + /** @param number [Options=-1] */ Execute(CommandText: string, RecordsAffected: any, Options?: number): Recordset; IsolationLevel: IsolationLevelEnum; Mode: ConnectModeEnum; - + /** - * @param string [ConnectionString=''] - * @param string [UserID=''] - * @param string [Password=''] - * @param number [Options=-1] - */ + * @param string [ConnectionString=''] + * @param string [UserID=''] + * @param string [Password=''] + * @param number [Options=-1] + */ Open(ConnectionString?: string, UserID?: string, Password?: string, Options?: number): void; OpenSchema(Schema: SchemaEnum, Restrictions?: any, SchemaID?: any): Recordset; readonly Properties: Properties; @@ -690,24 +684,23 @@ declare namespace ADODB { } interface Fields { - /** - * @param number [DefinedSize=0] - * @param ADODB.FieldAttributeEnum [Attrib=-1] - */ + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ _Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum): void; - + /** - * @param number [DefinedSize=0] - * @param ADODB.FieldAttributeEnum [Attrib=-1] - */ + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any): void; CancelUpdate(): void; readonly Count: number; Delete(Index: any): void; Item(Index: any): Field; Refresh(): void; - + /** @param ADODB.ResyncEnum [ResyncValues=2] */ Resync(ResyncValues?: ResyncEnum): void; Update(): void; @@ -751,43 +744,43 @@ declare namespace ADODB { ActiveConnection: any; Cancel(): void; Close(): void; - + /** - * @param string [Source=''] - * @param string [Destination=''] - * @param string [UserName=''] - * @param string [Password=''] - * @param ADODB.CopyRecordOptionsEnum [Options=-1] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.CopyRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ CopyRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean): string; - + /** - * @param string [Source=''] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param boolean [Async=false] + */ DeleteRecord(Source?: string, Async?: boolean): void; readonly Fields: Fields; GetChildren(): Recordset; Mode: ConnectModeEnum; - + /** - * @param string [Source=''] - * @param string [Destination=''] - * @param string [UserName=''] - * @param string [Password=''] - * @param ADODB.MoveRecordOptionsEnum [Options=-1] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.MoveRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ MoveRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean): string; - + /** - * @param ADODB.ConnectModeEnum [Mode=0] - * @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1] - * @param ADODB.RecordOpenOptionsEnum [Options=-1] - * @param string [UserName=''] - * @param string [Password=''] - */ + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1] + * @param ADODB.RecordOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ Open(Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string): void; readonly ParentURL: string; readonly Properties: Properties; @@ -798,14 +791,14 @@ declare namespace ADODB { interface Recordset { _xClone(): Recordset; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ _xResync(AffectRecords?: AffectEnum): void; - + /** - * @param string [FileName=''] - * @param ADODB.PersistFormatEnum [PersistFormat=0] - */ + * @param string [FileName=''] + * @param ADODB.PersistFormatEnum [PersistFormat=0] + */ _xSave(FileName?: string, PersistFormat?: PersistFormatEnum): void; AbsolutePage: PositionEnum; AbsolutePosition: PositionEnum; @@ -816,11 +809,11 @@ declare namespace ADODB { Bookmark: any; CacheSize: number; Cancel(): void; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ CancelBatch(AffectRecords?: AffectEnum): void; CancelUpdate(): void; - + /** @param ADODB.LockTypeEnum [LockType=-1] */ Clone(LockType?: LockTypeEnum): Recordset; Close(): void; @@ -830,30 +823,30 @@ declare namespace ADODB { CursorType: CursorTypeEnum; DataMember: string; DataSource: any; - + /** @param ADODB.AffectEnum [AffectRecords=1] */ Delete(AffectRecords?: AffectEnum): void; readonly EditMode: EditModeEnum; readonly EOF: boolean; readonly Fields: Fields; Filter: any; - + /** - * @param number [SkipRecords=0] - * @param ADODB.SearchDirectionEnum [SearchDirection=1] - */ + * @param number [SkipRecords=0] + * @param ADODB.SearchDirectionEnum [SearchDirection=1] + */ Find(Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any): void; - + /** @param number [Rows=-1] */ GetRows(Rows?: number, Start?: any, Fields?: any): any; - + /** - * @param ADODB.StringFormatEnum [StringFormat=2] - * @param number [NumRows=-1] - * @param string [ColumnDelimeter=''] - * @param string [RowDelimeter=''] - * @param string [NullExpr=''] - */ + * @param ADODB.StringFormatEnum [StringFormat=2] + * @param number [NumRows=-1] + * @param string [ColumnDelimeter=''] + * @param string [RowDelimeter=''] + * @param string [NullExpr=''] + */ GetString(StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string): string; Index: string; LockType: LockTypeEnum; @@ -865,30 +858,30 @@ declare namespace ADODB { MoveNext(): void; MovePrevious(): void; NextRecordset(RecordsAffected?: any): Recordset; - + /** - * @param ADODB.CursorTypeEnum [CursorType=-1] - * @param ADODB.LockTypeEnum [LockType=-1] - * @param number [Options=-1] - */ + * @param ADODB.CursorTypeEnum [CursorType=-1] + * @param ADODB.LockTypeEnum [LockType=-1] + * @param number [Options=-1] + */ Open(Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number): void; readonly PageCount: number; PageSize: number; readonly Properties: Properties; readonly RecordCount: number; - + /** @param number [Options=-1] */ Requery(Options?: number): void; - + /** - * @param ADODB.AffectEnum [AffectRecords=3] - * @param ADODB.ResyncEnum [ResyncValues=2] - */ + * @param ADODB.AffectEnum [AffectRecords=3] + * @param ADODB.ResyncEnum [ResyncValues=2] + */ Resync(AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum): void; - + /** @param ADODB.PersistFormatEnum [PersistFormat=0] */ Save(Destination: any, PersistFormat?: PersistFormatEnum): void; - + /** @param ADODB.SeekEnum [SeekOption=1] */ Seek(KeyValues: any, SeekOption?: SeekEnum): void; Sort: string; @@ -898,7 +891,7 @@ declare namespace ADODB { StayInSync: boolean; Supports(CursorOptions: CursorOptionEnum): boolean; Update(Fields?: any, Values?: any): void; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ UpdateBatch(AffectRecords?: AffectEnum): void; } @@ -907,7 +900,7 @@ declare namespace ADODB { Cancel(): void; Charset: string; Close(): void; - + /** @param number [CharNumber=-1] */ CopyTo(DestStream: Stream, CharNumber?: number): void; readonly EOS: boolean; @@ -915,22 +908,22 @@ declare namespace ADODB { LineSeparator: LineSeparatorEnum; LoadFromFile(FileName: string): void; Mode: ConnectModeEnum; - + /** - * @param ADODB.ConnectModeEnum [Mode=0] - * @param ADODB.StreamOpenOptionsEnum [Options=-1] - * @param string [UserName=''] - * @param string [Password=''] - */ + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.StreamOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ Open(Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string): void; Position: number; - + /** @param number [NumBytes=-1] */ Read(NumBytes?: number): any; - + /** @param number [NumChars=-1] */ ReadText(NumChars?: number): string; - + /** @param ADODB.SaveOptionsEnum [Options=1] */ SaveToFile(FileName: string, Options?: SaveOptionsEnum): void; SetEOS(): void; @@ -939,7 +932,7 @@ declare namespace ADODB { readonly State: ObjectStateEnum; Type: StreamTypeEnum; Write(Buffer: any): void; - + /** @param ADODB.StreamWriteEnum [Options=0] */ WriteText(Data: string, Options?: StreamWriteEnum): void; } @@ -947,26 +940,48 @@ declare namespace ADODB { } interface ActiveXObject { - on(obj: ADODB.Connection, eventName: 'BeginTransComplete', eventArgs: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'CommitTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'ConnectComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'Disconnect', eventArgs: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'ExecuteComplete', eventArgs: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'InfoMessage', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'RollbackTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'WillConnect', eventArgs: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'WillExecute', eventArgs: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Recordset, eventName: 'EndOfRecordset', eventArgs: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FetchComplete', eventArgs: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FetchProgress', eventArgs: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FieldChangeComplete', eventArgs: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'MoveComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'RecordChangeComplete', eventArgs: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'RecordsetChangeComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeField', eventArgs: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeRecord', eventArgs: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeRecordset', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillMove', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: { + TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'CommitTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, + pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], + handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, + pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'InfoMessage', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, + parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], + handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, + adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, + MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, + Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeRecordset', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void; new(progid: 'ADODB.Command'): ADODB.Command; new(progid: 'ADODB.Connection'): ADODB.Connection; @@ -981,5 +996,4 @@ interface EnumeratorConstructor { new(col: ADODB.Fields): ADODB.Field; new(col: ADODB.Parameters): ADODB.Parameter; new(col: ADODB.Properties): ADODB.Property; -} - +} \ No newline at end of file diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 7911113175..1dd659fc7a 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -156,9 +156,9 @@ declare namespace Scripting { Attributes: FileAttribute; /** - * Copy this file - * @param boolean [OverWriteFiles=true] - */ + * Copy this file + * @param boolean [OverWriteFiles=true] + */ Copy(Destination: string, OverWriteFiles?: boolean): void; /** Date file was created */ @@ -171,9 +171,9 @@ declare namespace Scripting { readonly DateLastModified: VarDate; /** - * Delete this file - * @param boolean [Force=false] - */ + * Delete this file + * @param boolean [Force=false] + */ Delete(Force?: boolean): void; /** Get drive that contains file */ @@ -186,10 +186,10 @@ declare namespace Scripting { Name: string; /** - * Open a file as a TextStream - * @param Scripting.IOMode [IOMode=1] - * @param Scripting.Tristate [Format=0] - */ + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param Scripting.Tristate [Format=0] + */ OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream; /** Get folder that contains file */ @@ -228,37 +228,37 @@ declare namespace Scripting { BuildPath(Path: string, Name: string): string; /** - * Copy a file - * @param boolean [OverWriteFiles=true] - */ + * Copy a file + * @param boolean [OverWriteFiles=true] + */ CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void; /** - * Copy a folder - * @param boolean [OverWriteFiles=true] - */ + * Copy a folder + * @param boolean [OverWriteFiles=true] + */ CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void; /** Create a folder */ CreateFolder(Path: string): Folder; /** - * Create a file as a TextStream - * @param boolean [Overwrite=true] - * @param boolean [Unicode=false] - */ + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; /** - * Delete a file - * @param boolean [Force=false] - */ + * Delete a file + * @param boolean [Force=false] + */ DeleteFile(FileSpec: string, Force?: boolean): void; /** - * Delete a folder - * @param boolean [Force=false] - */ + * Delete a folder + * @param boolean [Force=false] + */ DeleteFolder(FolderSpec: string, Force?: boolean): void; /** Check if a drive or a share exists */ @@ -307,9 +307,9 @@ declare namespace Scripting { GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder; /** - * Retrieve the standard input, output or error stream - * @param boolean [Unicode=false] - */ + * Retrieve the standard input, output or error stream + * @param boolean [Unicode=false] + */ GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream; /** Generate name that can be used to name a temporary file */ @@ -322,11 +322,11 @@ declare namespace Scripting { MoveFolder(Source: string, Destination: string): void; /** - * Open a file as a TextStream - * @param Scripting.IOMode [IOMode=1] - * @param boolean [Create=false] - * @param Scripting.Tristate [Format=0] - */ + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param boolean [Create=false] + * @param Scripting.Tristate [Format=0] + */ OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream; } @@ -337,16 +337,16 @@ declare namespace Scripting { Attributes: FileAttribute; /** - * Copy this folder - * @param boolean [OverWriteFiles=true] - */ + * Copy this folder + * @param boolean [OverWriteFiles=true] + */ Copy(Destination: string, OverWriteFiles?: boolean): void; /** - * Create a file as a TextStream - * @param boolean [Overwrite=true] - * @param boolean [Unicode=false] - */ + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; /** Date folder was created */ @@ -359,9 +359,9 @@ declare namespace Scripting { readonly DateLastModified: VarDate; /** - * Delete this folder - * @param boolean [Force=false] - */ + * Delete this folder + * @param boolean [Force=false] + */ Delete(Force?: boolean): void; /** Get drive that contains folder */ @@ -454,9 +454,9 @@ declare namespace Scripting { WriteBlankLines(Lines: number): void; /** - * Write a string and an end of line to the stream - * @param string [Text=''] - */ + * Write a string and an end of line to the stream + * @param string [Text=''] + */ WriteLine(Text?: string): void; } @@ -474,5 +474,4 @@ interface EnumeratorConstructor { new(col: Scripting.Drives): Scripting.Drive; new(col: Scripting.Files): Scripting.File; new(col: Scripting.Folders): Scripting.Folder; -} - +} \ No newline at end of file diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 266902a683..564b7fbf04 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -169,58 +169,58 @@ declare namespace WIA { interface CommonDialog { /** - * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing - * @param WIA.WiaDeviceType [DeviceType=0] - * @param WIA.WiaImageIntent [Intent=0] - * @param WIA.WiaImageBias [Bias=131072] - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - * @param boolean [AlwaysSelectDevice=false] - * @param boolean [UseCommonUI=true] - * @param boolean [CancelError=false] - */ + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ ShowAcquisitionWizard(Device: Device): any; /** - * Displays the properties dialog box for the specified Device - * @param boolean [CancelError=false] - */ + * Displays the properties dialog box for the specified Device + * @param boolean [CancelError=false] + */ ShowDeviceProperties(Device: Device, CancelError?: boolean): void; /** - * Displays the properties dialog box for the specified Item - * @param boolean [CancelError=false] - */ + * Displays the properties dialog box for the specified Item + * @param boolean [CancelError=false] + */ ShowItemProperties(Item: Item, CancelError?: boolean): void; /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ ShowPhotoPrintingWizard(Files: any): void; /** - * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing - * @param WIA.WiaDeviceType [DeviceType=0] - * @param boolean [AlwaysSelectDevice=false] - * @param boolean [CancelError=false] - */ + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [CancelError=false] + */ ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; /** - * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing - * @param WIA.WiaImageIntent [Intent=0] - * @param WIA.WiaImageBias [Bias=131072] - * @param boolean [SingleSelect=true] - * @param boolean [UseCommonUI=true] - * @param boolean [CancelError=false] - */ + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param boolean [SingleSelect=true] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; /** - * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - * @param boolean [CancelError=false] - */ + * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [CancelError=false] + */ ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any; } @@ -337,27 +337,27 @@ declare namespace WIA { readonly DeviceInfos: DeviceInfos; /** - * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. - * @param string [DeviceID='*'] - */ + * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * @param string [DeviceID='*'] + */ RegisterEvent(EventID: string, DeviceID?: string): void; /** - * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. - * @param string [DeviceID='*'] - */ + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. + * @param string [DeviceID='*'] + */ RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; /** - * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. - * @param string [DeviceID='*'] - */ + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. + * @param string [DeviceID='*'] + */ UnregisterEvent(EventID: string, DeviceID?: string): void; /** - * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. - * @param string [DeviceID='*'] - */ + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * @param string [DeviceID='*'] + */ UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; } @@ -404,9 +404,9 @@ declare namespace WIA { interface Filters { /** - * Appends/Inserts a new Filter of the specified FilterID into a Filter collection - * @param number [Index=0] - */ + * Appends/Inserts a new Filter of the specified FilterID into a Filter collection + * @param number [Index=0] + */ Add(FilterID: string, Index?: number): void; /** Returns the number of members in the collection */ @@ -522,9 +522,9 @@ declare namespace WIA { readonly Properties: Properties; /** - * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - */ + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + */ Transfer(FormatID?: string): any; /** Returns the underlying IWiaItem interface for this Item object */ @@ -617,9 +617,9 @@ declare namespace WIA { interface Vector { /** - * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. - * @param number [Index=0] - */ + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. + * @param number [Index=0] + */ Add(Value: any, Index?: number): void; /** Returns/Sets the Vector of Bytes as an array of bytes */ @@ -635,36 +635,36 @@ declare namespace WIA { Date: VarDate; /** - * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. - * @param number [Width=0] - * @param number [Height=0] - */ + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ ImageFile(Width?: number, Height?: number): ImageFile; /** Returns/Sets the specified item in the vector by position */ Item(Index: number): any; /** - * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. - * @param number [Width=0] - * @param number [Height=0] - */ + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ Picture(Width?: number, Height?: number): any; /** Removes the designated element and returns it if successful */ Remove(Index: number): any; /** - * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. - * @param boolean [Resizable=true] - * @param boolean [Unicode=true] - */ + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * @param boolean [Resizable=true] + * @param boolean [Unicode=true] + */ SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void; /** - * Returns a Vector of Bytes as a String - * @param boolean [Unicode=true] - */ + * Returns a Vector of Bytes as a String + * @param boolean [Unicode=true] + */ String(Unicode?: boolean): string; } @@ -691,5 +691,4 @@ interface EnumeratorConstructor { new(col: WIA.Items): WIA.Item; new(col: WIA.Properties): WIA.Property; new(col: WIA.Vector): any; -} - +} \ No newline at end of file From 3e4e990b4438fae359fc6cb3c1e242a33d031206 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Tue, 27 Jun 2017 02:55:43 +0200 Subject: [PATCH 08/17] dtslint fixes --- types/activex-adodb/index.d.ts | 259 ++++++++++++++++------------- types/activex-scripting/index.d.ts | 97 ++++++----- types/activex-wia/index.d.ts | 137 ++++++++------- 3 files changed, 255 insertions(+), 238 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 8d27b7c706..f2b43ded9d 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,10 +1,9 @@ -// Type definitions for Microsoft ActiveX Data Objects +// Type definitions for ADODB - // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx -// Definitions by: Zev Spitz +// Defintions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ADODB { - const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, adPriorityBelowNormal = 2, @@ -601,18 +600,18 @@ declare namespace ADODB { CommandText: string; CommandTimeout: number; CommandType: CommandTypeEnum; - + /** - * @param string [Name=''] - * @param ADODB.DataTypeEnum [Type=0] - * @param ADODB.ParameterDirectionEnum [Direction=1] - * @param number [Size=0] - */ + * @param string [Name=''] + * @param ADODB.DataTypeEnum [Type=0] + * @param ADODB.ParameterDirectionEnum [Direction=1] + * @param number [Size=0] + */ CreateParameter(Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any): Parameter; Dialect: string; - + /** @param number [Options=-1] */ - Execute(RecordsAffected?: any, Parameters?: any[], Options?: number): Recordset; + Execute(RecordsAffected?: any, Parameters?: any, Options?: number): Recordset; Name: string; NamedParameters: boolean; readonly Parameters: Parameters; @@ -633,18 +632,18 @@ declare namespace ADODB { CursorLocation: CursorLocationEnum; DefaultDatabase: string; readonly Errors: Errors; - + /** @param number [Options=-1] */ Execute(CommandText: string, RecordsAffected: any, Options?: number): Recordset; IsolationLevel: IsolationLevelEnum; Mode: ConnectModeEnum; - + /** - * @param string [ConnectionString=''] - * @param string [UserID=''] - * @param string [Password=''] - * @param number [Options=-1] - */ + * @param string [ConnectionString=''] + * @param string [UserID=''] + * @param string [Password=''] + * @param number [Options=-1] + */ Open(ConnectionString?: string, UserID?: string, Password?: string, Options?: number): void; OpenSchema(Schema: SchemaEnum, Restrictions?: any, SchemaID?: any): Recordset; readonly Properties: Properties; @@ -690,24 +689,23 @@ declare namespace ADODB { } interface Fields { - /** - * @param number [DefinedSize=0] - * @param ADODB.FieldAttributeEnum [Attrib=-1] - */ + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ _Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum): void; - + /** - * @param number [DefinedSize=0] - * @param ADODB.FieldAttributeEnum [Attrib=-1] - */ + * @param number [DefinedSize=0] + * @param ADODB.FieldAttributeEnum [Attrib=-1] + */ Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any): void; CancelUpdate(): void; readonly Count: number; Delete(Index: any): void; Item(Index: any): Field; Refresh(): void; - + /** @param ADODB.ResyncEnum [ResyncValues=2] */ Resync(ResyncValues?: ResyncEnum): void; Update(): void; @@ -751,43 +749,43 @@ declare namespace ADODB { ActiveConnection: any; Cancel(): void; Close(): void; - + /** - * @param string [Source=''] - * @param string [Destination=''] - * @param string [UserName=''] - * @param string [Password=''] - * @param ADODB.CopyRecordOptionsEnum [Options=-1] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.CopyRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ CopyRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean): string; - + /** - * @param string [Source=''] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param boolean [Async=false] + */ DeleteRecord(Source?: string, Async?: boolean): void; readonly Fields: Fields; GetChildren(): Recordset; Mode: ConnectModeEnum; - + /** - * @param string [Source=''] - * @param string [Destination=''] - * @param string [UserName=''] - * @param string [Password=''] - * @param ADODB.MoveRecordOptionsEnum [Options=-1] - * @param boolean [Async=false] - */ + * @param string [Source=''] + * @param string [Destination=''] + * @param string [UserName=''] + * @param string [Password=''] + * @param ADODB.MoveRecordOptionsEnum [Options=-1] + * @param boolean [Async=false] + */ MoveRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean): string; - + /** - * @param ADODB.ConnectModeEnum [Mode=0] - * @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1] - * @param ADODB.RecordOpenOptionsEnum [Options=-1] - * @param string [UserName=''] - * @param string [Password=''] - */ + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1] + * @param ADODB.RecordOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ Open(Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string): void; readonly ParentURL: string; readonly Properties: Properties; @@ -798,14 +796,14 @@ declare namespace ADODB { interface Recordset { _xClone(): Recordset; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ _xResync(AffectRecords?: AffectEnum): void; - + /** - * @param string [FileName=''] - * @param ADODB.PersistFormatEnum [PersistFormat=0] - */ + * @param string [FileName=''] + * @param ADODB.PersistFormatEnum [PersistFormat=0] + */ _xSave(FileName?: string, PersistFormat?: PersistFormatEnum): void; AbsolutePage: PositionEnum; AbsolutePosition: PositionEnum; @@ -816,11 +814,11 @@ declare namespace ADODB { Bookmark: any; CacheSize: number; Cancel(): void; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ CancelBatch(AffectRecords?: AffectEnum): void; CancelUpdate(): void; - + /** @param ADODB.LockTypeEnum [LockType=-1] */ Clone(LockType?: LockTypeEnum): Recordset; Close(): void; @@ -830,30 +828,30 @@ declare namespace ADODB { CursorType: CursorTypeEnum; DataMember: string; DataSource: any; - + /** @param ADODB.AffectEnum [AffectRecords=1] */ Delete(AffectRecords?: AffectEnum): void; readonly EditMode: EditModeEnum; readonly EOF: boolean; readonly Fields: Fields; Filter: any; - + /** - * @param number [SkipRecords=0] - * @param ADODB.SearchDirectionEnum [SearchDirection=1] - */ + * @param number [SkipRecords=0] + * @param ADODB.SearchDirectionEnum [SearchDirection=1] + */ Find(Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any): void; - + /** @param number [Rows=-1] */ GetRows(Rows?: number, Start?: any, Fields?: any): any; - + /** - * @param ADODB.StringFormatEnum [StringFormat=2] - * @param number [NumRows=-1] - * @param string [ColumnDelimeter=''] - * @param string [RowDelimeter=''] - * @param string [NullExpr=''] - */ + * @param ADODB.StringFormatEnum [StringFormat=2] + * @param number [NumRows=-1] + * @param string [ColumnDelimeter=''] + * @param string [RowDelimeter=''] + * @param string [NullExpr=''] + */ GetString(StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string): string; Index: string; LockType: LockTypeEnum; @@ -865,30 +863,30 @@ declare namespace ADODB { MoveNext(): void; MovePrevious(): void; NextRecordset(RecordsAffected?: any): Recordset; - + /** - * @param ADODB.CursorTypeEnum [CursorType=-1] - * @param ADODB.LockTypeEnum [LockType=-1] - * @param number [Options=-1] - */ + * @param ADODB.CursorTypeEnum [CursorType=-1] + * @param ADODB.LockTypeEnum [LockType=-1] + * @param number [Options=-1] + */ Open(Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number): void; readonly PageCount: number; PageSize: number; readonly Properties: Properties; readonly RecordCount: number; - + /** @param number [Options=-1] */ Requery(Options?: number): void; - + /** - * @param ADODB.AffectEnum [AffectRecords=3] - * @param ADODB.ResyncEnum [ResyncValues=2] - */ + * @param ADODB.AffectEnum [AffectRecords=3] + * @param ADODB.ResyncEnum [ResyncValues=2] + */ Resync(AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum): void; - + /** @param ADODB.PersistFormatEnum [PersistFormat=0] */ Save(Destination: any, PersistFormat?: PersistFormatEnum): void; - + /** @param ADODB.SeekEnum [SeekOption=1] */ Seek(KeyValues: any, SeekOption?: SeekEnum): void; Sort: string; @@ -898,7 +896,7 @@ declare namespace ADODB { StayInSync: boolean; Supports(CursorOptions: CursorOptionEnum): boolean; Update(Fields?: any, Values?: any): void; - + /** @param ADODB.AffectEnum [AffectRecords=3] */ UpdateBatch(AffectRecords?: AffectEnum): void; } @@ -907,7 +905,7 @@ declare namespace ADODB { Cancel(): void; Charset: string; Close(): void; - + /** @param number [CharNumber=-1] */ CopyTo(DestStream: Stream, CharNumber?: number): void; readonly EOS: boolean; @@ -915,22 +913,22 @@ declare namespace ADODB { LineSeparator: LineSeparatorEnum; LoadFromFile(FileName: string): void; Mode: ConnectModeEnum; - + /** - * @param ADODB.ConnectModeEnum [Mode=0] - * @param ADODB.StreamOpenOptionsEnum [Options=-1] - * @param string [UserName=''] - * @param string [Password=''] - */ + * @param ADODB.ConnectModeEnum [Mode=0] + * @param ADODB.StreamOpenOptionsEnum [Options=-1] + * @param string [UserName=''] + * @param string [Password=''] + */ Open(Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string): void; Position: number; - + /** @param number [NumBytes=-1] */ Read(NumBytes?: number): any; - + /** @param number [NumChars=-1] */ ReadText(NumChars?: number): string; - + /** @param ADODB.SaveOptionsEnum [Options=1] */ SaveToFile(FileName: string, Options?: SaveOptionsEnum): void; SetEOS(): void; @@ -939,7 +937,7 @@ declare namespace ADODB { readonly State: ObjectStateEnum; Type: StreamTypeEnum; Write(Buffer: any): void; - + /** @param ADODB.StreamWriteEnum [Options=0] */ WriteText(Data: string, Options?: StreamWriteEnum): void; } @@ -947,26 +945,48 @@ declare namespace ADODB { } interface ActiveXObject { - on(obj: ADODB.Connection, eventName: 'BeginTransComplete', eventArgs: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'CommitTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'ConnectComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'Disconnect', eventArgs: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'ExecuteComplete', eventArgs: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'InfoMessage', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'RollbackTransComplete', eventArgs: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'WillConnect', eventArgs: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, eventName: 'WillExecute', eventArgs: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Recordset, eventName: 'EndOfRecordset', eventArgs: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FetchComplete', eventArgs: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FetchProgress', eventArgs: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'FieldChangeComplete', eventArgs: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'MoveComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'RecordChangeComplete', eventArgs: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'RecordsetChangeComplete', eventArgs: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeField', eventArgs: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeRecord', eventArgs: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillChangeRecordset', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, eventName: 'WillMove', eventArgs: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: { + TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'CommitTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, + pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], + handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, + pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'InfoMessage', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, + parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], + handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, + adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, + MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, + Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeRecordset', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, + adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void; new(progid: 'ADODB.Command'): ADODB.Command; new(progid: 'ADODB.Connection'): ADODB.Connection; @@ -981,5 +1001,4 @@ interface EnumeratorConstructor { new(col: ADODB.Fields): ADODB.Field; new(col: ADODB.Parameters): ADODB.Parameter; new(col: ADODB.Properties): ADODB.Property; -} - +} \ No newline at end of file diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 7911113175..1dd659fc7a 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -156,9 +156,9 @@ declare namespace Scripting { Attributes: FileAttribute; /** - * Copy this file - * @param boolean [OverWriteFiles=true] - */ + * Copy this file + * @param boolean [OverWriteFiles=true] + */ Copy(Destination: string, OverWriteFiles?: boolean): void; /** Date file was created */ @@ -171,9 +171,9 @@ declare namespace Scripting { readonly DateLastModified: VarDate; /** - * Delete this file - * @param boolean [Force=false] - */ + * Delete this file + * @param boolean [Force=false] + */ Delete(Force?: boolean): void; /** Get drive that contains file */ @@ -186,10 +186,10 @@ declare namespace Scripting { Name: string; /** - * Open a file as a TextStream - * @param Scripting.IOMode [IOMode=1] - * @param Scripting.Tristate [Format=0] - */ + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param Scripting.Tristate [Format=0] + */ OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream; /** Get folder that contains file */ @@ -228,37 +228,37 @@ declare namespace Scripting { BuildPath(Path: string, Name: string): string; /** - * Copy a file - * @param boolean [OverWriteFiles=true] - */ + * Copy a file + * @param boolean [OverWriteFiles=true] + */ CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void; /** - * Copy a folder - * @param boolean [OverWriteFiles=true] - */ + * Copy a folder + * @param boolean [OverWriteFiles=true] + */ CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void; /** Create a folder */ CreateFolder(Path: string): Folder; /** - * Create a file as a TextStream - * @param boolean [Overwrite=true] - * @param boolean [Unicode=false] - */ + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; /** - * Delete a file - * @param boolean [Force=false] - */ + * Delete a file + * @param boolean [Force=false] + */ DeleteFile(FileSpec: string, Force?: boolean): void; /** - * Delete a folder - * @param boolean [Force=false] - */ + * Delete a folder + * @param boolean [Force=false] + */ DeleteFolder(FolderSpec: string, Force?: boolean): void; /** Check if a drive or a share exists */ @@ -307,9 +307,9 @@ declare namespace Scripting { GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder; /** - * Retrieve the standard input, output or error stream - * @param boolean [Unicode=false] - */ + * Retrieve the standard input, output or error stream + * @param boolean [Unicode=false] + */ GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream; /** Generate name that can be used to name a temporary file */ @@ -322,11 +322,11 @@ declare namespace Scripting { MoveFolder(Source: string, Destination: string): void; /** - * Open a file as a TextStream - * @param Scripting.IOMode [IOMode=1] - * @param boolean [Create=false] - * @param Scripting.Tristate [Format=0] - */ + * Open a file as a TextStream + * @param Scripting.IOMode [IOMode=1] + * @param boolean [Create=false] + * @param Scripting.Tristate [Format=0] + */ OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream; } @@ -337,16 +337,16 @@ declare namespace Scripting { Attributes: FileAttribute; /** - * Copy this folder - * @param boolean [OverWriteFiles=true] - */ + * Copy this folder + * @param boolean [OverWriteFiles=true] + */ Copy(Destination: string, OverWriteFiles?: boolean): void; /** - * Create a file as a TextStream - * @param boolean [Overwrite=true] - * @param boolean [Unicode=false] - */ + * Create a file as a TextStream + * @param boolean [Overwrite=true] + * @param boolean [Unicode=false] + */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; /** Date folder was created */ @@ -359,9 +359,9 @@ declare namespace Scripting { readonly DateLastModified: VarDate; /** - * Delete this folder - * @param boolean [Force=false] - */ + * Delete this folder + * @param boolean [Force=false] + */ Delete(Force?: boolean): void; /** Get drive that contains folder */ @@ -454,9 +454,9 @@ declare namespace Scripting { WriteBlankLines(Lines: number): void; /** - * Write a string and an end of line to the stream - * @param string [Text=''] - */ + * Write a string and an end of line to the stream + * @param string [Text=''] + */ WriteLine(Text?: string): void; } @@ -474,5 +474,4 @@ interface EnumeratorConstructor { new(col: Scripting.Drives): Scripting.Drive; new(col: Scripting.Files): Scripting.File; new(col: Scripting.Folders): Scripting.Folder; -} - +} \ No newline at end of file diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 266902a683..564b7fbf04 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -169,58 +169,58 @@ declare namespace WIA { interface CommonDialog { /** - * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing - * @param WIA.WiaDeviceType [DeviceType=0] - * @param WIA.WiaImageIntent [Intent=0] - * @param WIA.WiaImageBias [Bias=131072] - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - * @param boolean [AlwaysSelectDevice=false] - * @param boolean [UseCommonUI=true] - * @param boolean [CancelError=false] - */ + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ ShowAcquisitionWizard(Device: Device): any; /** - * Displays the properties dialog box for the specified Device - * @param boolean [CancelError=false] - */ + * Displays the properties dialog box for the specified Device + * @param boolean [CancelError=false] + */ ShowDeviceProperties(Device: Device, CancelError?: boolean): void; /** - * Displays the properties dialog box for the specified Item - * @param boolean [CancelError=false] - */ + * Displays the properties dialog box for the specified Item + * @param boolean [CancelError=false] + */ ShowItemProperties(Item: Item, CancelError?: boolean): void; /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ ShowPhotoPrintingWizard(Files: any): void; /** - * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing - * @param WIA.WiaDeviceType [DeviceType=0] - * @param boolean [AlwaysSelectDevice=false] - * @param boolean [CancelError=false] - */ + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing + * @param WIA.WiaDeviceType [DeviceType=0] + * @param boolean [AlwaysSelectDevice=false] + * @param boolean [CancelError=false] + */ ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; /** - * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing - * @param WIA.WiaImageIntent [Intent=0] - * @param WIA.WiaImageBias [Bias=131072] - * @param boolean [SingleSelect=true] - * @param boolean [UseCommonUI=true] - * @param boolean [CancelError=false] - */ + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing + * @param WIA.WiaImageIntent [Intent=0] + * @param WIA.WiaImageBias [Bias=131072] + * @param boolean [SingleSelect=true] + * @param boolean [UseCommonUI=true] + * @param boolean [CancelError=false] + */ ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; /** - * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - * @param boolean [CancelError=false] - */ + * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + * @param boolean [CancelError=false] + */ ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any; } @@ -337,27 +337,27 @@ declare namespace WIA { readonly DeviceInfos: DeviceInfos; /** - * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. - * @param string [DeviceID='*'] - */ + * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * @param string [DeviceID='*'] + */ RegisterEvent(EventID: string, DeviceID?: string): void; /** - * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. - * @param string [DeviceID='*'] - */ + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. + * @param string [DeviceID='*'] + */ RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; /** - * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. - * @param string [DeviceID='*'] - */ + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. + * @param string [DeviceID='*'] + */ UnregisterEvent(EventID: string, DeviceID?: string): void; /** - * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. - * @param string [DeviceID='*'] - */ + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * @param string [DeviceID='*'] + */ UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; } @@ -404,9 +404,9 @@ declare namespace WIA { interface Filters { /** - * Appends/Inserts a new Filter of the specified FilterID into a Filter collection - * @param number [Index=0] - */ + * Appends/Inserts a new Filter of the specified FilterID into a Filter collection + * @param number [Index=0] + */ Add(FilterID: string, Index?: number): void; /** Returns the number of members in the collection */ @@ -522,9 +522,9 @@ declare namespace WIA { readonly Properties: Properties; /** - * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. - * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] - */ + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. + * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] + */ Transfer(FormatID?: string): any; /** Returns the underlying IWiaItem interface for this Item object */ @@ -617,9 +617,9 @@ declare namespace WIA { interface Vector { /** - * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. - * @param number [Index=0] - */ + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. + * @param number [Index=0] + */ Add(Value: any, Index?: number): void; /** Returns/Sets the Vector of Bytes as an array of bytes */ @@ -635,36 +635,36 @@ declare namespace WIA { Date: VarDate; /** - * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. - * @param number [Width=0] - * @param number [Height=0] - */ + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ ImageFile(Width?: number, Height?: number): ImageFile; /** Returns/Sets the specified item in the vector by position */ Item(Index: number): any; /** - * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. - * @param number [Width=0] - * @param number [Height=0] - */ + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * @param number [Width=0] + * @param number [Height=0] + */ Picture(Width?: number, Height?: number): any; /** Removes the designated element and returns it if successful */ Remove(Index: number): any; /** - * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. - * @param boolean [Resizable=true] - * @param boolean [Unicode=true] - */ + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * @param boolean [Resizable=true] + * @param boolean [Unicode=true] + */ SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void; /** - * Returns a Vector of Bytes as a String - * @param boolean [Unicode=true] - */ + * Returns a Vector of Bytes as a String + * @param boolean [Unicode=true] + */ String(Unicode?: boolean): string; } @@ -691,5 +691,4 @@ interface EnumeratorConstructor { new(col: WIA.Items): WIA.Item; new(col: WIA.Properties): WIA.Property; new(col: WIA.Vector): any; -} - +} \ No newline at end of file From ac5f5de41c94b85a9e7cdcee56a6ccbbe13a8ef2 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Tue, 27 Jun 2017 03:02:19 +0200 Subject: [PATCH 09/17] Reverted last commit --- types/activex-adodb/index.d.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index f2b43ded9d..28e7d7f8ff 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,8 +1,3 @@ -// Type definitions for ADODB - -// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx -// Defintions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace ADODB { const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, From 4773e99bd40d0fdca7c77c6f4dc19315dfe81ed6 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Tue, 27 Jun 2017 03:03:03 +0200 Subject: [PATCH 10/17] Restored headers --- types/activex-adodb/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 28e7d7f8ff..f2b43ded9d 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for ADODB - +// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx +// Defintions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace ADODB { const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, From 05605cbc651d338fee89521e321b925026652068 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Tue, 27 Jun 2017 03:06:33 +0200 Subject: [PATCH 11/17] Fixed defintions (again :() --- types/activex-adodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index f2b43ded9d..5e89dcd55c 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for ADODB - // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx -// Defintions by: Zev Spitz +// Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ADODB { From d6d4506541ae066873bd88cc02a9333c01d6688d Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Jun 2017 03:14:26 +0200 Subject: [PATCH 12/17] Long JSDoc, tsconfig.json, tests, merged overloads --- package.json | 3 + types/activex-adodb/activex-adodb-tests.ts | 20 +- types/activex-adodb/index.d.ts | 81 ++-- types/activex-adodb/tsconfig.json | 2 +- .../activex-scripting-tests.ts | 40 +- types/activex-scripting/index.d.ts | 235 ++++++----- types/activex-scripting/tsconfig.json | 2 +- types/activex-wia/activex-wia-tests.ts | 33 +- types/activex-wia/index.d.ts | 372 ++++++++++-------- types/activex-wia/tsconfig.json | 2 +- 10 files changed, 435 insertions(+), 355 deletions(-) diff --git a/package.json b/package.json index 1be6d06c89..efdebf7e3f 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,8 @@ "devDependencies": { "dtslint": "Microsoft/dtslint#production", "types-publisher": "Microsoft/types-publisher#production" + }, + "dependencies": { + "typescript": "^2.5.0-dev.20170627" } } diff --git a/types/activex-adodb/activex-adodb-tests.ts b/types/activex-adodb/activex-adodb-tests.ts index 341bf83108..cadb01c15e 100644 --- a/types/activex-adodb/activex-adodb-tests.ts +++ b/types/activex-adodb/activex-adodb-tests.ts @@ -10,21 +10,21 @@ let obj4 = new ActiveXObject('ADODB.Recordset'); let obj5 = new ActiveXObject('ADODB.Stream'); -//open connection to an Excel file -var pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx'; -var conn = new ActiveXObject('ADODB.Connection'); +// open connection to an Excel file +let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx'; +let conn = new ActiveXObject('ADODB.Connection'); conn.Provider = 'Microsoft.ACE.OLEDB.12.0'; conn.ConnectionString = 'Data Source="' + pathToExcelFile + '";' + 'Extended Properties="Excel 12.0;HDR=Yes"'; conn.Open(); -//create a Command to access the data -var cmd = new ActiveXObject('ADODB.Command'); +// create a Command to access the data +let cmd = new ActiveXObject('ADODB.Command'); cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]'; -//get a Recordset -var rs = cmd.Execute(); -//build a string from the Recordset -var s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)'); +// get a Recordset +let rs = cmd.Execute(); +// build a string from the Recordset +let s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)'); rs.Close(); -WScript.Echo(s); \ No newline at end of file +WScript.Echo(s); diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 5e89dcd55c..2fa62632ad 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ADODB - +// Type definitions for Microsoft ActiveX Data Objects // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -941,52 +941,55 @@ declare namespace ADODB { /** @param ADODB.StreamWriteEnum [Options=0] */ WriteText(Data: string, Options?: StreamWriteEnum): void; } - } interface ActiveXObject { - on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: { + on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'CommitTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, - adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, - adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, - pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], - handler: (this: ADODB.Connection, parameter: {RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, - pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'InfoMessage', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, - adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {pError: ADODB.Error, - adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, - parameter: {ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], - handler: (this: ADODB.Connection, parameter: {Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, - adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; - on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {fMoreData: boolean, - adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {pError: ADODB.Error, - adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {Progress: number, - MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { + adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { + RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'InfoMessage' | 'CommitTransComplete' | 'RollbackTransComplete' | 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { + pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { + ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: ( + this: ADODB.Connection, parameter: { + Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, + pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void; + on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { + fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { + pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { + Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { - adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete' | 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {cFields: number, - Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { + cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; + on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'WillChangeRecordset', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: { + on(obj: ADODB.Recordset, event: 'WillChangeRecordset' | 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: ( + this: ADODB.Recordset, parameter: { adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; - on(obj: ADODB.Recordset, event: 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (this: ADODB.Recordset, parameter: {adReason: ADODB.EventReasonEnum, - adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void; set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void; new(progid: 'ADODB.Command'): ADODB.Command; new(progid: 'ADODB.Connection'): ADODB.Connection; @@ -1001,4 +1004,4 @@ interface EnumeratorConstructor { new(col: ADODB.Fields): ADODB.Field; new(col: ADODB.Parameters): ADODB.Parameter; new(col: ADODB.Properties): ADODB.Property; -} \ No newline at end of file +} diff --git a/types/activex-adodb/tsconfig.json b/types/activex-adodb/tsconfig.json index 01ef1659e1..484faf1ed0 100644 --- a/types/activex-adodb/tsconfig.json +++ b/types/activex-adodb/tsconfig.json @@ -2,7 +2,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["scripthost"], + "lib": ["es5", "scripthost"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 6b460f6347..cc14a421ff 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,8 +1,7 @@ -//source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx +// 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) => { +// Generates a string describing the drive type of a given Drive object. +let showDriveType = (drive: Scripting.Drive) => { switch (drive.DriveType) { case Scripting.DriveTypeConst.Removable: return 'Removeable'; @@ -19,14 +18,13 @@ var showDriveType = (drive: Scripting.Drive) => { } }; - -//Generates a string describing the attributes of a file or folder. -var showFileAttributes = (file: Scripting.File) => { - var attr = file.Attributes; +// Generates a string describing the attributes of a file or folder. +let showFileAttributes = (file: Scripting.File) => { + let attr = file.Attributes; if (attr === 0) { return 'Normal'; } - var attributeStrings: string[] = []; + let 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'); } @@ -38,27 +36,25 @@ var showFileAttributes = (file: Scripting.File) => { 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 + ' - '; +// source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx +let showFreeSpace = (drvPath: string) => { + let fso = new ActiveXObject('Scripting.FileSystemObject'); + let d = fso.GetDrive(fso.GetDriveName(drvPath)); + let s = 'Drive ' + drvPath + ' - '; s += d.VolumeName + '
'; s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes'; return (s); }; +// source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx +let getALine = (filespec: string) => { + let fso = new ActiveXObject('Scripting.FileSystemObject'); + let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); -//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 = ''; + let s = ''; while (!file.AtEndOfLine) { s += file.Read(1); } file.Close(); return (s); -}; \ No newline at end of file +}; diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 1dd659fc7a..e1af9535fd 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -4,6 +4,38 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Scripting { + const enum __MIDL___MIDL_itf_scrrun_0000_0000_0001 { + Alias = 1024, + Archive = 32, + Compressed = 2048, + Directory = 16, + Hidden = 2, + Normal = 0, + ReadOnly = 1, + System = 4, + Volume = 8 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0001 { + CDRom = 4, + Fixed = 2, + RamDisk = 5, + Remote = 3, + Removable = 1, + UnknownType = 0 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0002 { + SystemFolder = 1, + TemporaryFolder = 2, + WindowsFolder = 0 + } + + const enum __MIDL___MIDL_itf_scrrun_0001_0001_0003 { + StdErr = 2, + StdIn = 0, + StdOut = 1 + } const enum CompareMethod { BinaryCompare = 0, @@ -59,268 +91,261 @@ declare namespace Scripting { /** Scripting.Dictionary */ interface Dictionary { - /** Add a new key and item to the dictionary. */ Add(Key: any, Item: any): void; - + /** Set or get the string comparison method. */ CompareMode: CompareMethod; - + /** Get the number of items in the dictionary. */ readonly Count: number; - + /** Determine if a given key is in the dictionary. */ Exists(Key: any): boolean; HashVal(Key: any): any; - + /** Set or get the item for a given key */ Item(Key: any): any; - + /** Get an array containing all items in the dictionary. */ Items(): any; - + /** Change a key to a different key. */ Key(Key: any): any; - + /** Get an array containing all keys in the dictionary. */ Keys(): any; - + /** Remove a given key from the dictionary. */ Remove(Key: any): void; - + /** Remove all information from the dictionary. */ RemoveAll(): void; } /** Drive Object */ interface Drive { - /** Get available space */ readonly AvailableSpace: any; - + /** Drive letter */ readonly DriveLetter: string; - + /** Drive type */ readonly DriveType: DriveTypeConst; - + /** Filesystem type */ readonly FileSystem: string; - + /** Get drive free space */ readonly FreeSpace: any; - + /** Check if disk is available */ readonly IsReady: boolean; - + /** Path */ readonly Path: string; - + /** Root folder */ readonly RootFolder: Folder; - + /** Serial number */ readonly SerialNumber: number; - + /** Share name */ readonly ShareName: string; - + /** Get total drive size */ readonly TotalSize: any; - + /** Name of volume */ VolumeName: string; } /** Collection of drives associated with drive letters */ interface Drives { - /** Number of drives */ readonly Count: number; - + /** Get drive */ Item(Key: any): Drive; } /** Script Encoder Object */ interface Encoder { - /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; } /** File object */ interface File { - /** File attributes */ Attributes: FileAttribute; - + /** * Copy this file * @param boolean [OverWriteFiles=true] */ Copy(Destination: string, OverWriteFiles?: boolean): void; - + /** Date file was created */ readonly DateCreated: VarDate; - + /** Date file was last accessed */ readonly DateLastAccessed: VarDate; - + /** Date file was last modified */ readonly DateLastModified: VarDate; - + /** * Delete this file * @param boolean [Force=false] */ Delete(Force?: boolean): void; - + /** Get drive that contains file */ readonly Drive: Drive; - + /** Move this file */ Move(Destination: string): void; - + /** Get name of file */ Name: string; - + /** * Open a file as a TextStream * @param Scripting.IOMode [IOMode=1] * @param Scripting.Tristate [Format=0] */ OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream; - + /** Get folder that contains file */ readonly ParentFolder: Folder; - + /** Path to the file */ readonly Path: string; - + /** Short name */ readonly ShortName: string; - + /** Short path */ readonly ShortPath: string; - + /** File size */ readonly Size: any; - + /** Type description */ readonly Type: string; } /** Collection of files in a folder */ interface Files { - /** Number of folders */ readonly Count: number; - + /** Get file */ Item(Key: any): File; } /** FileSystem Object */ interface FileSystemObject { - /** Generate a path from an existing path and a name */ BuildPath(Path: string, Name: string): string; - + /** * Copy a file * @param boolean [OverWriteFiles=true] */ CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void; - + /** * Copy a folder * @param boolean [OverWriteFiles=true] */ CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void; - + /** Create a folder */ CreateFolder(Path: string): Folder; - + /** * Create a file as a TextStream * @param boolean [Overwrite=true] * @param boolean [Unicode=false] */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; - + /** * Delete a file * @param boolean [Force=false] */ DeleteFile(FileSpec: string, Force?: boolean): void; - + /** * Delete a folder * @param boolean [Force=false] */ DeleteFolder(FolderSpec: string, Force?: boolean): void; - + /** Check if a drive or a share exists */ DriveExists(DriveSpec: string): boolean; - + /** Get drives collection */ readonly Drives: Drives; - + /** Check if a file exists */ FileExists(FileSpec: string): boolean; - + /** Check if a path exists */ FolderExists(FolderSpec: string): boolean; - + /** Return the canonical representation of the path */ GetAbsolutePathName(Path: string): string; - + /** Return base name from a path */ GetBaseName(Path: string): string; - + /** Get drive or UNC share */ GetDrive(DriveSpec: string): Drive; - + /** Return drive from a path */ GetDriveName(Path: string): string; - + /** Return extension from path */ GetExtensionName(Path: string): string; - + /** Get file */ GetFile(FilePath: string): File; - + /** Return the file name from a path */ GetFileName(Path: string): string; - + /** Retrieve the file version of the specified file into a string */ GetFileVersion(FileName: string): string; - + /** Get folder */ GetFolder(FolderPath: string): Folder; - + /** Return path to the parent folder */ GetParentFolderName(Path: string): string; - + /** Get location of various system folders */ GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder; - + /** * Retrieve the standard input, output or error stream * @param boolean [Unicode=false] */ GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream; - + /** Generate name that can be used to name a temporary file */ GetTempName(): string; - + /** Move a file */ MoveFile(Source: string, Destination: string): void; - + /** Move a folder */ MoveFolder(Source: string, Destination: string): void; - + /** * Open a file as a TextStream * @param Scripting.IOMode [IOMode=1] @@ -332,134 +357,130 @@ declare namespace Scripting { /** Folder object */ interface Folder { - /** Folder attributes */ Attributes: FileAttribute; - + /** * Copy this folder * @param boolean [OverWriteFiles=true] */ Copy(Destination: string, OverWriteFiles?: boolean): void; - + /** * Create a file as a TextStream * @param boolean [Overwrite=true] * @param boolean [Unicode=false] */ CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream; - + /** Date folder was created */ readonly DateCreated: VarDate; - + /** Date folder was last accessed */ readonly DateLastAccessed: VarDate; - + /** Date folder was last modified */ readonly DateLastModified: VarDate; - + /** * Delete this folder * @param boolean [Force=false] */ Delete(Force?: boolean): void; - + /** Get drive that contains folder */ readonly Drive: Drive; - + /** Get files collection */ readonly Files: Files; - + /** True if folder is root */ readonly IsRootFolder: boolean; - + /** Move this folder */ Move(Destination: string): void; - + /** Get name of folder */ Name: string; - + /** Get parent folder */ readonly ParentFolder: Folder; - + /** Path to folder */ readonly Path: string; - + /** Short name */ readonly ShortName: string; - + /** Short path */ readonly ShortPath: string; - + /** Sum of files and subfolders */ readonly Size: any; - + /** Get folders collection */ readonly SubFolders: Folders; - + /** Type description */ readonly Type: string; } /** Collection of subfolders in a folder */ interface Folders { - /** Create a new folder */ Add(Name: string): Folder; - + /** Number of folders */ readonly Count: number; - + /** Get folder */ Item(Key: any): Folder; } /** TextStream object */ interface TextStream { - /** Is the current position at the end of a line? */ readonly AtEndOfLine: boolean; - + /** Is the current position at the end of the stream? */ readonly AtEndOfStream: boolean; - + /** Close a text stream */ Close(): void; - + /** Current column number */ readonly Column: number; - + /** Current line number */ readonly Line: number; - + /** Read a specific number of characters into a string */ Read(Characters: number): string; - + /** Read the entire stream into a string */ ReadAll(): string; - + /** Read an entire line into a string */ ReadLine(): string; - + /** Skip a specific number of characters */ Skip(Characters: number): void; - + /** Skip a line */ SkipLine(): void; - + /** Write a string to the stream */ Write(Text: string): void; - + /** Write a number of blank lines to the stream */ WriteBlankLines(Lines: number): void; - + /** * Write a string and an end of line to the stream * @param string [Text=''] */ WriteLine(Text?: string): void; } - } interface ActiveXObject { @@ -474,4 +495,4 @@ interface EnumeratorConstructor { new(col: Scripting.Drives): Scripting.Drive; new(col: Scripting.Files): Scripting.File; new(col: Scripting.Folders): Scripting.Folder; -} \ No newline at end of file +} diff --git a/types/activex-scripting/tsconfig.json b/types/activex-scripting/tsconfig.json index 454fc20695..190e7bdcd6 100644 --- a/types/activex-scripting/tsconfig.json +++ b/types/activex-scripting/tsconfig.json @@ -2,7 +2,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["scripthost"], + "lib": ["es5", "scripthost"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index e775ec9239..e7e2fcd506 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,31 +1,28 @@ -//source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx +// 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(); +// Convert a file +let commonDialog = new ActiveXObject('WIA.CommonDialog'); +let img = commonDialog.ShowAcquireImage(); if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { - var ip = new ActiveXObject('WIA.ImageProcess'); + let 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(); +// Take a picture +let dev = commonDialog.ShowSelectDevice(); if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { - var itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); + let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); } - -//Display detailed property information +// Display detailed property information dev = commonDialog.ShowSelectDevice(); -var e = new Enumerator(dev.Properties); //no foreach over ActiveX collections +let e = new Enumerator(dev.Properties); // no foreach over ActiveX collections e.moveFirst(); while (!e.atEnd()) { - var p = e.item(); - var s = p.Name + ' (' + p.PropertyID + ') = '; + let p = e.item(); + let s = p.Name + ' (' + p.PropertyID + ') = '; if (p.IsVector) { s += '[vector of data]'; } else { @@ -48,8 +45,8 @@ while (!e.atEnd()) { } else { s += ' [valid values include: '; } - var count = p.SubTypeValues.Count; - for (var i = 1; i <= count; i++) { + let count = p.SubTypeValues.Count; + for (let i = 1; i <= count; i++) { s += p.SubTypeValues.Item(i); if (i < count) { s += ', '; @@ -64,4 +61,4 @@ while (!e.atEnd()) { } WScript.Echo(s); -} \ No newline at end of file +} diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 564b7fbf04..ff7253c335 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace WIA { - /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ const enum CommandID { wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', @@ -46,7 +45,10 @@ declare namespace WIA { wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' } - /** The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device object to obtain these values from the device. */ + /** + * The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device + * object to obtain these values from the device. + */ const enum WiaDeviceType { CameraDeviceType = 2, ScannerDeviceType = 1, @@ -54,7 +56,10 @@ declare namespace WIA { VideoDeviceType = 3 } - /** A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ + /** + * A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEv + * ent.Type and a member from the WiaEventFlags enumeration. + */ const enum WiaEventFlag { ActionEvent = 2, NotificationEvent = 1 @@ -74,7 +79,10 @@ declare namespace WIA { UnspecifiedIntent = 0 } - /** The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection of an ImageFile object. */ + /** + * The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection o + * f an ImageFile object. + */ const enum WiaImagePropertyType { ByteImagePropertyType = 1001, LongImagePropertyType = 1004, @@ -93,7 +101,10 @@ declare namespace WIA { VectorOfUnsignedRationalsImagePropertyType = 1106 } - /** An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ + /** + * An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item + * Flags") and a member from the WiaItemFlags enumeration. + */ const enum WiaItemFlag { AnalyzeItemFlag = 16, AudioItemFlag = 32, @@ -116,7 +127,10 @@ declare namespace WIA { VPanoramaItemFlag = 1024 } - /** The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Device or Item object. */ + /** + * The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Dev + * ice or Item object. + */ const enum WiaPropertyType { BooleanPropertyType = 1, BytePropertyType = 2, @@ -157,7 +171,10 @@ declare namespace WIA { VectorOfVariantsPropertyType = 119 } - /** The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for the property. */ + /** + * The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for t + * he property. + */ const enum WiaSubType { FlagSubType = 3, ListSubType = 2, @@ -165,11 +182,14 @@ declare namespace WIA { UnspecifiedSubType = 0 } - /** The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. */ + /** + * The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be + * created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. + */ interface CommonDialog { - /** - * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object on success, otherwise Nothing + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object + * on success, otherwise Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] @@ -178,36 +198,39 @@ declare namespace WIA { * @param boolean [UseCommonUI=true] * @param boolean [CancelError=false] */ - ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; - + ShowAcquireImage( + DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; + /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ ShowAcquisitionWizard(Device: Device): any; - + /** * Displays the properties dialog box for the specified Device * @param boolean [CancelError=false] */ ShowDeviceProperties(Device: Device, CancelError?: boolean): void; - + /** * Displays the properties dialog box for the specified Item * @param boolean [CancelError=false] */ ShowItemProperties(Item: Item, CancelError?: boolean): void; - + /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ ShowPhotoPrintingWizard(Files: any): void; - + /** - * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise Nothing + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise + * Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param boolean [AlwaysSelectDevice=false] * @param boolean [CancelError=false] */ ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; - + /** - * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an Items collection on success, otherwise Nothing + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an It + * ems collection on success, otherwise Nothing * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] * @param boolean [SingleSelect=true] @@ -215,7 +238,7 @@ declare namespace WIA { * @param boolean [CancelError=false] */ ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; - + /** * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] @@ -226,452 +249,489 @@ declare namespace WIA { /** The Device object represents an active connection to an imaging device. */ interface Device { - /** A collection of all commands for this imaging device */ readonly Commands: DeviceCommands; - + /** Returns the DeviceID for this Device */ readonly DeviceID: string; - + /** A collection of all events for this imaging device */ readonly Events: DeviceEvents; - - /** Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the Commands collection. */ + + /** + * Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the + * Commands collection. + */ ExecuteCommand(CommandID: string): Item; - + /** Returns the Item object specified by ItemID if it exists */ GetItem(ItemID: string): Item; - + /** A collection of all items for this imaging device */ readonly Items: Items; - + /** A collection of all properties for this imaging device */ readonly Properties: Properties; - + /** Returns the Type of Device */ readonly Type: WiaDeviceType; - + /** Returns the underlying IWiaItem interface for this Device object */ readonly WiaItem: any; } /** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */ interface DeviceCommand { - /** Returns the commandID for this Command */ readonly CommandID: string; - + /** Returns the command Description */ readonly Description: string; - + /** Returns the command Name */ readonly Name: string; } - /** The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item object for more details on determining the collection of supported device commands. */ + /** + * The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item obje + * ct for more details on determining the collection of supported device commands. + */ interface DeviceCommands { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection by position */ Item(Index: number): DeviceCommand; } /** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */ interface DeviceEvent { - /** Returns the event Description */ readonly Description: string; - + /** Returns the EventID for this Event */ readonly EventID: string; - + /** Returns the event Name */ readonly Name: string; - + /** Returns the Type of this Event */ readonly Type: WiaEventFlag; } - /** The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more details on determining the collection of supported device events. */ + /** + * The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more det + * ails on determining the collection of supported device events. + */ interface DeviceEvents { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection by position */ Item(Index: number): DeviceEvent; } - /** The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer. */ + /** + * The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer + * . + */ interface DeviceInfo { - /** Establish a connection with this device and return a Device object */ Connect(): Device; - + /** Returns the DeviceID for this Device */ readonly DeviceID: string; - + /** A collection of all properties for this imaging device that are applicable when the device is not connected */ readonly Properties: Properties; - + /** Returns the Type of Device */ readonly Type: WiaDeviceType; } - /** The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManager object for detail on accessing the DeviceInfos object. */ + /** + * The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManage + * r object for detail on accessing the DeviceInfos object. + */ interface DeviceInfos { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection either by position or Device ID */ Item(Index: any): DeviceInfo; } - /** The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. */ + /** + * The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be + * created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. + */ interface DeviceManager { - /** A collection of all imaging devices connected to this computer */ readonly DeviceInfos: DeviceInfos; - + /** - * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any + * device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. * @param string [DeviceID='*'] */ RegisterEvent(EventID: string, DeviceID?: string): void; - + /** - * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full path name and the appropriate command-line arguments needed to invoke the application. + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full pat + * h name and the appropriate command-line arguments needed to invoke the application. * @param string [DeviceID='*'] */ RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; - + /** - * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called RegisterEvent. + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called Regis + * terEvent. * @param string [DeviceID='*'] */ UnregisterEvent(EventID: string, DeviceID?: string): void; - + /** - * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command + * , Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. * @param string [DeviceID='*'] */ UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; } - /** The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's properties and finally use the Apply method of the ImageProcess object to filter an ImageFile. */ + /** + * The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's propertie + * s and finally use the Apply method of the ImageProcess object to filter an ImageFile. + */ interface Filter { - /** Returns a Description of what the filter does */ readonly Description: string; - + /** Returns the FilterID for this Filter */ readonly FilterID: string; - + /** Returns the Filter Name */ readonly Name: string; - + /** A collection of all properties for this filter */ readonly Properties: Properties; } - /** The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos property on the ImageProcess object for details on accessing FilterInfo objects. */ + /** + * The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos pr + * operty on the ImageProcess object for details on accessing FilterInfo objects. + */ interface FilterInfo { - /** Returns a technical Description of what the filter does and how to use it in a filter chain */ readonly Description: string; - + /** Returns the FilterID for this filter */ readonly FilterID: string; - + /** Returns the FilterInfo Name */ readonly Name: string; } - /** The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on accessing the FilterInfos object. */ + /** + * The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on a + * ccessing the FilterInfos object. + */ interface FilterInfos { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection either by position or name */ Item(Index: any): FilterInfo; } /** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */ interface Filters { - /** * Appends/Inserts a new Filter of the specified FilterID into a Filter collection * @param number [Index=0] */ Add(FilterID: string, Index?: number): void; - + /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection by position or FilterID */ Item(Index: number): Filter; - + /** Removes the designated filter */ Remove(Index: number): void; } - /** The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog object for this Item. */ + /** + * The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog ob + * ject for this Item. + */ interface Formats { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection by position */ Item(Index: number): string; } - /** The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files through LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. */ + /** + * The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files throug + * h LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. + */ interface ImageFile { - /** Returns/Sets the current frame in the image */ ActiveFrame: number; - + /** Returns the raw image bits as a Vector of Long values */ readonly ARGBData: Vector; - + /** Returns the raw image file as a Vector of Bytes */ readonly FileData: Vector; - + /** Returns the file extension for this image file type */ readonly FileExtension: string; - + /** Returns the FormatID for this file type */ readonly FormatID: string; - + /** Returns the number of frames in the image */ readonly FrameCount: number; - + /** Returns the Height of the image in pixels */ readonly Height: number; - + /** Returns the Horizontal pixels per inch of the image */ readonly HorizontalResolution: number; - + /** Indicates if the pixel format has an alpha component */ readonly IsAlphaPixelFormat: boolean; - + /** Indicates whether the image is animated */ readonly IsAnimated: boolean; - + /** Indicates if the pixel format is extended (16 bits/channel) */ readonly IsExtendedPixelFormat: boolean; - + /** Indicates if the pixel data is an index into a palette or the actual color data */ readonly IsIndexedPixelFormat: boolean; - + /** Loads the ImageFile object with the specified File */ LoadFile(Filename: string): void; - + /** Returns the depth of the pixels of the image in bits per pixel */ readonly PixelDepth: number; - + /** A collection of all properties for this image */ readonly Properties: Properties; - + /** Save the ImageFile object to the specified File */ SaveFile(Filename: string): void; - + /** Returns the Vertical pixels per inch of the image */ readonly VerticalResolution: number; - + /** Returns the Width of the image in pixels */ readonly Width: number; } /** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */ interface ImageProcess { - /** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */ Apply(Source: ImageFile): ImageFile; - + /** A collection of all available filters */ readonly FilterInfos: FilterInfos; - + /** A collection of the filters to be applied in this process */ readonly Filters: Filters; } - /** The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing Item objects. */ + /** + * The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing It + * em objects. + */ interface Item { - /** A collection of all commands for this item */ readonly Commands: DeviceCommands; - + /** Issues the command specified by CommandID. CommandIDs are device dependent. Valid CommandIDs for this Item are contained in the Commands collection. */ ExecuteCommand(CommandID: string): Item; - + /** A collection of all supported format types for this item */ readonly Formats: Formats; - + /** Returns the ItemID for this Item */ readonly ItemID: string; - + /** A collection of all child items for this item */ readonly Items: Items; - + /** A collection of all properties for this item */ readonly Properties: Properties; - + /** - * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging device. Future versions may return a collection of ImageFile objects. + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging d + * evice. Future versions may return a collection of ImageFile objects. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] */ Transfer(FormatID?: string): any; - + /** Returns the underlying IWiaItem interface for this Item object */ readonly WiaItem: any; } /** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */ interface Items { - /** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */ Add(Name: string, Flags: number): void; - + /** Returns the number of members in the collection */ readonly Count: number; - + /** Returns the specified item in the collection by position */ Item(Index: number): Item; - + /** Removes the designated Item */ Remove(Index: number): void; } - /** The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property on any of these objects for detail on accessing the Properties object. */ + /** + * The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the + * Properties property on any of these objects for detail on accessing the Properties object. + */ interface Properties { - /** Returns the number of members in the collection */ readonly Count: number; - + /** Indicates whether the specified Property exists in the collection */ Exists(Index: any): boolean; - + /** Returns the specified item in the collection either by position or name. */ Item(Index: any): Property; } - /** The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property on any of these objects for details on accessing Property objects. */ + /** + * The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property o + * n any of these objects for details on accessing Property objects. + */ interface Property { - /** Indicates whether the Property Value is read only */ readonly IsReadOnly: boolean; - + /** Indicates whether the Property Value is a vector */ readonly IsVector: boolean; - + /** Returns the Property Name */ readonly Name: string; - + /** Returns the PropertyID of this Property */ readonly PropertyID: number; - + /** Returns the SubType of the Property, if any */ readonly SubType: WiaSubType; - + /** Returns the default Property Value if the SubType is not UnspecifiedSubType */ readonly SubTypeDefault: any; - + /** Returns the maximum valid Property Value if the SubType is RangeSubType */ readonly SubTypeMax: number; - + /** Returns the minimum valid Property Value if the SubType is RangeSubType */ readonly SubTypeMin: number; - + /** Returns the step increment of Property Values if the SubType is RangeSubType */ readonly SubTypeStep: number; - + /** Returns a Vector of valid Property Values if the SubType is ListSubType or valid flag Values that can be ored together if the SubType is FlagSubType */ readonly SubTypeValues: Vector; - + /** Returns either a WiaPropertyType or a WiaImagePropertyType */ readonly Type: number; - + /** Returns/Sets the Property Value */ Value: any; } - /** The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created using "WIA.Rational" in a call to CreateObject. */ + /** + * The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created u + * sing "WIA.Rational" in a call to CreateObject. + */ interface Rational { - /** Returns/Sets the Rational Value Denominator */ Denominator: number; - + /** Returns/Sets the Rational Value Numerator */ Numerator: number; - + /** Returns the Rational Value as a Double */ readonly Value: number; } - /** The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be created using "WIA.Vector" in a call to CreateObject. */ + /** + * The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be create + * d using "WIA.Vector" in a call to CreateObject. + */ interface Vector { - /** - * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vector collection. + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vecto + * r collection. * @param number [Index=0] */ Add(Value: any, Index?: number): void; - + /** Returns/Sets the Vector of Bytes as an array of bytes */ BinaryData: any; - + /** Removes all elements. */ Clear(): void; - + /** Returns the number of members in the vector */ readonly Count: number; - + /** Returns/Sets the Vector of Integers from a Date */ Date: VarDate; - + /** - * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFil + * e from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. * @param number [Width=0] * @param number [Height=0] */ ImageFile(Width?: number, Height?: number): ImageFile; - + /** Returns/Sets the specified item in the vector by position */ Item(Index: number): any; - + /** - * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs mu + * st be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. * @param number [Width=0] * @param number [Height=0] */ Picture(Width?: number, Height?: number): any; - + /** Removes the designated element and returns it if successful */ Remove(Index: number): any; - + /** - * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be sto + * red as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. * @param boolean [Resizable=true] * @param boolean [Unicode=true] */ SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void; - + /** * Returns a Vector of Bytes as a String * @param boolean [Unicode=true] */ String(Unicode?: boolean): string; } - } interface ActiveXObject { - on(obj: WIA.DeviceManager, eventName: 'OnEvent', eventArgs: ['EventID', 'DeviceID', 'ItemID'], handler: (this: WIA.DeviceManager, parameter: {EventID: string, DeviceID: string, ItemID: string}) => void): void; + on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: ( + this: WIA.DeviceManager, parameter: { + EventID: string, DeviceID: string, ItemID: string}) => void): void; set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void; new(progid: 'WIA.CommonDialog'): WIA.CommonDialog; new(progid: 'WIA.DeviceManager'): WIA.DeviceManager; @@ -691,4 +751,4 @@ interface EnumeratorConstructor { new(col: WIA.Items): WIA.Item; new(col: WIA.Properties): WIA.Property; new(col: WIA.Vector): any; -} \ No newline at end of file +} diff --git a/types/activex-wia/tsconfig.json b/types/activex-wia/tsconfig.json index 321e40e36c..b06917d12c 100644 --- a/types/activex-wia/tsconfig.json +++ b/types/activex-wia/tsconfig.json @@ -2,7 +2,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["scripthost"], + "lib": ["es5", "scripthost"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From 1537db2e2e0bc8fa8ff41fdfd09c68fa84972f58 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Jun 2017 03:22:13 +0200 Subject: [PATCH 13/17] Added Typescript Version to WIA, which uses string enums --- types/activex-wia/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index ff7253c335..51ef3c59f7 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -2,6 +2,7 @@ // Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript Version: 2.4 declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ From c93211a70694aee691a208933e73a3b055835aee Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Jun 2017 03:37:33 +0200 Subject: [PATCH 14/17] Reverted changes to package.json --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index efdebf7e3f..1be6d06c89 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,5 @@ "devDependencies": { "dtslint": "Microsoft/dtslint#production", "types-publisher": "Microsoft/types-publisher#production" - }, - "dependencies": { - "typescript": "^2.5.0-dev.20170627" } } From 2f78dfbf51b6cce32ba8df2cb711af9ceaed22a3 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 29 Jun 2017 08:09:22 +0200 Subject: [PATCH 15/17] Added version --- types/activex-adodb/index.d.ts | 2 +- types/activex-scripting/index.d.ts | 2 +- types/activex-wia/index.d.ts | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 2fa62632ad..ec5d67167a 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft ActiveX Data Objects +// Type definitions for Microsoft ActiveX Data Objects 6.1 // Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index e1af9535fd..7ad0ece794 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft Scripting Runtime +// Type definitions for Microsoft Scripting Runtime 1.0 // Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 51ef3c59f7..7d7cbae727 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Windows Image Acquisition +// Type definitions for Windows Image Acquisition 2.0 // Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,16 +6,18 @@ declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ - const enum CommandID { + // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) + /*const enum CommandID { wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}' - } + }*/ /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ - const enum EventID { + // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) + /*const enum EventID { wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}', wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}', wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}', @@ -29,22 +31,24 @@ declare namespace WIA { wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}', wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}', wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}' - } + }*/ /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ - const enum FormatID { + // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) + /*const enum FormatID { wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}', wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}', wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}', wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}', wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}' - } + }*/ /** Miscellaneous string constants */ - const enum Miscellaneous { + // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) + /*const enum Miscellaneous { wiaAnyDeviceID = '*', wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' - } + }*/ /** * The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device From fd0b55db919d02ee3533184bc48784bbc984e5a6 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 29 Jun 2017 08:10:14 +0200 Subject: [PATCH 16/17] Commented out string-valued enums (pending Typescript 2.4, circa end of July 2017) --- types/activex-wia/activex-wia-tests.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index e7e2fcd506..8384291f5d 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -3,17 +3,32 @@ // Convert a file let commonDialog = new ActiveXObject('WIA.CommonDialog'); let img = commonDialog.ShowAcquireImage(); -if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { + +// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: +let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'; +if (img.FormatID !== jpegFormatID) { + let ip = new ActiveXObject('WIA.ImageProcess'); + ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); + ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID; + img = ip.Apply(img); +} +// with this: +/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { let 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 let dev = commonDialog.ShowSelectDevice(); if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { - let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); + // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: + let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; + let itm = dev.ExecuteCommand(commandID); + + // with this: + // let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); } // Display detailed property information From 7f2afd59a6c4ca609f9ec1b9a9c1fd6f2cf9cea0 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 29 Jun 2017 08:16:38 +0200 Subject: [PATCH 17/17] Removed useless generated enums --- types/activex-scripting/index.d.ts | 33 ------------------------------ 1 file changed, 33 deletions(-) diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 7ad0ece794..c4a64c54af 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -4,39 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Scripting { - const enum __MIDL___MIDL_itf_scrrun_0000_0000_0001 { - Alias = 1024, - Archive = 32, - Compressed = 2048, - Directory = 16, - Hidden = 2, - Normal = 0, - ReadOnly = 1, - System = 4, - Volume = 8 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0001 { - CDRom = 4, - Fixed = 2, - RamDisk = 5, - Remote = 3, - Removable = 1, - UnknownType = 0 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0002 { - SystemFolder = 1, - TemporaryFolder = 2, - WindowsFolder = 0 - } - - const enum __MIDL___MIDL_itf_scrrun_0001_0001_0003 { - StdErr = 2, - StdIn = 0, - StdOut = 1 - } - const enum CompareMethod { BinaryCompare = 0, DatabaseCompare = 2,