Jump to content

PowerPoint Wrapper


Toady
 Share

Recommended Posts

Hi everyone,

I was looking for a way to handle an Active Presentation. I started to write a code, but soon an error occured which I couldn't correct yet...

Global $oAppl = ObjGet("", "PowerPoint.Application")
If @error Or Not IsObj($oAppl) Then Exit MsgBox(0, "Error", "Error creating PPT application. @error = " & @error & ", @extended = " & @extended)
Global $oPresInterface = $oAppl.Presentations ; Get presentation interface
Global $oPresentation = $oPresInterface.ActivePresentation

The error of course is on last line... All I want is to create an object related to the current active presentation.

Any help on this would be much appreciated !

Edited by Eazyrider
Link to comment
Share on other sites

Wouldn't that line be:

Global $oPresentation = $oAppl.ActivePresentation

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

... I think you are right indeed ! I can not test that tonight unfortunately, but will let you inform tomorrow morning. But from what I found on the net, it seems that ActivePresentation is a property used on an Application. I'll let you know tomorrow.

Thanks for your help anyway.

Link to comment
Share on other sites

In the includes folder where AutoIt is installed, it's a standard include file with AutoIt.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You do realize that this script was written 6 years ago right? That macro hasn't been in the language in over 3 years, so this script will have to be updated before it will work with the latest version of AutoIt.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Can you please open a new thread in the General Help and Support forum? Questions about INetGet don't belong in a thread about PowerPoint.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • 3 months later...

When i try top open the the PPT, instead of creating a new one (which works fine!), I am getting the following error
 
 
 
 
 
 

$objPPT = _PPT_PowerPointApp()
If @error Then 
    MsgBox(0,"","No PowerPoint available") 
    Exit
EndIf
$PresInterface = _PPT_CreatePresentation($objPPT) ;Get presentation 
interface$objPres = _PPT_PresentationOpen($PresInterface,"C:\Users\s.mailappan\Desktop\3G-Reports\MyAutoItPresentation.ppt") ;Add a new presentation

post-79561-0-71575800-1374253197_thumb.p

Link to comment
Share on other sites

Which version of AutoIt do you run?

Which version of PowerPoint do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

V3 is a bit imprecise.  What does

Msgbox(0, "", @AutoItVersion)

return?

Do you use the 32 or 64 bit version of Office 2010?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Are you sure this part

interface$objPres

of the following line in your script is correct?

interface$objPres = _PPT_PresentationOpen($PresInterface,"C:\Users\s.mailappan\Desktop\3G-Reports\MyAutoItPresentation.ppt") ;Add a new presentation

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • 3 months later...

This is a great tool and helped my create some big slide shows. There is one thing I'm stuck on. How do I indent a point?

For example. 

- Dot Point 1

    - Sub Dot Point 1.1

I have tried  @CRLF & @TAB but it just adds a Tab between the dot and the text. It doesn't bring the dot in.

For example

- Dot Point 1

-     Sub Dot Point 1.1

Link to comment
Share on other sites

So I did some searching and found this... http://msdn.microsoft.com/en-us/library/office/aa223684(v=office.11).aspx

As a result I made this. You're welcome to add it to the main file, hope it can be helpful to the community. If there is a better way of doing this please let me know.

;===============================================================================
;
; Function Name:    _PPT_SlideTextFrameSetIndent()
; Description:      Sets the indent of a paragraph
; Parameter(s):     $obj - Slide object
;                   $intTextFrame - Index of TextFrame on slide
;                   $intParagraph - Paragraph number to Indent
;                   $IndentLevel - Indent Level
; Return Value(s):  On Success - Slide's text frame text set
;                   On Failure - @error = 1, Returns 0
; Author(s):        Smitro based on script by Toady (Josh Bolton)
;
;===============================================================================
Func _PPT_SlideTextFrameSetIndent(ByRef $obj, $intTextFrame, $intParagraph, $IndentLevel)
    If IsObj($obj) <> 1 Then
        SetError(1)
        Return 0
    Else
        $obj.Shapes.Item($intTextFrame).TextFrame.TextRange.Paragraphs($intParagraph).IndentLevel = $IndentLevel
    Endif
EndFunc
Link to comment
Share on other sites

Hi all,

Thanks for the extreme usefull Powerpoint UDF. I added a one liner to include text into the Notesfield of your sheets.

;===============================================================================
;
; Function Name:    _PPT_SlideNotesText()
; Description:      Sets the text in the Notesfield in a slide
; Parameter(s):     $obj - Slide object
;                   $Text - String text
; Return Value(s):  On Success - Nothing
;                   On Failure - @error = 1, Returns 0
; Author(s):        Prutser based on script by Toady (Josh Bolton)
;
;===============================================================================
Func _PPT_SlideNotesText(ByRef $obj, $Text)
    If IsObj($obj) <> 1 Then
        SetError(1)
        Return 0
    Else
        $obj.NotesPage.Shapes(2).TextFrame.TextRange.Text = $Text
    Endif
EndFunc
Edited by prutser
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

  • Recently Browsing   0 members

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