Sign in to follow this  
Followers 0
Ajithkumar

How to close the PPT after slide show.

11 posts in this topic

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.

Share this post


Link to post
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>>

Share this post


Link to post
Share on other sites

Thanks for your prompt reply,

I had try this its working....But how can I include My own PPt.

because while run the script,by default it will open new ppt. 

 

please guide me I am new to autoit.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

For the above coding, where can i find the

@ScriptDi folder, how to put my ppt over there 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Please give me the solution for the above issue.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - 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  
Followers 0