doudou

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

7 posts in this topic

#1 ·  Posted (edited)

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.

Requirements

TLBAutoEnum.au3

Usg_TLBAutoEnum.au3

Edited by doudou
1 person likes this

UDFS & Apps:


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 

Share this post


Link to post
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

Share this post


Link to post
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:


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 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

...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:


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 

Share this post


Link to post
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