Jump to content

TLBAutoEnum.au3 - auto-import of COM constants (enums)


doudou
 Share

Recommended Posts

TLBAutoEnum is an extension UDF for TLIDirect.au3. It allows to use constants defined in COM type libraries as if they were declared in your script.

Little example:

#include "TLBAutoEnum.au3"
_AutoItObject_Startup()

Dim $objFSO = ObjCreate("Scripting.FileSystemObject")
; here constants are imported and declared
_TLBAutoEnum_ImportRelated($objFSO)
; here we use them just like native
Dim $objFile = $objFSO.OpenTextFile(@ScriptFullPath, $IOMode.ForReading, False, $Tristate.TristateUseDefault)
; do something with the file
;...
$objFile.Close()

This UDF offers also possibility to import constants by name, import using multiple type libraries identified by path or GUID - for examples s. attached Usg_TLBAutoEnum.au3.

Note: TLBAutoEnum is now integrated with TLI.au3, please download it there.

Requirements

 

 

Edited by doudou
Files moved to TLI.au3 project

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

It allows to use constants defined in COM type libraries as if they were declared in your script.

Nice.

Maybe it would be better to open existing file by this line:

Dim $objFile = $objFSO.OpenTextFile("TLBAutoEnum.au3", $IOMode.ForReading, False, $Tristate.TristateUseDefault)

:blink:

Thank you.

The point of world view

Link to comment
Share on other sites

Maybe it would be better to open existing file by this line:

Dim $objFile = $objFSO.OpenTextFile("TLBAutoEnum.au3", $IOMode.ForReading, False, $Tristate.TristateUseDefault)

Thx, valid point, I keep forgetting that people could try to run the sample unchanged. I better take @ScriptFullPath though.

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

  • 4 years later...

Hi,

I try to use objects and specialy the constants (enums) on TLB file of object loaded or created in AutoIt but i have always the same error.

I have tested many different version of Autoit since 3.3.2 to 3.3.12, many different version of Autoitobject but no chance...

I have put TLIdirect (and TLI also) and Autoitobject UDF on my project  but when i test your little exemple, i have always the same error.

#include "TLBAutoEnum.au3"

_AutoItObject_Startup()

Dim $objFSO = ObjCreate("Scripting.FileSystemObject")

; here constants are imported and declared

_TLBAutoEnum_ImportRelated($objFSO)

; here we use them just like native

Dim $objFile = $objFSO.OpenTextFile(@ScriptFullPath, $IOMode.ForReading, False, $Tristate.TristateUseDefault)

; do something with the file ;...

$objFile.Close()

Anyone can help me please ?  Thank you very much.
 

error => http://www.imagesup.net/?di=1141711012916

Link to comment
Share on other sites

Hi,

I try to use objects and specialy the constants (enums) on TLB file of object loaded or created in AutoIt but i have always the same error.

I have tested many different version of Autoit since 3.3.2 to 3.3.12, many different version of Autoitobject but no chance...

I have put TLIdirect (and TLI also) and Autoitobject UDF on my project  but when i test your little exemple, i have always the same error.

#include "TLBAutoEnum.au3"

_AutoItObject_Startup()

Dim $objFSO = ObjCreate("Scripting.FileSystemObject")

; here constants are imported and declared

_TLBAutoEnum_ImportRelated($objFSO)

; here we use them just like native

Dim $objFile = $objFSO.OpenTextFile(@ScriptFullPath, $IOMode.ForReading, False, $Tristate.TristateUseDefault)

; do something with the file ;...

$objFile.Close()

Anyone can help me please ?  Thank you very much.

 

error => http://www.imagesup.net/?di=1141711012916

 

This example is working for me. Matter in SciTE. Try script outside it. 

#include "TLBAutoEnum.au3"

_AutoItObject_Startup()

Dim $objFSO = ObjCreate("Scripting.FileSystemObject")

; here constants are imported and declared

_TLBAutoEnum_ImportRelated($objFSO)

; here we use them just like native

Dim $objFile = $objFSO.OpenTextFile(@ScriptFullPath, $IOMode.ForReading, False, $Tristate.TristateUseDefault)

If IsObj($objFile) then 
  MsgBox(0,"","$objFile is Ok!")
endif

$objFile.Close()

The point of world view

Link to comment
Share on other sites

 

This example is working for me. Matter in SciTE. Try script outside it. 

#include "TLBAutoEnum.au3"

_AutoItObject_Startup()

Dim $objFSO = ObjCreate("Scripting.FileSystemObject")

; here constants are imported and declared

_TLBAutoEnum_ImportRelated($objFSO)

; here we use them just like native

Dim $objFile = $objFSO.OpenTextFile(@ScriptFullPath, $IOMode.ForReading, False, $Tristate.TristateUseDefault)

If IsObj($objFile) then 
  MsgBox(0,"","$objFile is Ok!")
endif

$objFile.Close()

 Hi,

Same error when i launch directly the script .

Anyone can help me plz ? Thanks

Link to comment
Share on other sites

  • 2 months later...

...Same error when i launch directly the script ...

 

Sorry for late answer: this forum doesn't allow permanent subscriptions and I have no time for monitoring all topics.

What was exactly your problem? Did you solve it?

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...