Jump to content

PowerPoint COM event handler initialization error


DHL
 Share

Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

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
Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
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
Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Let's see what the Devs say ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
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
 Share

×
×
  • Create New...