Writing custom code for PowerPoint using leap motion?

Solution 1:

The LEAP Motion Controller Add-ins for Microsoft Office which you found is likely to be the best way to integrate the controller with Powerpoint.

To get started with it, you'll need Visual Studio (seems like you'll need 2012). Microsoft has an overview page for Office Development in Visual Studio.

Follow the instructions on the Configuring a Computer to Develop Office Solutions page.

Download the Leap SDK for Windows, and unzip it, then in Visual Studio in the project GestureLib.NET4.0, add a reference to the LeapCSharp.NET4.0 dll

Make a trivial fix to GestureListener.cs (use IsEmpty at line 44).

After that you ought to be able to run the LEAP Motion Controller Add-in from within Visual Studio. It'll start Powerpoint when you do that.

"VSTO" is the name of the technology you are using here, so for more, Google 'VSTO add-in powerpoint'.

From the source code for the Add-In, it looks like you should see a single button on the ribbon in Powerpoint, for starting and stopping Leap.

Looking at ThisAddIn.cs, once started (by pressing the button on the ribbon), the controller ought to respond to left and right gestures, by moving to next/previous slides respectively:-

                if (direction.ToString() == "Right")
            {
                Application.ActivePresentation.SlideShowWindow.View.Next();
                LastGesture = DateTime.Now;
            }
            if (direction.ToString() == "Left")
            {
                Application.ActivePresentation.SlideShowWindow.View.Previous();
                LastGesture = DateTime.Now;
            }

GestureLib supports additional gestures, which you could make do something following that same pattern.

Solution 2:

If your aim is just to interact with a PowerPoint presentation then a simple solution might be to use BetterTouchTool.

It's designed for OS X, it works with the Leap Motion Controller, it allows you to map gestures (captured by the LM Controller) to keyboard shortcuts and as long as it's configured correctly, it works whilst it's running in the background.

Essentially, it should be possible to map a swipe with X fingers to the right as a press on the right arrow key - which will advance the presentation to the next slide. And so on.

If, however, you are looking for a programmatic challenge/hoping to make this in to an app for Airspace then you could use something like Apache POI's Java API.

This is a lot more complicated solution, but it does have the benefit that it will run on OS X - and requires you to muck around with some code :).

It seems like the easiest solution would be to follow the example for exporting the slides in to images. You now have a collection of images - one for each PowerPoint slide. This gives you quite a lot of options, such as

  • You can treat this data an an in-memory database (and a web service) and go back to your comfort zone of PHP and JS and use the JS API for the Leap Motion Controller to capture gestures to drive essentially an online picture gallery.
  • You can develop a pure Java solution using the Java API to capture gestures from the Leap Motion Controller and display the data using Swing/JavaFX or in the browser using JSF.

Solution 3:

A very simple solution could look like this:

  1. Build a basic C# application based on the LeapMotion API (you can use the C# example app from ther SDK). This application must be allowed to run in the background. It connects to the LeapMotion and waits for gestures. It provides a .NET remoting interface (see here for an easy example) and raises an event (see here for an example of events with remoting) for each interesting gesture. When you use the example app, just replace some of the SafeWriteLine(...) with the raising the appropriate event.
  2. Build an office add-in with C# (just use NetOffice, it is free). This add-in starts the background app from step 1, connects with remoting and waits for events.
  3. When the add-in gets an event, it triggers the according actions in PowerPoint (e.g. presentation.GotoSlide(presentation.Slides.Count)).