Jump to content

How to close the PPT after slide show.


Ajithkumar
 Share

Recommended Posts

Dear Team,

Have a great day.

Please share me the code for following features,

I Have maintain one folder in c: drive,

In which I am store variuous files like, PPT and excel file.

I need to open the PPT file one by one and for the same it has to automatically close after showing slide show.

please share the code for the details.

Thanks is Advance.

Link to comment
Share on other sites

Dear Team,

Have a great day.

Please share me the code for following features,

I Have maintain one folder in c: drive,

In which I am store variuous files like, PPT and excel file.

I need to open the PPT file one by one and for the same it has to automatically close after showing slide show.

please share the code for the details.

Thanks is Advance.

Take a look here:

'?do=embed' frameborder='0' data-embedContent>>

Link to comment
Share on other sites

Ok, well I would suggest reading up on COM objects. Here is an example I was working on to create a new ppt just so you have an idea on syntax:

#include <WinAPIGdi.au3>

$oPPT = ObjCreate("PowerPoint.Application")
If @error Then
    MsgBox(0, "Error", "No PowerPoint available")
    Exit
EndIf

AddSlide(2, 11, "Example Project")
Func AddSlide($slideNum, $format, $projectName)
    $oPresentation = $oPPT.Presentations.Open(@ScriptDir & "\Test.pptx")
    If @error Then
        MsgBox(0, "Error", "Error opening Presentation")
        Exit
    EndIf
    $rows = 10
    $cols = 3
    $oSlide1 = $oPresentation.Slides.Add($slideNum, $format)
    With $oSlide1
        .Shapes.Item(1).TextFrame.TextRange.Text = $projectName
        .Shapes.AddTextBox(1,35,60,400,50) ;type,left,top,width,height
        .Shapes.Item(2).TextFrame.TextRange.Text = "Overall Status"
        .Shapes.AddTextBox(1,300,60,400,50)
        .Shapes.Item(3).TextFrame.TextRange.Text = "Issues"
        .Shapes.AddTextBox(1,500,60,400,50)
        .Shapes.Item(4).TextFrame.TextRange.Text = "Next Week"
        .Shapes.AddShape(1,30,100,60,120)
        .Shapes.Item(5).Fill.ForeColor.RGB = _WinAPI_RGB(178,178,178)
        .Shapes.AddTable($rows, $cols, 120, 100, 130, 100)
    EndWith
    $oPresentation.SaveAs(@ScriptDir&"\Output.ppt")
    $oPPT.Quit
EndFunc   ;==>AddSlide

First part of this checks to see if PPT exists on the machine.

Basically you need to create the object and then bind it to something.

$oPPT = ObjCreate("PowerPoint.Application")

Creates the object

$oPresentation = $oPPT.Presentations.Open(@ScriptDir & "Test.pptx")

Opens a specific presentation

Then if you want to do operations after that, use $oPresentation. and the COM commands that you can find HERE

There is an overall cheatsheet that will allow you to do some even more robust operations:

http://msdn.microsoft.com/en-us/library/office/ff743835(v=office.15).aspx

Link to comment
Share on other sites

Dear Team,

About this post for more understing ..please find the below script.

But PPt does not close after the slide show .

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

TestFunc1()

; Run TestFunc1
; Finished!
$fullpath = @MyDocumentsDir & 'PPTSample PPT.ppt'
RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_hide)

TestFunc2()

$fullpath = @MyDocumentsDir & 'PPTOEE for September 2014.xlsx'
RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_HIDE)

Send("!f")
Sleep(500)
Send("{DOWN 12}{ENTER}")


Func TestFunc1()



EndFunc   ;==>TestFunc1

; TestFunc2
Func TestFunc2()


EndFunc   ;==>TestFunc2

Link to comment
Share on other sites

Dear Team,

About this post for more understing ..please find the below script.

But PPt does not close after the slide show .

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

TestFunc1()

; Run TestFunc1

; Finished!

$fullpath = @MyDocumentsDir & 'PPTSample PPT.ppt'

RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_hide)

TestFunc2()

$fullpath = @MyDocumentsDir & 'PPTOEE for September 2014.xlsx'

RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_HIDE)

Send("!f")

Sleep(500)

Send("{DOWN 12}{ENTER}")

Func TestFunc1()

EndFunc   ;==>TestFunc1

; TestFunc2

Func TestFunc2()

EndFunc   ;==>TestFunc2

You are making it a lot harder on yourself... Try this (not yet tested):

$fullpath = @MyDocumentsDir & '\PPT\Sample PPT.ppt'
$oPPT = ObjCreate("PowerPoint.Application")
If @error Then
    MsgBox(0, "Error", "No PowerPoint available")
    Exit
EndIf

 $oPresentation = $oPPT.Presentations.Open($fullpath)
 $oPresentation.SlideShowSettings.Run.View

If you use that, you can simply use $oPPT.Quit to close PPT

Edited by Jewtus
Link to comment
Share on other sites

You are making it a lot harder on yourself... Try this (not yet tested):

$fullpath = @MyDocumentsDir & '\PPT\Sample PPT.ppt'
$oPPT = ObjCreate("PowerPoint.Application")
If @error Then
    MsgBox(0, "Error", "No PowerPoint available")
    Exit
EndIf

 $oPresentation = $oPPT.Presentations.Open($fullpath)
 $oPresentation.SlideShowSettings.Run.View

If you use that, you can simply use $oPPT.Quit to close PPT

 

Thanks for your effort.

Inline with the above script,while run the script it showing following error.

$oPresentation.SlideShowSettings.Run.View

$oPresentation^error

Error:Variable must be type of "object"

Please quide me to resolve the issue.

Link to comment
Share on other sites

Can't you just save the ppt as pps and then run the presentation?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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...