rmckay Posted August 26, 2019 Share Posted August 26, 2019 I'm new to AutoIt. I've read all of the posts that I can find about ObjCreateInterface(). In the examples after the object is created it is used for with various methods ie. $object.xxx(). The help file for ObjCreateInterface() states "ObjCreateInterface() creates objects with methods that are listed in interface-description string." Where is the referenced "interface-description string" located? Thanks Link to comment Share on other sites More sharing options...
Bilgus Posted August 27, 2019 Share Posted August 27, 2019 (edited) generally you get it from the object documentation, a com viewer, or in some cases from header files, idl files (typelibs) I'll assume you already saw the example in the helpfile but here it is again Example() Func Example() ; Declare the CLSID, IID and interface description for ITaskbarList. ; It is not necessary to describe the members of IUnknown. Local Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" Local Const $sIID_ITaskbarList = "{56FDF342-FD6D-11D0-958A-006097C9A090}" Local Const $sTagITaskbarList = "HrInit hresult(); AddTab hresult(hwnd); DeleteTab hresult(hwnd); ActivateTab hresult(hwnd); SetActiveAlt hresult(hwnd);" ; Create the object. Local $oTaskbarList = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList) ; Initialize the iTaskbarList object. $oTaskbarList.HrInit() ; Run Notepad. Run("notepad.exe") ; Wait for the Notepad window to appear and get a handle to it. Local $hNotepad = WinWait("[CLASS:Notepad]") ; Tell the user what to look for. MsgBox($MB_SYSTEMMODAL, "", "Look in the Taskbar and you should see an entry for Notepad." & @CRLF & @CRLF & "Press OK to continue.") ; Delete the Notepad entry from the Taskbar. $oTaskbarList.DeleteTab($hNotepad) ; Tell the user to look again. MsgBox($MB_SYSTEMMODAL, "", "Look in the Taskbar. There should no longer be a Notepad entry but Notepad is still running." & @CRLF & @CRLF & "Press OK to continue.") ; Close Notepad. WinClose($hNotepad) EndFunc ;==>Example https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist MSDN is kinda junk for anything beyond verifying you have the correct methods and finding the name of the header file since it doesn't give you the proper order or any of the clsids shobjidl_core.h -- https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ ;;getting closer but still not what we need Ahh here we go! https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/um/ShObjIdl_core.idl#L4635 Now note we got lucky that MS published the sources a decent com viewer is invaluable but doesn't always work Doesn't look like the website is still around but Japheth has a not so bad com viewer https://www.softpedia.com/get/System/System-Info/COMView.shtml#sgal_0 [edit] wayback machine to the rescue https://web.archive.org/web/20140830145525/http://japheth.de/ https://web.archive.org/web/20140614155346fw_/http://www.japheth.de/COMView.html maybe others can point you to some of their favorite COM viewers oh and another place to find some info on obscure interfaces are Visual Basic forums (typically vb6) since thats where OLE/COM pretty much originated Edited August 27, 2019 by Bilgus FrancescoDiMuro 1 Link to comment Share on other sites More sharing options...
Bilgus Posted August 27, 2019 Share Posted August 27, 2019 Also even with the proper interface definitions don't be surprised if you crash Autoit [A BUNCH] its usually a misplaced definition or wrong data type but it can drive you mad because sometimes it perfectly matches and it still crashes Link to comment Share on other sites More sharing options...
rmckay Posted August 27, 2019 Author Share Posted August 27, 2019 HI Bilgus, Thank you so much for the extensive information sources. I've spent hours searching for anything that was even related and pretty much came up with zip. I've now got a place to start and some serious studying at hand. Thanks, rmckay Link to comment Share on other sites More sharing options...
junkew Posted August 30, 2019 Share Posted August 30, 2019 In examples I have an idl to au3 converter that can help. Not finished but helps for 90plus percent to create your in t erfacefile if you have the idl available. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
rmckay Posted September 6, 2019 Author Share Posted September 6, 2019 Thanks junkew Link to comment Share on other sites More sharing options...
seadoggie01 Posted September 8, 2019 Share Posted September 8, 2019 Where does one find .idl files? I checked programs files, but I only got windows related ones. All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
junkew Posted September 8, 2019 Share Posted September 8, 2019 Its easier to tell what you want to achieve then people will let you know if an idl is available. If you create your own programs with visual studio it can create one for you. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
seadoggie01 Posted September 9, 2019 Share Posted September 9, 2019 I just meant in general, I was hoping to explore what idl files were available and consider what would be possible with them. I don't have something in particular that I'm trying to do right now, I've been interested in ObjCreateInterface since I saw it here. All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Gianni Posted September 9, 2019 Share Posted September 9, 2019 12 hours ago, seadoggie01 said: Where does one find .idl files? I checked programs files, but I only got windows related ones. Have a look to this link by @trancexx: seadoggie01 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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