Jump to content

PowerPoint Wrapper


Toady
 Share

Recommended Posts

This is a wrapper for PowerPoint. It allows you to have control of MS PowerPoint. At work I have to create presentations that are somewhat tedious. Therefor, since no one has tackled this, I suppose I would. So far I have the following functions. See them below. I'm in the process of adding tons more in my spare time. I have attached the PowerPoint include and an example that uses the include. Please comment on the progress I have made so far. I still haven't documented the include as of now but I will soon.

  • _PPT_PowerPointApp()
  • _PPT_PowerPointQuit()
  • _PPT_CreatePresentation()
  • _PPT_PresentationAdd()
  • _PPT_PresentationOpen()
  • _PPT_PresentationSaved()
  • _PPT_PresentationSaveAs()
  • _PPT_PresentationName()
  • _PPT_PresentationClose()
  • _PPT_SlideCreate()
  • _PPT_SlideTextFrameSetText()
  • _PPT_SlideTextFrameGetText()
  • _PPT_SlideTextFrameSetFont()
  • _PPT_SlideTextFrameSetFontSize()
  • _PPT_SlideCount()
  • _PPT_SlideShapeCount()
  • _PPT_SlideAddPicture()
  • _PPT_SlideAddTable()
  • _PPT_SlideAddTextBox()
  • _PPT_SlideShowStartingSlide()
  • _PPT_SlideShowEndingSlide()
  • _PPT_SlideShowWithAnimation()
  • _PPT_SlideShowWithNarration()
  • _PPT_SlideShowLoopUntilStopped()
  • _PPT_SlideShowAdvanceMode()
  • _PPT_SlideShowShowType()
  • _PPT_SlideShowRangeType()
  • _PPT_SlideShowDisplayScrollbars()
  • _PPT_SlideShowAdvanceOnTime()
  • _PPT_SlideShowAdvanceTime()
  • _PPT_SlideShowRun()
  • _PPT_bAssistant()
  • _PPT_SlideSelect()
... more to come.

PPT_Example.au3

Powerpoint.au3

Edited by Toady

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

Nice work, I'd almost started making some PP UDF's after you posted something in the Support Forum :)

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

  • 2 months later...
  • 8 months later...
  • 3 months later...

In response to my original question about the bullets (which has not been answered), I have written 3 UDF's that I believe should be added to the collection:

;===============================================================================
;
; Function Name:    _PPT_SlideTextFrameToggleBullets()
; Description:    Toggles bullet visibility in a specified TextFrame in a slide
; Parameter(s):  $obj - Slide object
;                  $intTextFrame - Index of TextFrame on slide to toggle
; Return Value(s):  On Success - Bullet visibility toggled
;                  On Failure - @error = 1, Returns 0
; Author(s):        calc0000
;
;===============================================================================
Func _PPT_SlideTextFrameToggleBullets(ByRef $obj, $intTextFrame)
    If IsObj($obj) <> 1 Then 
        SetError(1)
        Return 0
    Else
        With $obj.Shapes.Item($intTextFrame).TextFrame.TextRange.ParagraphFormat.Bullet
            .Visible=Not .Visible
        EndWith
    EndIf
EndFunc
;===============================================================================
;
; Function Name:    _PPT_SlideTextFrameGetBullets()
; Description:    Gets whether or not bullets are being displayed on a specified text frame
; Parameter(s):  $obj - Slide object
;                  $intTextFrame - Index of TextFrame on slide
; Return Value(s):  On Success - True or False, depending on whether or not bullets are visible
;                  On Failure - @error = 1, Returns 0
; Author(s):        calc0000
;
;===============================================================================
Func _PPT_SlideTextFrameGetBullets(ByRef $obj, $intTextFrame)
    If IsObj($obj) <> 1 Then 
        SetError(1)
        Return 0
    Else
        Return $obj.Shapes.Item($intTextFrame).TextFrame.TextRange.ParagraphFormat.Bullet.Visible
    EndIf
EndFunc
;===============================================================================
;
; Function Name:    _PPT_SlideTextFrameSetBullets()
; Description:    Sets whether or not bullets will be displayed on a specified text frame
; Parameter(s):  $obj - Slide object
;                  $intTextFrame - Index of TextFrame on slide
;                   $bullets - True or False
; Return Value(s):  On Success - Sets bullet visibility
;                  On Failure - @error = 1, Returns 0
; Author(s):        calc0000
;
;===============================================================================
Func _PPT_SlideTextFrameSetBullets(ByRef $obj, $intTextFrame, $bullets)
    If IsObj($obj) <> 1 Then 
        SetError(1)
        Return 0
    Else
        $obj.Shapes.Item($intTextFrame).TextFrame.TextRange.ParagraphFormat.Bullet.Visible=$bullets
    EndIf
EndFunc
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...

I wonder if this will work with a pps file...^_^

Hate to bring up an old topic but did you ever try this? I need to figure out some method of extracting slides to images.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hate to bring up an old topic but did you ever try this? I need to figure out some method of extracting slides to images.

Hi,

did you get such udf for openoffice.

I have not ppt and it does not work

thank you

Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http
Link to comment
Share on other sites

  • 2 months later...

Hi,

I was looking to open an existing document using the _PPT_PresentationOpen() function. However, the operation fails, giving an error of :

"

The requested action with this object has failed.:

Local $objPres = $obj.Presentations.Open($filepath)

Local $objPres = $obj.Presentations.Open($filepath)^ ERROR

"

The code that I'm using is:

"

$objPPT = _PPT_PowerPointApp()

If @error Then

MsgBox(0,"","No PowerPoint available")

Exit

EndIf

$objPres = _PPT_PresentationOpen($objPPT, $filePath)

"

It would be wonderful if someone could please inform me of my mistake / a solution to the problem. My exposure to AutoIt has been limited, making it difficult for me to debug this on my own.

Thanks in advance.

Edited by testJunkie
Link to comment
Share on other sites

  • 9 months later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...