gillesg Posted January 5, 2018 Posted January 5, 2018 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
Danyfirex Posted January 5, 2018 Posted January 5, 2018 I think you could do it using something like this. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
water Posted January 5, 2018 Posted January 5, 2018 Maybe this helps: My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted January 5, 2018 Posted January 5, 2018 Or this one: My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
gillesg Posted January 5, 2018 Author Posted January 5, 2018 32 minutes ago, Danyfirex said: I think you could do it using something like this. Saludos 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 ?
Danyfirex Posted January 5, 2018 Posted January 5, 2018 I think you need to download and register TLBinF32.DLL Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
gillesg Posted January 5, 2018 Author Posted January 5, 2018 (edited) 3 hours ago, Danyfirex said: I think you need to download and register TLBinF32.DLL unfortunately, it is not enough. Anyone else any thought ? I am stuck there. I downloaded TLBinF32.dll from https://www.dll-files.com/tlbinf32.dll.html Edited January 5, 2018 by gillesg
gillesg Posted January 7, 2018 Author Posted January 7, 2018 Anyone, I can't read from InterfaceInfoFromObject
water Posted January 7, 2018 Posted January 7, 2018 Did you register the DLL after downloading? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
gillesg Posted January 7, 2018 Author Posted January 7, 2018 2 hours ago, water said: Did you register the DLL after downloading? Yes I did with regsvr32 TLBinF32.dll But still not luck. Should something appear in Oleview ?
water Posted January 7, 2018 Posted January 7, 2018 19 minutes ago, gillesg said: Should something appear in Oleview ? 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: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
gillesg Posted January 7, 2018 Author Posted January 7, 2018 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.
Danyfirex Posted January 8, 2018 Posted January 8, 2018 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 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
gillesg Posted January 8, 2018 Author Posted January 8, 2018 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
Danyfirex Posted January 8, 2018 Posted January 8, 2018 Here is an Example. expandcollapse popup#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 jguinch 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
gillesg Posted January 10, 2018 Author Posted January 10, 2018 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now