Jump to content

Recommended Posts

Posted

Hello,

 

Is there a way to get all the properties and method of a COM object thru Autoit.

I am looking in a way of display the imbricated structure of object and method.

 

Example of COm objects are "itunes.application", "Shell.application" and so on.

The idea is to have a code looking like

$objtobrowse = objcreate("itunes.application")

if isobj($objtobrowse) then
$colItems = $objtobrowse.buildinproperty
    For $objItem In $colItems
        ConsoleWrite($objItem.<Name> & " - " & $objItem.<Value> & @CRLF)
    Next
EndIf

 

Posted

I think you could do it using something like this.

 

Saludos

Posted

Maybe this helps:

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Or this one:

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 1/5/2018 at 5:13 PM, Danyfirex said:

I think you could do it using something like this.

 

Saludos

Expand  

Unfortunately as in this thread

Func AssignCOMEnums($sApp, $bShow = 0)

Dim $oTLA, $oTLI, $CstEnum, $CstObj, $CstString,  $oApp

$oApp   = ObjCreate($sApp)
$oTLA   = ObjCreate("TLI.TLIApplication")

$oTLI   = $oTLA.InterfaceInfoFromObject($oApp)

For $CstEnum in $oTLI.Constants
    If "_" <> StringLeft($CstEnum.Name, 1) Then
        For $CstObj In $CstEnum.Members
            Assign("$" & $CstObj.Name, $CstObj.Value, 2)
            If $bShow Then ConsoleWrite("$" & $CstObj.Name & " = " & Eval("$" & $CstObj.Name) & @CR)
        Next
    EndIf
Next

EndFunc

$objx= "Shell.application"

AssignCOMEnums($objx,1)

$oTLA.InterfaceInfoFromObject seems not to works

: ==> Variable must be of type "Object".:
$oTLI   = $oTLA.InterfaceInfoFromObject($oApp)
$oTLI   = $oTLA^ ERROR

 

Any idea why  ?

Posted

I think you need to download and register TLBinF32.DLL

 

Saludos

Posted

Did you register the DLL after downloading?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 1/7/2018 at 12:02 PM, gillesg said:

Should something appear in Oleview ?

Expand  

Don't know.

Did you try the TLBViewer I suggested in post #4? It is a pure AutoIt implementation without the need for any DLLs etc.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

The  TLBViewer  is the equivalent of oleview.exe that I use actually.

My idea is to be able navigate thru the hierarchie of object and displaying the method/attributes they have.

 

Posted

Hello. Here is the way for fixing the create object issue.

Local Const $sCLSID_TLI = "{8B21775E-717D-11CE-AB5B-D41203C10000}"
Local Const $sIID_ITLI = "{8B21775D-717D-11CE-AB5B-D41203C10000}"
Local $oTLI = ObjCreateInterface($sCLSID_TLI, $sIID_ITLI)
ConsoleWrite("$oTLI: " & IsObj($oTLI) & @CRLF)

Add it to your code. I have no too much time for do it.

I dont know the exactly issue of ObjCreate and I will not look into...

Saludos

Posted

All,

Despite the help provided, it is still not working

Func AssignCOMEnums($sApp, $bShow = 0)
    Dim $oTLA, $oTLI, $CstEnum, $CstObj, $CstString, $oApp

    $oApp = ObjCreate($sApp)
    $oTLA = ObjCreate("TLI.TLIApplication")
    If IsObj($oTLA) Then
        ConsoleWrite("objName of bjCreate(""TLI.TLIApplication"") is " & ObjName($oTLA) & @CRLF)
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp)
    Else
        Local Const $sCLSID_TLI = "{8B21775E-717D-11CE-AB5B-D41203C10000}"
        Local Const $sIID_ITLI = "{8B21775D-717D-11CE-AB5B-D41203C10000}"
        $oTLA = ObjCreateInterface($sCLSID_TLI, $sIID_ITLI)
        If isobj($oTLA) Then
            ConsoleWrite("$oTLA object name is  " & ObjName($oTLA) & @CRLF)
        Else
            ConsoleWrite("$oTA is still not an object"&@CRLF)
            exit
        EndIf
    EndIf

    For $CstEnum In $oTLI.Constants
        If "_" <> StringLeft($CstEnum.Name, 1) Then
            For $CstObj In $CstEnum.Members
                Assign("$" & $CstObj.Name, $CstObj.Value, 2)
                If $bShow Then ConsoleWrite("$" & $CstObj.Name & " = " & Eval("$" & $CstObj.Name) & @CR)
            Next
        EndIf
    Next
EndFunc   ;==>AssignCOMEnums

$objx = "Shell.application"
AssignCOMEnums($objx, 1)

 I think i will pass on this one.

Thanks for your time

Posted

Here is an Example. 

 

#AutoIt3Wrapper_Run_AU3Check=n


Func AssignCOMEnums($sApp, $bShow = 0)
    Local $oTLA, $oTLI, $CstEnum, $CstObj, $oApp

    $oApp = ObjCreate($sApp)
    $oTLA = ObjCreate("TLI.TLIApplication")
    If IsObj($oTLA) Then
        ConsoleWrite("objName of bjCreate(""TLI.TLIApplication"") is " & ObjName($oTLA) & @CRLF)
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
    Else
        Local Const $sCLSID_TLI = "{8B21775E-717D-11CE-AB5B-D41203C10000}"
        Local Const $sIID_ITLI = "{8B21775D-717D-11CE-AB5B-D41203C10000}"
        $oTLA = ObjCreateInterface($sCLSID_TLI, $sIID_ITLI)
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
        If isobj($oTLA) Then
            ConsoleWrite("$oTLA object name is  " & ObjName($oTLA) & @CRLF)
        Else
            ConsoleWrite("$oTA is still not an object"&@CRLF)
            exit
        EndIf
    EndIf

    For $CstEnum In $oTLI.Constants
        ConsoleWrite($CstEnum.Name & @CRLF)
        If "_" <> StringLeft($CstEnum.Name, 1) Then
            For $CstObj In $CstEnum.Members
                Assign( $CstObj.Name, $CstObj.Value, 2)
                If $bShow Then ConsoleWrite("$" & $CstObj.Name & " = " & Eval($CstObj.Name) & @CRLF)
            Next
        EndIf
    ExitLoop
    Next

EndFunc   ;==>AssignCOMEnums

Local $objx = "Excel.application"
AssignCOMEnums($objx, 1)
MsgBox(0,"","$xlDrawingObject IsDeclared = " & IsDeclared("xlDrawingObject") & @CRLF & "$xlDrawingObject Value= " & $xlDrawingObject)

Saludos

Posted

Hello,

testing the provided example (but removing last line "Msgbox"). Still have the same error.

Func AssignCOMEnums($sApp, $bShow = 0)
    Local $oTLA, $oTLI, $CstEnum, $CstObj, $oApp

    $oApp = ObjCreate($sApp)
    $oTLA = ObjCreate("TLI.TLIApplication")
    If IsObj($oTLA) Then
        ConsoleWrite("objName of objCreate(""TLI.TLIApplication"") is " & ObjName($oTLA) & @CRLF)
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
    Else
        Local Const $sCLSID_TLI = "{8B21775E-717D-11CE-AB5B-D41203C10000}"
        Local Const $sIID_ITLI = "{8B21775D-717D-11CE-AB5B-D41203C10000}"
        $oTLA = ObjCreateInterface($sCLSID_TLI, $sIID_ITLI)
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
        If isobj($oTLA) Then
            ConsoleWrite("$oTLA object name is  " & ObjName($oTLA) & @CRLF)
        Else
            ConsoleWrite("$oTA is still not an object"&@CRLF)
            exit
        EndIf
        $oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
    EndIf

    For $CstEnum In $oTLI.Constants
        ConsoleWrite($CstEnum.Name & @CRLF)
        If "_" <> StringLeft($CstEnum.Name, 1) Then
            For $CstObj In $CstEnum.Members
                Assign( $CstObj.Name, $CstObj.Value, 2)
                If $bShow Then ConsoleWrite("$" & $CstObj.Name & " = " & Eval($CstObj.Name) & @CRLF)
            Next
        EndIf
    ExitLoop
    Next
EndFunc   ;==>AssignCOMEnums

Local $objx = "Excel.application"
AssignCOMEnums($objx, 1)

reuslt is 

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"D:\Users\gigros\Desktop\Perso Films\AutoIt - itunes\WPD test.au3" (139) : ==> Variable must be of type "Object".:
$oTLI = $oTLA.InterfaceInfoFromObject($oApp).Parent
$oTLI = $oTLA^ ERROR
->09:45:24 AutoIt3.exe ended.rc:1
+>09:45:24 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 4.875

 

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
×
×
  • Create New...