简体   繁体   English

使用跳跃动作为PowerPoint编写自定义代码?

[英]Writing custom code for PowerPoint using leap motion?

I am trying to make a gesture based PowerPoint slideshow . 我正在尝试制作基于PowerPoint幻灯片手势 JavaScript would certainly not work here as I want my slideshow to work when that particular PowerPoint file (.ppt) is opened for windows. JavaScript肯定不会在这里工作,因为我希望我的幻灯片工作时,为Windows打开特定的PowerPoint文件(.ppt)。

I googled, posted a question on the Leap Motion forum, but in vain. 我用谷歌搜索,在Leap Motion论坛上发布了一个问题,但是徒劳无功。 My primary concerns are: 我主要担心的是:

  1. I am unsure about what to use here. 我不确定在这里使用什么。 Are there some SDKs for this purpose? 是否有一些用于此目的的SDK? In simple words, how do I write some custom code for a PowerPoint file on our system? 简单来说,如何在我们的系统上为PowerPoint文件编写一些自定义代码? Leap Motion apps can be developed with C#, C++, Python, JavaScript, Java, Objective-C Leap Motion应用程序可以使用C#,C ++,Python,JavaScript,Java,Objective-C开发

  2. Integrating the code for Leap Motion device with the above code. Leap Motion设备的代码与上面的代码集成。

It's OK if you reply with any of the two points. 如果你回答这两点中的任何一点都没关系。 I am sorry I couldn't post any code as I am absolutely new to PowerPoint-based programming for the system itself. 对不起,我无法发布任何代码,因为我对系统本身的基于PowerPoint的编程完全不熟悉。

I am open to any language (C, C#, C++, Java, and Objective-C) that lets me accomplish my task. 我对任何能让我完成任务的语言(C,C#,C ++,Java和Objective-C)持开放态度。 Sugesstions with some information/code would definitely help. 有一些信息/代码的sugesstions肯定会有所帮助。

I am a PHP and JavaScript developer. 我是一名PHPJavaScript开发人员。 I hope I am clear and not misunderstood. 我希望我很清楚,不会被误解。

Update: 更新:

I found LEAP Motion Controller Add-ins for Microsoft Office 2010/2013 (C#) . 我找到了适用于Microsoft Office 2010/2013(C#)的LEAP Motion Controller插件

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. 您找到的用于Microsoft OfficeLEAP运动控制器加载项可能是将控制器与Powerpoint集成的最佳方式。

To get started with it, you'll need Visual Studio (seems like you'll need 2012). 要开始使用它,你需要Visual Studio(看起来你需要2012)。 Microsoft has an overview page for Office Development in Visual Studio . Microsoft 在Visual Studio中有Office Development的概述页面。

Follow the instructions on the Configuring a Computer to Develop Office Solutions page. 按照配置计算机以开发Office解决方案页面上的说明进行操作

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 下载Leap SDK for Windows,然后解压缩,然后在项目GestureLib.NET4.0的Visual Studio中,添加对LeapCSharp.NET4.0 dll的引用

Make a trivial fix to GestureListener.cs (use IsEmpty at line 44). 对GestureListener.cs做一个简单的修复(在第44行使用IsEmpty)。

After that you ought to be able to run the LEAP Motion Controller Add-in from within Visual Studio. 之后,您应该能够在Visual Studio中运行LEAP Motion Controller Add-in。 It'll start Powerpoint when you do that. 当你这样做时它会启动Powerpoint。

"VSTO" is the name of the technology you are using here, so for more, Google 'VSTO add-in powerpoint'. “VSTO”是您在此处使用的技术的名称,所以更多的是Google的“VSTO插件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. 加载项源代码 ,看起来您应该在Powerpoint的功能区上看到一个按钮,用于启动和停止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:- 看看ThisAddIn.cs,一旦启动(通过按功能区上的按钮),控制器应该分别通过移动到下一个/上一个幻灯片来响应左右手势: -

                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. GestureLib支持其他手势,您可以按照相同的模式执行某些操作。

If your aim is just to interact with a PowerPoint presentation then a simple solution might be to use BetterTouchTool . 如果您的目标只是与PowerPoint演示文稿交互,那么一个简单的解决方案可能是使用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. 它专为OS X设计,与Leap Motion控制器配合使用 ,它允许您将手势(由LM控制器捕获)映射到键盘快捷键,只要配置正确 ,它就可以在后台运行时工作。

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. 基本上,应该可以在右箭头键上按下X手指向右滑动 - 这会将演示文稿推进到下一张幻灯片。 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. 但是,如果您正在寻找程序化挑战/希望将其用于Airspace的应用程序,那么您可以使用类似Apache POI的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 :). 这是一个更复杂的解决方案,但它确实有它将在OS X上运行的好处 - 并且需要你使用一些代码:)。

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. 您现在拥有一组图像 - 每个PowerPoint幻灯片一个。 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. 您可以将此数据视为内存数据库(和Web服务),并返回到PHP和JS的舒适区域,并使用Leap Motion控制器的JS API捕获手势以驱动基本上的在线图片库。
  • 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. 您可以使用Java API开发纯Java解决方案,以从Leap Motion Controller捕获手势,并使用Swing / JavaFX或使用JSF在浏览器中显示数据。

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). 基于LeapMotion API构建基本的C#应用​​程序(您可以使用SDK中的C#示例应用程序 )。 This application must be allowed to run in the background. 必须允许此应用程序在后台运行。 It connects to the LeapMotion and waits for gestures. 它连接到LeapMotion并等待手势。 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. 它提供了一个.NET远程处理界面( 这里有一个简单的例子),并为每个有趣的手势引发一个事件(参见这里的远程事件示例)。 When you use the example app, just replace some of the SafeWriteLine(...) with the raising the appropriate event. 当您使用示例应用程序时,只需将一些SafeWriteLine(...)替换为引发相应的事件即可。
  2. Build an office add-in with C# (just use NetOffice , it is free ). 使用C#构建办公室加载项(只需使用NetOffice ,它是免费的 )。 This add-in starts the background app from step 1, connects with remoting and waits for events. 此加载项从步骤1启动后台应用程序,连接远程处理并等待事件。
  3. When the add-in gets an event, it triggers the according actions in PowerPoint (eg presentation.GotoSlide(presentation.Slides.Count) ). 当加载项获取事件时,它会触发PowerPoint中的相应操作(例如presentation.GotoSlide(presentation.Slides.Count) )。

PowerPoint and all office tools supports visual basic .net macros. PowerPoint和所有办公工具都支持visual basic .net宏。 Simply wrote a vb macro for your ppt file that recognizes the gesture and trigger the page change action. 只需为您的ppt文件编写一个vb宏,该文件识别手势并触发页面更改操作。 This is enough. 这就够了。

If you want, C# code of leap motion can be integrated in your vb.net macro 如果你愿意,可以在你的vb.net宏中集成跳跃动作的C#代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM