Skip to main content
Deno 2 is finally here šŸŽ‰ļø
Learn more

Sleno

Sleno is a lightweight package that allows you to easily control PowerPoint & Keynote presentations through a simple Deno API

This package is a port of the Slideshow package, as such it has support for Microsoft PowerPoint 2010/2013/2016 for Windows, Microsoft PowerPoint 2011/2016 for Mac OS X and Apple KeyNote 5/6 for Mac OS X. It can determine the current state of the application, gather information about the slides and control the applicationā€™s slideshow mode. It is implemented as a thin Deno API layer on top of platform-specific Windows WSH/JScript and Mac OS X Automator AppleScript/JavaScript connectors.

Known issues

Iā€™ve copied the platform-specific Windows WSH/JScript and Mac OS X Automator AppleScript/JavaScript connectors from the original Slideshow package, so I think these issues also exist on the original package. Right now I donā€™t have the time nor the knowledge to solve these issues but any solutions or bug reports through issues and pull requests are greatly appreciated:

  • On Windows the boot() command wonā€™t always start PowerPoint 2019, if you manually start PowerPoint 2019 the other functions will work fine. I donā€™t know if this issue occurs on other PowerPoint versions such as 2011, 2013 and 2016.

  • On MacOS the slide moving functions donā€™t work, so next(), last(), previous(), next() and goto() resolve successfully but donā€™t actually move the presentation, al other functions (such as the boot() function) work fine.

  • On MacOS Sleno wonā€™t always be able to parse the AppleScript errors, this issue should be relatively easy to solve for someone with knowledge of AppleScripts. The error message should be stringified into JSON before echoing it; the issue can be reproduced by using open() on a non-existent file.

Getting started

Since Deno uses URL based imports we donā€™t need to install anything to get started! To determine your OS we use an unstable API, so please use the --unstable flag when using this package

// Import the Sleno package
import Sleno from "https://deno.land/x/sleno/index.ts";

(async () => {
  // Create a "Sleno" instance for PowerPoint on MacOS
  const sleno = new Sleno("PowerPoint");

  // Start PowerPoint
  await sleno.boot();

  // Open the pptx PowerPoint file
  await sleno.open("sample.pptx");

  // Start the presentation full-screen
  await sleno.start();
})();

There are many more functions that you can check out in your IDE through the power of TypeScript and JSDoc!

Support

  • SUPPORTED: Microsoft PowerPoint 2010 under Windows:
    Fully supported through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • (probably) SUPPORTED: Microsoft PowerPoint 2011 under Windows:
    Expected to be supported (but not tested by the author) through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • (probably) SUPPORTED: Microsoft PowerPoint 2013 under Windows:
    Expected to be supported (but not tested by the author) through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • (probably) SUPPORTED: Microsoft PowerPoint 2016 under Windows:
    Expected to be supported (but not tested by the author) through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • (probably) SUPPORTED: Microsoft PowerPoint 2019 under Windows:
    Expected to be supported (but not tested by the author) through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • SUPPORTED: Microsoft PowerPoint 2019 under Windows:
    Expected to be supported (but not tested by the author) through connector-win-ppt2010, which uses Windows Scripting Host (WST)ā€™s JScript engine and the Component Object Model (COM) of PowerPoint.

  • SUPPORTED: Microsoft PowerPoint 2011 under Mac OS X:
    Fully supported through connector-osx-ppt2011, which uses AppleScript engine and the application Dictionary of the PowerPoint.

  • SUPPORTED: Microsoft PowerPoint 2016 under Mac OS X:
    Fully supported through connector-osx-ppt2011, which uses AppleScript engine and the application Dictionary of the PowerPoint.

  • SUPPORTED: Microsoft PowerPoint 2019 under Mac OS X:
    Fully supported through connector-osx-ppt2011, which uses AppleScript engine and the application Dictionary of the PowerPoint.

  • SUPPORTED: Apple Keynote 5 under Mac OS X:
    Fully supported through connector-osx-kn5, which uses AppleScript engine and the application Dictionary of Keynote.

  • (partially) SUPPORTED: Apple Keynote 6 under Mac OS X:
    Partially supported through connector-osx-kn6, which uses AppleScript engine and the application Dictionary of Keynote. Currently partially broken up to at least Keynote 6.2.2 (August 2014), because the AppleScript support in Keynote 6 still lacks many things Keynote 5 already supported. The main problem currently is that one cannot detect whether a slideshow is playing and that slide changing is reflected in AppleScript only once the Keynote window lost its focus.

Acknowledgement

I barely wrote any of this package, I took the Slideshow package and rewrote the JavaScript layer into a Deno class, as such Iā€™ve barely done any of the research for this package. I want to give a huge thanks to Dr. Ralf S. Engelschall for writing the bulk of the code for this package (and most of the readme.md)!

License

This project is licensed under the MIT License - see the LICENSE.md file for details