none
Open a Powerpoint Presentation as Slideshow from external Programm RRS feed

  • Question

  • Hello everybody. I have the task to open PowerPoint Presentations which are saved as ppt or pptx from my Javascript Desktop-App  as slideshow.
    What gives me a bit of a headache is, that the parameter "/s" which forces Presentation mode, needs to be attached to  "powerpnt.exe". I found out the correct way would be something like

    "c:\Program Files (x86)\microsoft office\office14\powerpnt.exe" /s "C:path\presentation.pptx"

    But since I do not know the clients Computer or Office Version, I do not know the path to powerpnt.exe.
    Is there any way to attach the "/S"
    to the filename? Then I could send the file and tell Windows to use the Standard Application.




    Thursday, January 26, 2017 6:25 AM

All replies

  • Hi Clavis01,

    you had mentioned that,"I have the task to open PowerPoint Presentations which are saved as ppt or pptx from my Javascript Desktop-App  as slideshow. "

    you developed javascript desktop app. don't know which type of project you are using to develop this app?

    if possible then post your sample code here to open the ppt file.

    we will look in to that and try to solve the issue.

    are you developing any Office addin?

    syntax are different for every language. so it is better if you post your code.

    in vba we can use Presentattion.path.

    Presentation.Path Property (PowerPoint)

    in c++, c#, VB we can find the application installation path by GUID of application.

    How to find the installation path of an Office application

    since I am not aware with your development environment and project type I am not able to suggest you accurately.

    if possible provide the above mentioned details. I will try to suggest you further.

    or you can refer your javascript object model. if it provide this functionality then you can use it.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 27, 2017 1:20 AM
    Moderator
  • Oh. I'm sorry. As I was looking manly for an idea to change the way of appending the "/s" Parameter, I did not think about the code itself. I'm using Electron / Node.js for the app, and at the Moment my code is

    const childProcess = require("child_process");
    childProcess.exec('"c:\\Program Files (x86)\\microsoft office\\office14\\powerpnt.exe" /s "C:\\PathToPowerpoint\\file.pptx"'

    which works as long as I know the path to powerpnt.exe. Another way would be

    let child = childProcess.spawn(fileToOpen, {shell: true});

    Normally I would prefer the second approach for other reasons.

    The first one works, but I would have to scan for powerpnt.exe to set the path, which is quite slow and complex in Node.js. The second one works great for opening anything, but I could not get Powerpoint to start as Presentation in this code.

    A third idea would be to rename every .ppt or .pptx to .pps (which strangley seem to work for pptx as well, as long you don't rename them to .ppsx), but I'm not sure if that would work on every presentation.

    best regards
    Clavis


    Friday, January 27, 2017 6:06 AM
  • Hi Clavis01,

    as you had mentioned that you are using Electron / Node.js for the app.

    generally we use VBA, VB, C# to automate any Office Application.

    so I don't have much idea about Electron / Node.js.

    did you try to pass the (/s) with in single quote?

    for reference you can visit the link mentioned below.

    Child Process Node Js

    if that is not helpful to solve your issue then try to post this issue on Node Js Forum.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 30, 2017 5:56 AM
    Moderator
  • Hi Deepak,

    Thanks for your suggestion, but it seems I was misunderstood. I'm looking not for help with node or Electron (these are questions I'd ask in other forums) but with the CLI-options of Powerpoint.

    I know how to spawn a child process or send a command to the shell, I was just trying to find out if there is any other way sending the "/s" parameter than attaching it to powerpnt.exe, as it is quite complicated in Node to find the path to that file.

    So I was looking for a possibility to start Powerpoint in Presentation-Mode vie Command line with something like:

    start "" "c:\pathToFile\File.pptx" /s

    letting Windows find the correct Program, but still sending the "/s" Parameter.

    best regards
    Clavis

    Monday, January 30, 2017 9:38 AM
  • Hi Clavis01,

    I understand your requirement correctly that you want any way to open powerpoint in presentation mode without passing '/s' parameter.

    so I try to find a way if that possible.

    I try to look in to various documentation. below is one of that.

    Command-line switches for PowerPoint 2007 and the PowerPoint Viewer 2007

    but I think there is no any way available currently that can open powerpoint in presentation mode from command line.

    so it is necessary for you to pass '/s'.

    so you need to find the way to pass it from your code.

    I will try to look further and if I find anything useful that can solve your issue then I will let you know about that.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 31, 2017 2:01 AM
    Moderator
  • Hi Clavis01,

    please refer below code may help you something to solve your issue.

    Add-Type -AssemblyName Microsoft.VisualBasic
    $PPTFile = [Microsoft.VisualBasic.Interaction]::InputBox('Enter FileName', 'Powerpoint File', "$env")
    $pptx = "d:\Presentations"+($pptfile)+".pptx"
    $pptx | Out-File "\\(machine name)\Scripts\Powerpoint.txt"


    Stop-Process -name "POWERPNT"
    $Power = Get-Content "d:\Scripts\Powerpoint.txt"
    write-output $Power
    $powerptx = "/s "+($Power)

    Reference:

    Powershell scipt to open power point and play slide show

    if that don't help you then let me know about that, I will try to contact Powershell Team. whether they can suggest something to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 31, 2017 2:11 AM
    Moderator