Jump to content

1 Screenshot

About This File

Extensive library to control and manipulate Microsoft PowerPoint.
Threads: Help & Support, Wiki

BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort :)

Edited by water

What's New in Version



  • Enhanced documentation
  • Fixed documentation bugs


  • _PPT_CommentAdd: Add a comment anywhere on a Slide or connected to a Shape.
  • _PPT_CommentDelete: Delete a single Comment from a Slide or all Comments from a SlideRange.
  • _PPT_CommentList: Get a list of all Comments in a presentation.

User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

  • Similar Content

    • By water
      I have started to rewrite the PowerPoint UDF similar to the Word, Excel and Outlook UDF. The new UDF will not be compatible with the existing one.
      I will add examples, documentation, a section in the wiki etc.
      So far the following functions have been coded - more are on the ToDo list.
      _PPT_Open: Open a connection to a running instance of PowerPoint or start a new one _PPT_Close: Close a PowerPoint instance _PPT_CommentAdd: Add a Comment anywhere on a Slide or connected to a Shape (version 2021-08-31) _PPT_CommentDelete: Delete a single Comment from a Slide or all Comments from a SlideRange (version 2021-08-31) _PPT_CommentList: Get a list of all Comments in a Presentation (version 2021-08-31) _PPT_ConvertUnits: Convert units (like centimeters) to other units (like points) (version 2021-08-17) _PPT_HeaderFooterList: Returns a list of Headers and Footers for a Presentation (version 2021-07-25, removed with version 2021-08-25) _PPT_HeaderFooterSet: Sets the Header/Footer for a Slide/Slides or the Slide-/Notes-/Handout-/Title-Master of the Presentation (version 2021-08-09) _PPT_PresentationAttach: Attach to an already opened Presentation _PPT_PresentationClose: Close a Presentation _PPT_PresentationExport: Export one/multiple/all Slides as PDF or XPS. _PPT_PresentationExportGraphic: Export one/multiple/all Slides in a graphic format. _PPT_PresentationList: Returns a list of currently open Presentations (version 2021-07-20) _PPT_PresentationNew: Create a new Presentation _PPT_PresentationOpen: Open an existing Presentation _PPT_Print: Print one/multiple/all Slides of a Presentation (version 2021-07-20) _PPT_PresentationSave: Save a Presentation _PPT_PresentationSaveAs: Save a Presentation to another location or with another type _PPT_ShapeAdd: Add a Shape to a single or multiple Slides (version 2021-07-25) _PPT_ShapeAlignDistribute: Aligns and distributes the Shapes in the specified ShapeRange (version - to be released) _PPT_ShapeCopyMove: Copy/move a Shape(s) of a single Slide to a Slide(s) in the same or a different Presentation (version 2021-07-25) _PPT_ShapeDelete: Delete a Shape or Shapes from a single or multiple Slides (version 2021-07-25) _PPT_SlideAdd: Add slide(s) to a Presentation _PPT_SlideCopyMove: Copy, move, duplicate Slide(s) _PPT_SlideDelete: Delete Slide(s) _PPT_SlideShow: Show a Presentation _PPT_TableGet: Extract data from a PowerPoint Table Shape to an array (version 2021-08-17) _PPT_TableSet: Write data to a PowerPoint Table Shape (version 2021-08-17) _PPT_TextFindReplace: Find & replace text throughout entire PowerPoint presentation (version 2021-07-20) _PPT_TextSet: Sets/modifies the Text of a Shape or Shapes of a single or multiple Slides (version 2021-08-09 Which functions do you want me to add to the UDF?
      ToDo list:
      create slide (JLogan3o13) - Done: _PPT_SlideAdd Apply template to slide (JLogan3o13) - Done: _PPT_SlideAdd Apply theme to slide (JLogan3o13) Cut/Copy/Duplicate/Move/Delete slide(s) (JLogan3o13) - Done: _PPT_SlideCopyMove, _PPT_SlideDelete Export slides (JLogan3o13) - Done: _PPT_PresentationExport Cut/Copy/Duplicate/Move/Delete shape(s) (JLogan3o13): Done : _PPT_ShapeCopyMove, _PPT_ShapeDelete (version 2021-07-25) ApplyAnimation, Select, SetDefaultProperties, and zOrder for shape(s) (JLogan3o13) Searching and replacing text (pcjunki) - Done: _PPT_TextFindReplace (version 2021-07-20) Export slides in a graphic format (JPG, GIF, PNG ...) (UEZ) - Done: _PPT_PresentationExportGraphic The UDF can be downloaded from the download forum.
    • 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 DHL
      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)
    • By cramaboule
      Hello all,
      I was very happy to found the ppt wrapper:

      But unfortunately it is not working for PPT VIEWER 2010 (free from Microsoft)

      So I wrote this script to be able to run the ppt on a second screen automatically
      (It works with the normal PPT 2010 as well !):
      I got the _GetMonitors() on this forum as well (not shure where...)

      Global $__MonitorList[1][5], $MonL[5], $MonT[5] #region Detect Monitor $Monitor = _GetMonitors() If $Monitor[0][0] = 2 Then If ($Monitor[1][1] = 0) And ($Monitor[1][2] = 0) Then; According to Microsoft, the Main Monitor has the coordinates 0,0, ..., ... $MonL[2] = $Monitor[2][1] ; Monitor 1 Main - Monitor 2 Display $MonT[2] = $Monitor[2][2] $MonL[1] = $Monitor[1][1] $MonT[1] = $Monitor[1][2] $Mon = 1 Else $MonL[2] = $Monitor[1][1] ; Monitor 2 Main - Monitor 1 Display $MonT[2] = $Monitor[1][2] $MonL[1] = $Monitor[2][1] $MonT[1] = $Monitor[2][2] $Mon = 2 EndIf Else $Mon = 1 ; Only 1 Monitor EndIf #endregion Detect Monitor ShellExecute(@WorkingDir&'\sitemp3.ppt',"",Default,Default, @SW_MINIMIZE ) WinWaitActive("[CLASS:PPTFrameClass]" ) ControlSend("[CLASS:PPTFrameClass]", "", "[CLASSNN:paneClassDC1]", "{F5}") WinSetTrans ( "[CLASS:screenClass]", "", 0 ) WinWaitActive("[CLASS:screenClass]" ) ;full screen mode WinSetTrans ( "[CLASS:screenClass]", "", 0 ) WinMove("[CLASS:screenClass]" , "" , $MonL[2] , $MonT[2] , Default, Default, 1) WinSetTrans ( "[CLASS:screenClass]", "", 255 ) While WinExists ("[CLASS:screenClass]" ) Sleep ("100") WEnd WinClose ("[CLASS:PPTFrameClass]" ) ;================================================================================================== ; Function Name: _GetMonitors() ; Description:: Load monitor positions ; Parameter(s): n/a ; Return Value(s): 2D Array of Monitors ; [0][0] = Number of Monitors ; [i][0] = HMONITOR handle of this monitor. ; [i][1] = Left Position of Monitor ; [i][2] = Top Position of Monitor ; [i][3] = Right Position of Monitor ; [i][4] = Bottom Position of Monitor ; Note: [0][1..4] are set to Left,Top,Right,Bottom of entire screen ; hMonitor is returned in [i][0], but no longer used by these routines. ; Also sets $__MonitorList global variable (for other subs to use) ; Author(s): xrxca (autoit@forums.xrx.ca) ;================================================================================================== Func _GetMonitors() $__MonitorList[0][0] = 0 ; Added so that the global array is reset if this is called multiple times Local $handle = DllCallbackRegister("_MonitorEnumProc", "int", "hwnd;hwnd;ptr;lparam") DllCall("user32.dll", "int", "EnumDisplayMonitors", "hwnd", 0, "ptr", 0, "ptr", DllCallbackGetPtr($handle), "lparam", 0) DllCallbackFree($handle) Local $i = 0 For $i = 1 To $__MonitorList[0][0] If $__MonitorList[$i][1] < $__MonitorList[0][1] Then $__MonitorList[0][1] = $__MonitorList[$i][1] If $__MonitorList[$i][2] < $__MonitorList[0][2] Then $__MonitorList[0][2] = $__MonitorList[$i][2] If $__MonitorList[$i][3] > $__MonitorList[0][3] Then $__MonitorList[0][3] = $__MonitorList[$i][3] If $__MonitorList[$i][4] > $__MonitorList[0][4] Then $__MonitorList[0][4] = $__MonitorList[$i][4] Next Return $__MonitorList EndFunc ;==>_GetMonitors ;================================================================================================== ; Function Name: _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam) ; Description:: Enum Callback Function for EnumDisplayMonitors in _GetMonitors ; Author(s): xrxca (autoit@forums.xrx.ca) ;================================================================================================== Func _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam) Local $Rect = DllStructCreate("int left;int top;int right;int bottom", $lRect) $__MonitorList[0][0] += 1 ReDim $__MonitorList[$__MonitorList[0][0] + 1][5] $__MonitorList[$__MonitorList[0][0]][0] = $hMonitor $__MonitorList[$__MonitorList[0][0]][1] = DllStructGetData($Rect, "left") $__MonitorList[$__MonitorList[0][0]][2] = DllStructGetData($Rect, "top") $__MonitorList[$__MonitorList[0][0]][3] = DllStructGetData($Rect, "right") $__MonitorList[$__MonitorList[0][0]][4] = DllStructGetData($Rect, "bottom") Return 1 ; Return 1 to continue enumeration EndFunc ;==>_MonitorEnumProc
  • Create New...