Followers 0

# PowerPoint COM event handler initialization error

## 12 posts in this topic

#1 ·  Posted (edited)

Hi, I'm getting this error while trying to initialize a com event handler for Office PowerPoint events. The PowerPoint file is displayed correctly, but no events are captured as the ObjEvent() fails :

err.number is: -2147316576
err.windescription: Type mismatch.

err.description is:
err.source is:
err.helpfile is:
err.helpcontext is: 0
err.lastdllerror is: 0
err.scriptline is: 23
err.retcode is: 0

The sourcecode is:

Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler Func MyErrFunc($oError)
ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _ "err.windescription:" & @TAB &$oError.windescription & @CRLF & _
"err.description is: " & @TAB & $oError.description & @CRLF & _ "err.source is: " & @TAB &$oError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB &$oError.helpcontext & @CRLF & _
"err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB &$oError.scriptline & @CRLF & _
"err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc Local$AppPowerPoint = ObjCreate("PowerPoint.Application")
If Not IsObj($AppPowerPoint) Then MsgBox(0, "Error", "$AppPowerPoint is not an Object.")
Else
MsgBox(0, "Error", "Successfully created Object $AppPowerPoint.") EndIf Local$pptEvt = ObjEvent($AppPowerPoint, "PowerPointEvent_") ; Initialize PowerPoint COM event handlers Local$OpenPresentation = $AppPowerPoint.Presentations.Open("C:\Users\DagHendrik\Desktop\test.ppt",True, False, False)$OpenPresentation.SlideShowSettings.ShowPresenterView = 0
$OpenPresentation.SlideShowSettings.ShowType = 1 Local$SlideShowWindow = $OpenPresentation.SlideShowSettings.Run() While True Sleep(10) WEnd Func PowerPointEvent_SlideShowNextSlide($obj)
ConsoleWrite("GetCurrentSlide = " & ($SlideShowwindow.View.Slide.SlideIndex-1) & "<"& @LF) EndFunc Func PowerPointEvent_SlideShowOnNext($obj)
ConsoleWrite("GetCurrentSlide = " & ($SlideShowwindow.View.Slide.SlideIndex-1) & "<"& @LF) EndFunc The script continues fine, but no event are fired as the line with Local$pptEvt = ObjEvent($AppPowerPoint, "PowerPointEvent_") ; Initialize PowerPoint COM event handlers fails. I'm using the latest autoit (v3.3.8.1, 32 bit) And I'm running Office PowerPoint 2013 32bit on a Windows 8 Pro 64 bit installation. Any idea why the ObjEvent() fails? (EDIT: changed to autoit code formatting) Edited by DHL #### Share this post ##### Link to post ##### Share on other sites But doesn't the error happen on line 23 which is "Local$SlideShowWindow = $OpenPresentation.SlideShowSettings.Run()"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### Share this post ##### Link to post ##### Share on other sites #3 · Posted (edited) I think some of the formatting got lost when I copy-pasted the code. The error happens on the line Local$pptEvt = ObjEvent($AppPowerPoint, "PowerPointEvent_") ; Initialize PowerPoint COM event handlers The application and presentation loads fine, but because the event handler initialization failed I don't get any events back when advance through the slides Edited by DHL #### Share this post ##### Link to post ##### Share on other sites I tried here (AutoIt 3.3.8.1, Windows 7 64 bit, Office 2010 32 bit) and get the same error. But I can't see anything wrong. I will check again after I had my coffee My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### Share this post ##### Link to post ##### Share on other sites Great :-) Thanks. #### Share this post ##### Link to post ##### Share on other sites Seems to be a problem with PowerPoint. As soon as I replace "PowerPoint.Application" with "Outlook.Application" or "Excel.Application" the error is gone. Needs some more investigation ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### Share this post ##### Link to post ##### Share on other sites I tried the code with AutoIT 3.3.6.1 and then it worked fine! Seems like something has changed for the worse in AutoIt 3.3.8.1. Any idea? #### Share this post ##### Link to post ##### Share on other sites Some changes have been made to COM (error handling) since 3.3.6.1. IIRC the Devs made some notes that COM support was somehow broken before 3.3.8.1. They fixed it and performance dropped a bit and maybe the problem you see has been caused by this changes too. Could you please download the latest beta version (3.3.9.4) and try again. The latest beta has seen some changes in the COM area again. The beta can be installed in parallel to the production version. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### Share this post ##### Link to post ##### Share on other sites I tried with the latest beta and got the same error: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Users\DagHendrik\Desktop\d.au3" /UserParams +>16:39:42 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000414 OS:WIN_8/ CPU:X64 OS:X64) >Running AU3Check (3.3.9.4) from:C:\Program Files (x86)\AutoIt3\beta +>16:39:42 AU3Check ended.rc:0 >Running:(3.3.9.4):C:\Program Files (x86)\AutoIt3\beta\autoit3.exe "C:\Users\DagHendrik\Desktop\d.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop err.number is: -2147316576 err.windescription: Type mismatch. err.description is: err.source is: err.helpfile is: err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 19 err.retcode is: 0 #### Share this post ##### Link to post ##### Share on other sites Sorry, then I have run out of ideas You can either open an error ticket on Trac or stay with 3.3.6.1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### Share this post ##### Link to post ##### Share on other sites Thanks for the help anyway, water :-) I submitted a ticket here: http://www.autoitscript.com/trac/autoit/ticket/2316 #### Share this post ##### Link to post ##### Share on other sites Let's see what the Devs say ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts Excel - Example Scripts - Wiki Word - Wiki PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support Tutorials: ADO - Wiki #### 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 Followers 0 • ### Similar Content • By gillesg 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 • By timmalos Hey all. I'm a little stuck starting with COM interfacing with Microsoft OneNote. The msdn doc is there : https://msdn.microsoft.com/en-us/library/office/jj680118.aspx?f=255&MSPPError=-2147217396 I found, with the OleViewer what I need to access : // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: 3 [ uuid(0EA692EE-BB50-4E3C-AEF0-356D91732725), version(1.1), helpstring("Microsoft OneNote 15.0 Object Library"), custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 134218339), custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 2147483647), custom(DE77BA65-517C-11D1-A2DA-0000F8773CE9, Created by MIDL version 8.00.0611 at Mon Jan 18 19:14:07 2038 ), custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, Microsoft.Office.Interop.OneNote.dll) ] library OneNote { // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} importlib("stdole2.tlb"); // Forward declare all types defined in this typelib interface IQuickFilingDialog; interface IQuickFilingDialogCallback; interface IApplication; interface Windows; interface Window; dispinterface IOneNoteEvents; typedef [uuid(552E0E02-B287-4EC6-9CC0-4BA019EE5EA1)] enum { hsSelf = 0, hsChildren = 1, hsNotebooks = 2, hsSections = 3, hsPages = 4 } HierarchyScope; typedef [uuid(41C8F6EA-0AF0-4A4F-99E9-5EB01EBFC9A3)] enum { heNone = 0, heNotebooks = 1, heSectionGroups = 2, heSections = 4, hePages = 8 } HierarchyElement; typedef [uuid(4DB67B4F-CC7D-45B5-88FE-569AE5798FF2)] enum { rrtNone = 0, rrtFiling = 1, rrtSearch = 2, rrtLinks = 3 } RecentResultType; typedef [uuid(B5EB9D34-5278-4D8A-AE1F-2F88EA56BBCE)] enum { cftNone = 0, cftNotebook = 1, cftFolder = 2, cftSection = 3 } CreateFileType; typedef [uuid(D6E78E55-7EE7-4A31-BF3E-B01E819599BA)] enum { piBasic = 0, piBinaryData = 1, piSelection = 2, piFileType = 4, piBinaryDataSelection = 3, piBinaryDataFileType = 5, piSelectionFileType = 6, piAll = 7 } PageInfo; typedef [uuid(D6166973-3665-4EDB-94B0-77C65C34B51C)] enum { pfOneNote = 0, pfOneNotePackage = 1, pfMHTML = 2, pfPDF = 3, pfXPS = 4, pfWord = 5, pfEMF = 6, pfHTML = 7, pfOneNote2007 = 8 } PublishFormat; typedef [uuid(E195F3E3-8EC3-4A67-81FE-DDBEC2B42D3F)] enum { slBackUpFolder = 0, slUnfiledNotesSection = 1, slDefaultNotebookFolder = 2 } SpecialLocation; typedef [uuid(452D048E-7F61-4258-94B9-A39E19C290DA)] enum { flEMail = 0, flContacts = 1, flTasks = 2, flMeetings = 3, flWebContent = 4, flPrintOuts = 5 } FilingLocation; typedef [uuid(82FC5A95-FEB7-4242-95E1-369C5DFE3F49)] enum { fltNamedSectionNewPage = 0, fltCurrentSectionNewPage = 1, fltCurrentPage = 2, fltNamedPage = 4 } FilingLocationType; typedef [uuid(226CC8E6-1ED0-4770-A7F1-A80BB4DDF07B)] enum { npsDefault = 0, npsBlankPageWithTitle = 1, npsBlankPageNoTitle = 2 } NewPageStyle; typedef [uuid(B67BC7E1-91B9-4F50-8471-77C76F8D63D6)] enum { dlDefault = 0xffffffff, dlNone = 0, dlLeft = 1, dlRight = 2, dlTop = 3, dlBottom = 4 } DockLocation; typedef [uuid(68555133-B62F-4490-9D66-9E9BFC68F6C6)] enum { xs2007 = 0, xs2010 = 1, xs2013 = 2, xsCurrent = 2 } XMLSchema; typedef [uuid(1ECC88B3-6D2B-4EDD-8DD5-BB11E5D34C09)] enum { tcsExpanded = 0, tcsCollapsed = 1 } TreeCollapsedStateType; typedef [uuid(13F18B04-E76F-42E0-97E6-8B6ABF38B484)] enum { nfoLocal = 1, nfoNetwork = 2, nfoWeb = 4, nfoNoWacUrl = 8 } NotebookFilterOutType; [ odl, uuid(1D12BD3F-89B6-4077-AA2C-C9DC2BCA42F9), helpstring("IQuickFilingUI Interface"), dual, oleautomation ] interface IQuickFilingDialog : IDispatch { [id(00000000), propget] HRESULT Title([out, retval] BSTR* bstrTitle); [id(00000000), propput] HRESULT Title([in] BSTR bstrTitle); [id(0x00000001), propget] HRESULT Description([out, retval] BSTR* bstrDescription); [id(0x00000001), propput] HRESULT Description([in] BSTR bstrDescription); [id(0x00000002), propget] HRESULT CheckboxText([out, retval] BSTR* bstrText); [id(0x00000002), propput] HRESULT CheckboxText([in] BSTR bstrText); [id(0x00000003), propget] HRESULT CheckboxState([out, retval] VARIANT_BOOL* pfChecked); [id(0x00000003), propput] HRESULT CheckboxState([in] VARIANT_BOOL pfChecked); [id(0x00000004), propget] HRESULT WindowHandle([out, retval] uint64* pHWNDWindow); [id(0x00000005), propget] HRESULT TreeDepth([out, retval] HierarchyElement* pTreeDepth); [id(0x00000005), propput] HRESULT TreeDepth([in] HierarchyElement pTreeDepth); [id(0x00000006), propget] HRESULT ParentWindowHandle([out, retval] uint64* pHWNDParentWindow); [id(0x00000006), propput] HRESULT ParentWindowHandle([in] uint64 pHWNDParentWindow); [id(0x00000007), propget] HRESULT Position([out, retval] tagPOINT* pPoint); [id(0x00000007), propput] HRESULT Position([in] tagPOINT pPoint); [id(0x00000008)] HRESULT SetRecentResults( [in] RecentResultType recentResults, [in] VARIANT_BOOL fShowCurrentSection, [in] VARIANT_BOOL fShowCurrentPage, [in] VARIANT_BOOL fShowUnfiledNotes); [id(0x0000000a)] HRESULT AddButton( [in] BSTR bstrText, [in] HierarchyElement allowedElements, [in] HierarchyElement allowedReadOnlyElements, [in] VARIANT_BOOL fDefault); [id(0x0000000b)] HRESULT Run([in] IQuickFilingDialogCallback* piCallback); [id(0x0000000c), propget] HRESULT SelectedItem([out, retval] BSTR* pbstrSelectedNodeID); [id(0x0000000d), propget] HRESULT PressedButton([out, retval] unsigned long* pButtonIndex); [id(0x0000000e), propput] HRESULT TreeCollapsedState([in] TreeCollapsedStateType rhs); [id(0x0000000f), propput] HRESULT NotebookFilterOut([in] NotebookFilterOutType rhs); [id(0x00000010)] HRESULT ShowCreateNewNotebook(); [id(0x00000011)] HRESULT AddInitialEditor(BSTR initialEditor); [id(0x00000012)] HRESULT ClearInitialEditors(); [id(0x00000013)] HRESULT ShowSharingHyperlink(); }; typedef struct tagtagPOINT { long x; long y; } tagPOINT; [ odl, uuid(627EA7B4-95B5-4980-84C1-9D20DA4460B1), helpstring("IQuickFilingDialogCallback Interface"), dual, oleautomation ] interface IQuickFilingDialogCallback : IDispatch { [id(0x60020000)] HRESULT OnDialogClosed([in] IQuickFilingDialog* dialog); }; [ odl, uuid(452AC71A-B655-4967-A208-A4CC39DD7949), helpstring("IApplication Interface"), dual, oleautomation ] interface IApplication : IDispatch { [id(0x60020000)] HRESULT GetHierarchy( [in] BSTR bstrStartNodeID, [in] HierarchyScope hsScope, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020001)] HRESULT UpdateHierarchy( [in] BSTR bstrChangesXmlIn, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020002)] HRESULT OpenHierarchy( [in] BSTR bstrPath, [in] BSTR bstrRelativeToObjectID, [out] BSTR* pbstrObjectID, [in, optional, defaultvalue(0)] CreateFileType cftIfNotExist); [id(0x60020003)] HRESULT DeleteHierarchy( [in] BSTR bstrObjectID, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(0)] VARIANT_BOOL deletePermanently); [id(0x60020004)] HRESULT CreateNewPage( [in] BSTR bstrSectionID, [out] BSTR* pbstrPageID, [in, optional, defaultvalue(0)] NewPageStyle npsNewPageStyle); [id(0x60020005)] HRESULT CloseNotebook( [in] BSTR bstrNotebookID, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x60020006)] HRESULT GetHierarchyParent( [in] BSTR bstrObjectID, [out] BSTR* pbstrParentID); [id(0x60020007)] HRESULT GetPageContent( [in] BSTR bstrPageID, [out] BSTR* pbstrPageXmlOut, [in, optional, defaultvalue(0)] PageInfo pageInfoToExport, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020008)] HRESULT UpdatePageContent( [in] BSTR bstrPageChangesXmlIn, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(2)] XMLSchema xsSchema, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x60020009)] HRESULT GetBinaryPageContent( [in] BSTR bstrPageID, [in] BSTR bstrCallbackID, [out] BSTR* pbstrBinaryObjectB64Out); [id(0x6002000a)] HRESULT DeletePageContent( [in] BSTR bstrPageID, [in] BSTR bstrObjectID, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x6002000b)] HRESULT NavigateTo( [in] BSTR bstrHierarchyObjectID, [in, optional, defaultvalue("")] BSTR bstrObjectID, [in, optional, defaultvalue(0)] VARIANT_BOOL fNewWindow); [id(0x6002000c)] HRESULT NavigateToUrl( [in] BSTR bstrUrl, [in, optional, defaultvalue(0)] VARIANT_BOOL fNewWindow); [id(0x6002000d)] HRESULT Publish( [in] BSTR bstrHierarchyID, [in] BSTR bstrTargetFilePath, [in, optional, defaultvalue(0)] PublishFormat pfPublishFormat, [in, optional, defaultvalue("")] BSTR bstrCLSIDofExporter); [id(0x6002000e)] HRESULT OpenPackage( [in] BSTR bstrPathPackage, [in] BSTR bstrPathDest, [out] BSTR* pbstrPathOut); [id(0x6002000f)] HRESULT GetHyperlinkToObject( [in] BSTR bstrHierarchyID, [in] BSTR bstrPageContentObjectID, [out] BSTR* pbstrHyperlinkOut); [id(0x60020010)] HRESULT FindPages( [in] BSTR bstrStartNodeID, [in] BSTR bstrSearchString, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(0)] VARIANT_BOOL fIncludeUnindexedPages, [in, optional, defaultvalue(0)] VARIANT_BOOL fDisplay, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020011)] HRESULT FindMeta( [in] BSTR bstrStartNodeID, [in] BSTR bstrSearchStringName, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(0)] VARIANT_BOOL fIncludeUnindexedPages, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020012)] HRESULT GetSpecialLocation( [in] SpecialLocation slToGet, [out] BSTR* pbstrSpecialLocationPath); [id(0x60020013)] HRESULT MergeFiles( [in] BSTR bstrBaseFile, [in] BSTR bstrClientFile, [in] BSTR bstrServerFile, [in] BSTR bstrTargetFile); [id(0x60020014)] HRESULT QuickFiling([out, retval] IQuickFilingDialog** ppiDialog); [id(0x60020015)] HRESULT SyncHierarchy([in] BSTR bstrHierarchyID); [id(0x60020016)] HRESULT SetFilingLocation( [in] FilingLocation flToSet, [in] FilingLocationType fltToSet, [in] BSTR bstrFilingSectionID); [id(0x00000064), propget] HRESULT Windows([out, retval] Windows** ppONWindows); [id(0x00000066), propget, hidden] HRESULT Dummy1([out, retval] VARIANT_BOOL* pBool); [id(0x60020019)] HRESULT MergeSections( [in] BSTR bstrSectionSourceId, [in] BSTR bstrSectionDestinationId); [id(0x00000068), propget] HRESULT COMAddIns([out, retval] IDispatch** ppiComAddins); [id(0x00000069), propget] HRESULT LanguageSettings([out, retval] IDispatch** ppiLanguageSettings); [id(0x6002001c)] HRESULT GetWebHyperlinkToObject( [in] BSTR bstrHierarchyID, [in] BSTR bstrPageContentObjectID, [out] BSTR* pbstrHyperlinkOut); }; [ odl, uuid(6D4B9C3E-CC05-493F-85E2-43D1006DF96A), helpstring("List of our Windows Interface"), dual, oleautomation ] interface Windows : IDispatch { [id(00000000), propget] HRESULT Item( [in] unsigned long Index, [out, retval] Window** Item); [id(0x00000001), propget] HRESULT Count([out, retval] unsigned long* Count); [id(0xfffffffc), propget] HRESULT _NewEnum([out, retval] IUnknown** _NewEnum); [id(0x00000003), propget] HRESULT CurrentWindow([out, retval] Window** ppCurrentWindow); }; [ odl, uuid(8E8304B8-CBD1-44F8-B0E8-89C625B2002E), helpstring("Window Interface"), dual, oleautomation ] interface Window : IDispatch { [id(00000000), propget] HRESULT WindowHandle([out, retval] uint64* pHWNDWindow); [id(0x00000001), propget] HRESULT CurrentPageId([out, retval] BSTR* pbstrPageObjectId); [id(0x00000002), propget] HRESULT CurrentSectionId([out, retval] BSTR* pbstrSectionObjectId); [id(0x00000003), propget] HRESULT CurrentSectionGroupId([out, retval] BSTR* pbstrSectionObjectId); [id(0x00000004), propget] HRESULT CurrentNotebookId([out, retval] BSTR* pbstrNotebookObjectId); [id(0x00000009)] HRESULT NavigateTo( [in] BSTR bstrHierarchyObjectID, [in, optional, defaultvalue("0")] BSTR bstrObjectID); [id(0x0000000a), propget] HRESULT FullPageView([out, retval] VARIANT_BOOL* pIsFullPageView); [id(0x0000000a), propput] HRESULT FullPageView(VARIANT_BOOL pIsFullPageView); [id(0x0000000b), propget] HRESULT Active([out, retval] VARIANT_BOOL* pIsActive); [id(0x0000000b), propput] HRESULT Active(VARIANT_BOOL pIsActive); [id(0x0000000d), propget] HRESULT DockedLocation([out, retval] DockLocation* pDockLocation); [id(0x0000000d), propput] HRESULT DockedLocation(DockLocation pDockLocation); [id(0x0000000e), propget] HRESULT Application([out, retval] IApplication** ppiApp); [id(0x0000000f), propget] HRESULT SideNote([out, retval] VARIANT_BOOL* pIsSideNote); [id(0x00000010)] HRESULT NavigateToUrl([in] BSTR bstrUrl); [id(0x00000011)] HRESULT SetDockedLocation( [in] DockLocation DockLocation, [in] tagPOINT ptMonitor); }; [ uuid(E2E1511D-502D-4BD0-8B3A-8A89A05CDCAE), helpstring("IOneNoteEvents Interface"), nonextensible ] dispinterface IOneNoteEvents { properties: methods: [id(0x00000001)] void OnNavigate(); [id(0x00000002)] void OnHierarchyChange([in] BSTR bstrActivePageID); }; [ uuid(D7FAC39E-7FF1-49AA-98CF-A1DDD316337E), version(1.0), helpstring("Application Class") ] coclass Application { [default] interface IApplication; [default, source] dispinterface IOneNoteEvents; }; typedef [uuid(D3F5A756-4BAC-4D3D-9BAF-90935121AAA6)] enum { hrMalformedXML = 0x80042000, hrInvalidXML = 0x80042001, hrCreatingSection = 0x80042002, hrOpeningSection = 0x80042003, hrSectionDoesNotExist = 0x80042004, hrPageDoesNotExist = 0x80042005, hrFileDoesNotExist = 0x80042006, hrInsertingImage = 0x80042007, hrInsertingInk = 0x80042008, hrInsertingHtml = 0x80042009, hrNavigatingToPage = 0x8004200a, hrSectionReadOnly = 0x8004200b, hrPageReadOnly = 0x8004200c, hrInsertingOutlineText = 0x8004200d, hrPageObjectDoesNotExist = 0x8004200e, hrBinaryObjectDoesNotExist = 0x8004200f, hrLastModifiedDateDidNotMatch = 0x80042010, hrGroupDoesNotExist = 0x80042011, hrPageDoesNotExistInGroup = 0x80042012, hrNoActiveSelection = 0x80042013, hrObjectDoesNotExist = 0x80042014, hrNotebookDoesNotExist = 0x80042015, hrInsertingFile = 0x80042016, hrInvalidName = 0x80042017, hrFolderDoesNotExist = 0x80042018, hrInvalidQuery = 0x80042019, hrFileAlreadyExists = 0x8004201a, hrSectionEncryptedAndLocked = 0x8004201b, hrDisabledByPolicy = 0x8004201c, hrNotYetSynchronized = 0x8004201d, hrLegacySection = 0x8004201e, hrMergeFailed = 0x8004201f, hrInvalidXMLSchema = 0x80042020, hrFutureContentLoss = 0x80042022, hrTimeOut = 0x80042023, hrRecordingInProgress = 0x80042024, hrUnknownLinkedNoteState = 0x80042025, hrNoShortNameForLinkedNote = 0x80042026, hrNoFriendlyNameForLinkedNote = 0x80042027, hrInvalidLinkedNoteUri = 0x80042028, hrInvalidLinkedNoteThumbnail = 0x80042029, hrImportLNTThumbnailFailed = 0x8004202a, hrUnreadDisabledForNotebook = 0x8004202b, hrInvalidSelection = 0x8004202c, hrConvertFailed = 0x8004202d, hrRecycleBinEditFailed = 0x8004202e, hrAppInModalUI = 0x80042030 } Error; [ uuid(DC67E480-C3CB-49F8-8232-60B0C2056C8E), version(1.0), helpstring("Application2 Class") ] coclass Application2 { [default] interface IApplication; [default, source] dispinterface IOneNoteEvents; }; }; So far, I didn't manage to be able to interact with it : There is my code (based on same issue someone had in 2011 #AutoIt3Wrapper_UseX64=n #include <Array.au3> #include "AutoItObject\AutoItObject.au3" ;=============================================================================== ;interface "OneNoteIApplication" Global Const$sCLSID_OneNoteApplication = "{0039FFEC-A022-4232-8274-6B34787BFC27}" Global Const $sIID_IOneNoteApplication = "{2DA16203-3F58-404F-839D-E4CDE7DD0DED}" ; Definition Global$dtagIOneNoteWindows = $dtagIDispatch Global$dtagIOneNoteApplication = $dtagIDispatch & _ "GetHierarchy hresult(bstr;dword;bstr*);" & _ "UpdateHierarchy hresult(bstr);" & _ "OpenHierarchy hresult(bstr;bstr;bstr*;dword);" & _ "DeleteHierarchy hresult(bstr;double);" & _ "CreateNewPage hresult(bstr;bstr*;dword);" & _ "CloseNotebook hresult(bstr);" & _ "GetHierarchyParent hresult(bstr;bstr*);" & _ "GetPageContent hresult(bstr;bstr*;dword);" & _ "UpdatePageContent hresult(bstr;double);" & _ "GetBinaryPageContent hresult(bstr;bstr;bstr*);" & _ "DeletePageContent hresult(bstr;bstr;dword);" & _ "NavigateTo hresult(bstr;bstr;bool);" & _ "Publish hresult(bstr;bstr;dword;bstr);" & _ "OpenPackage hresult(bstr;bstr;bstr*);" & _ "GetHyperlinkToObject hresult(bstr;bstr;bstr*);" & _ "FindPages hresult(bstr;bstr;bstr*;bool;bool);" & _ "FindMeta hresult(bstr;bstr;bstr*;bool);" & _ "GetSpecialLocation hresult(dword;bstr*);" ; List Global$ltagIOneNoteApplication = $ltagIDispatch & _ "GetHierarchy;" & _ "UpdateHierarchy;" & _ "OpenHierarchy;" & _ "DeleteHierarchy;" & _ "CreateNewPage;" & _ "CloseNotebook;" & _ "GetHierarchyParent;" & _ "GetPageContent;" & _ "UpdatePageContent;" & _ "GetBinaryPageContent;" & _ "DeletePageContent;" & _ "NavigateTo;" & _ "Publish;" & _ "OpenPackage;" & _ "GetHyperlinkToObject;" & _ "FindPages;" & _ "FindMeta;" & _ "GetSpecialLocation;" ;=============================================================================== _AutoItObject_StartUp() Global$objOneNote = ObjCreate("OneNote.Application") Global $pOneNote = _AutoItObject_IDispatchToPtr($objOneNote) _AutoItObject_IUnknownAddRef($objOneNote) Global$oOneNote = _AutoItObject_WrapperCreate($pOneNote,$dtagIOneNoteWindows) ;~ Global $oOnenote = ObjCreateInterface($sCLSID_OneNoteApplication,$sIID_IOneNoteApplication,$dtagIOneNoteApplication,True) ;~ ; Check if object is created: If Not IsObj($oOneNote) Then MsgBox(48, "Error", "Object not created. Something is wrong.") Exit EndIf$aCall = $oOneNote.GetTypeInfoCount(0)$iTypeInfoCount = $aCall[1] ConsoleWrite("$iTypeInfoCount = " & $iTypeInfoCount & @CRLF)$Window = $oOneNote.Windows ;~ ConsoleWrite("Test = " &$Window.CurrentPageId & @CRLF) $str = "onenote:///R:\Software\OneNote%20EOD\EOD%20Scrum\Sprint%20136.one#section-id={D2EB7AEB-362B-490A-9CE0-0B9316DF0DAD}&end"$hBSTR = DllCall("oleaut32.dll", "ptr", "SysAllocString", "wstr", $str)$aCall = $oOnenote.NavigateToUrl($hBSTR[0])
Can someone help me to go in the good direction? I'm a little lost with what's needed, (CLSID and IID whereas I have only a UUID and can't find a good starting doc online)
Thanks a lot,

• By zetaimmersion
Hi all.
I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea.
Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject.
I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck
COM object i was originally trying to modify
Dim $oPPT,$oPres $oPPT = ObjCreate("PowerPoint.Application")$oPPT.Visible = True $oPres =$oPPT.Presentations.Read Water's code below (0.1% modified)
#include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global$sString2Search = "<username>", $sString2Replace = "Password",$iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile)$oApp = _PPT_PowerPointApp() Local $bChange = False Local$oInterface = $oApp.Presentations Local$oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " &$sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt
• By YellowLab
I am having a very unique, but repeatable problem with ImageMagick COM interface. Here are the applicable lines of code:
$oIM=ObjCreate("ImageMagickObject.MagickImage.1") and then later on...$oIM.Convert(String($arFileList[$nFileIndex])&'[0]',"-alpha", "remove",@TempDir&"\temp.jpg")
the array points to a pdf file with the "convert" command converting the first page of the pdf to a jpg with any alpha layer removed.
Every time, without fail, the first time I run the script on a freshly booted machine it crashes on the \$oIM.Convert command. It does this if it isn't compiled and says there is an error executing the command on the object. If compiled, i get an error that autoit has stopped responding. Anytime I run the script, compiled or not, after this initial crash everything works perfectly fine.
I am totally at a loss as to why this is occurring and how to correct it.