Jump to content
Sign in to follow this  
water

Rewrite of the PowerPoint UDF

Recommended Posts

Hi, 

Great work with this UDF. I was wondering, is it possible to close and quit the powerpoint after the last slide? 

I would like to shutdown the machine after the last slide is done for my purpose..

I am quite new to AutoIT scripting. When I just call the _PPT_Close($oPPT) or $oPPT.Quit in-line, it gets handled multitasked, so

resulting in exiting immidiatly.. I would like to have this to wait until black slide "presentation ended" is on.

Thanks in advance.

; ***********************************************************************************************
; Run entire slide show. Display the show in Speaker mode
; ***********************************************************************************************
; Name              Value   Description
; ppShowTypeKiosk   3       Kiosk
; ppShowTypeSpeaker 1       Speaker
; ppShowTypeWindow  2       Window
; #FUNCTION# ====================================================================================================================
; Name...........: _PPT_SlideShow
; Description ...: Set properties for a slide show and run the show
; Syntax.........: _PPT_SlideShow($oPresentation[, $bRun = True[, $vStartingSlide = 1[, $vEndingSlide = Default[, $bLoop = True[, $iShowType = $ppShowTypeKiosk]]]]])
; Parameters ....: $oPresentation  - Presentation object.
;                  $bRun           - [optional] If True then the function starts the slide show (default = True).
;                  $vStartingSlide - [optional] Name or index of the first slide to be shown (default = 1).
;                  $vEndingSlide   - [optional] Name or index of the last slide to be shown (default = keyword Default = the last slide in the presentation).
;                  $bLoop          - [optional] If True then the slide show starts again when having reached the end (default = True).
;                  $iShowType      - [optional] Type of slide show defined by the PpSlideShowType enumeration (default = $ppShowTypeKiosk).
; Return values .: Success - the slidewindow object when $bRun = True, else 1.
;                  Failure - 0 and sets @error.
;                  |1 - $oPresentation is not an object or not a presentation object
;                  |2 - $vStartingSlide is a number and < 1 or > current number of slides
;                  |3 - $vEndingSlide is a number and < 1 or > current number of slides
;                  |4 - Error occurred when running the slide show. @extended is set to the COM error code returned by the Run method
; Author ........: water
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================

_PPT_SlideShow($oPresentation, True, 1, Default, False, $ppShowTypeSpeaker)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_SlideShow Example 1", "Error running slide show." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_SlideShow Example 1", "Slide show started.")

; *****************************************************************************
; Close the PowerPoint instance
; *****************************************************************************
;_PPT_Close($oPPT)
;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_Close Example 1", "Error closing the PowerPoint application." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

 

Share this post


Link to post
Share on other sites

_PPT_SlideShow returns a SlideShow object.
You could then query the State in a loop until the SlideShow has finished (untested):

$oSlideShow = _PPT_SlideShow(...)
Global Const $ppSlideShowDone = 5 ; Done
While $oSlideShow.View.State <> $ppSlideShowDone
    Sleep(1000) ; check every second
WEnd
; Exit or shutdown here

Or the Application.SlideShowEnd event should be used.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-07-21 - Version 1.5.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
16 minutes ago, water said:

_PPT_SlideShow return a SlideShow object.
You could then query the State in a loop until the SlideShow has finished (untested):

$oSlideShow = _PPT_SlideShow(...)
Global Const $ppSlideShowDone = 5 ; Done
While $oSlideShow.View.State <> $ppSlideShowDone
    Sleep(1000) ; check every second
WEnd
; Exit or shutdown here

Or the Application.SlideShowEnd event should be used.

Many thanks Water, works like a charm! Also thanks for your quick reply. 

 

;_PPT_SlideShow($oPresentation, True, 1, Default, False, $ppShowTypeSpeaker)
;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_SlideShow Example 1", "Error running slide show." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_SlideShow Example 1", "Slide show started.")

$oSlideShow = _PPT_SlideShow($oPresentation, True, 1, Default, False, $ppShowTypeSpeaker)
Global Const $ppSlideShowDone = 5 ; Done
While $oSlideShow.View.State <> $ppSlideShowDone
    Sleep(10000) ; check every 10 seconds
WEnd
; Exit or shutdown here

; *****************************************************************************
; Close the PowerPoint instance
; *****************************************************************************
_PPT_Close($oPPT)
;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_Close Example 1", "Error closing the PowerPoint application." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

 

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-07-21 - Version 1.5.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By pat4005
      A tiny UDF that can shoot magic packets at your computers to wake them the heck up. All credits to Olish.
      The only parameter it needs to be specified – is your machine's MAC-address (ip address (the second parameter), at which you will be sending magic packet is generating automatically from @IPAddress1 macro)
      Example:
      _WoL_WakeDevice('001CC0CAED7A') ; the second parameter (if necessery) must be a broadcast address of your local network segment (i.e. 192.168.0.255 for a network 192.168.0.0)  
      _WakeOnLan.au3
    • By MrCreatoR
      This UDF allows to create formatted label using pseudo element RichLabel (RichEdit actually). Formating is set by using special modificator similar to <font> tag in Html.
      Notes: This UDF is a transformation-continuation of related UDF


      Example:
      Download:
      GUIRichLabel_1.2.zip
      Small syntax related fix: GUIRichLabel_1.1.zip
      GUIRichLabel_1.1.zip
       
      History version:
    • By Stormgrade
      Hello,
      I'm searching the UDF GDIpProgress.au3 from ProgAndy
      None of the links in topic
       works
      Can't someone upload it please ?
    • By ozymandius257
      This is probably a very simple question (I hope!)
      I'm looking to use a UDF to access a SQL database, and have found ADO.au3, but I can't seem to work out how to use it.
      I've copied the files ado.au3 and ado_constants.au3 into the folder C:\Program Files (x86)\AutoIt3\Include, then opened SciTe and started a new project.
      But when I type #include<AD - I don't get offered ADO.au3.
      (I know I should be using the folder C:\Program Files (x86)\AutoIt3\UserInclude, but when it didn't work from there, I tried the above).
      What am I doing wrong?
       
    • By BetaLeaf
      What is Rollbar?
      Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
      Demo: https://rollbar.com/demo/demo/
      Screenshot:
      Instructions: (RollbarTest.au3)
      ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 
      Right now, it is fully functional but not tested in production.
       
       
      Changelog:
      RollbarSDK.au3
      RollbarTest.au3
      v0.2
       
      v0.1.1
       
×
×
  • Create New...