Sign in to follow this  
Followers 0
rubix123

ObjEvent

10 posts in this topic

Hi. I am trying to get an object event to fire when a power point slide show presentation reaches the end of the slide. There is an event called SlideShowEnd in power point but I can't get it to fire in AutoIt using the ObjEvent.

$obj = ObjCreate("PowerPoint.Application")
    
$oEvent = ObjEvent($obj, "SlideEvent_", "SlideShowEnd")

Func SlideEvent_SlideShowBegin()
    
    MsgBox(0,"", "Hello it works")
        
EndFunc

I have created the object and the object event and simply want to test to see if it works by calling a function to display a message box. Any help is much appreciated.

Share this post


Link to post
Share on other sites



Have you looked at the Powerpoint UDF? = powerpoint

I would think you could do this with _PPT_SlideShowEndingSlide


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

The _PPT_SlideShowEndingSlide is a function to set the last slide in the slideshow. I need to know when it hits the ending slide. Our project is to display a series of advertisements (power point slideshow) on a monitor for a certain duration then pause the slideshow and display a broswer window that shows the lobby wait time. So alternating back and forth. The kicker is management wants to pickup where the slideshow left off each time as it alternates back and forth between the lobby wait time and the slideshow advertisements.

The Problem:

If the slideshow picks up where it left off and say it's the second to last slide it will hit the end (a blank screen) for the remaining duration until the lobby wait time screen is displayed. I need to find a work-around to tell it to that when it hits the end to loop back to the beginning of the slideshow for the remaining duration.

Share this post


Link to post
Share on other sites

The OP code never loads the PPT, so no events are fired.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I have a loop that calls a function to set some slideshow parameters and then run the slideshow. When the slide show is running and it reaches the end it doesn't capture the power point SlideShowEnd event. I kinda new at this programming thing and I hope the code below helps, otherwise could you explain what you mean a little more Queen F. Elizabeth?

;-------------------------------------------------------------
;-----------------------Variables-----------------------------

HotKeySet("{BACKSPACE}", "Terminate")

$obj = ObjCreate("PowerPoint.Application")
    
$oEvent = ObjEvent($obj, "SlideEvent_", "SlideShowEnd")

    
$slideStart = 1

;-------------------------------------------------------------
;-----------------------Functions-----------------------------

Func Terminate()
    Send("{ESC}")
    Sleep(500)
    WinClose("[REGEXPTITLE:CheckInTraining]")
    WinClose("[REGEXPTITLE:VLC]")    
    Run(@DesktopDir & "\Automated Presentation\EndScript.bat")
EndFunc

Func setSlideShow()

    With $obj.ActivePresentation.SlideShowSettings
        .RangeType = 2
        .StartingSlide = $slideStart
        .LoopUntilStopped = False
        .Run
    EndWith
    
    
    Sleep(25000)
    Send ("S")

    
EndFunc

Func resetStartSlide()
    Sleep(1000)
    $slideStart = $obj.SlideShowWindows    (1).View.Slide.SlideIndex
    MsgBox(0,"Slide", $slideStart)
    $obj.ActivePresentation.Close
    ;$obj.Quit
    Sleep(2000)
EndFunc

Func SlideEvent_SlideShowBegin()
    
    MsgBox(0,"", "Hello it works")
        
EndFunc


;-------------------------------------------------------------
;--------------------------Main-------------------------------

Example()



Func Example()
    
    
    
While 1
    
    

    ;$objPPT = _PPT_PowerPointApp()
    ;$objPresOpen = _PPT_PresentationOpen($objPPT,@DesktopDir ;&     "\Automated Presentation\Checkintraining.pptx")
    

    ;Local $hDLL = DllOpen("user32.dll")
    
    

    
    
    $obj.Presentations.Open(@DesktopDir & "\Automated Presentation\CheckInTraining.pptx")
    
    

    
    Sleep(4000)
    WinActivate("[REGEXPTITLE:CheckInTraining]")
    Sleep(3500)
    
    setSlideShow()



    resetStartSlide()
    Sleep(2000)

    



    ShellExecute(@DesktopDir & "\Automated Presentation\FASPictures1.mp4")
    Sleep(1000)
    WinActivate("[REGEXPTITLE:VLC]")
    Send ("{f}")
    Sleep(15000)
    Send ("{f}")
    WinClose("[REGEXPTITLE:VLC]")
    Sleep(3000)
        
        
    
    
WEnd

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Does this work for you:

Const $ppSlideShowDone = 5


$oPPT = ObjCreate("PowerPoint.Application")
$oEvent = ObjEvent($oPPT, "SlideEvent_")

$oPresentation = $oPPT.Presentations.Open(@DesktopDir & "\Automated Presentation\CheckInTraining.pptx")

$oSlideShow = $oPresentation.SlideShowSettings.Run.View()

Do
    If @error Then ExitLoop
    Sleep(10)
Until $oSlideShow.State = $ppSlideShowDone


$oPresentation.Close()



Func SlideEvent_SlideShowBegin()
    MsgBox(4096, "", "SlideShowBegin Fired!")
EndFunc
Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

In example in first post is probably mistake about Begin/End

...
$oEvent = ObjEvent($obj, "SlideEvent_", "SlideShowEnd")
Func SlideEvent_SlideShowBegin()
...

probaly shoud be:

...
$oEvent = ObjEvent($obj, "SlideEvent_", "SlideShowEnd")
Func SlideEvent_SlideShowEnd()
...
Edited by Zedna

Share this post


Link to post
Share on other sites

Queen. Isn't that basically the code I already have thought. I created an object and the object event. Have it open up the powerpoint slideshow and try to fire an event to execute the event function.

Share this post


Link to post
Share on other sites

Might I suggest building a kiosk application instead of a PowerPoint presentation if you need finer control? It's an easy job to display a full screen image.

Share this post


Link to post
Share on other sites

Queen. Isn't that basically the code I already have thought. I created an object and the object event. Have it open up the powerpoint slideshow and try to fire an event to execute the event function.

Does that mean that the code I posted doesn't work for you?

If it doesn't work then check what version of AutoIt you run, and update your installation.


♡♡♡

.

eMyvnE

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
Sign in to follow this  
Followers 0