Skip to content

Instantly share code, notes, and snippets.

@ksasao
Created January 17, 2015 08:13
Show Gist options
  • Save ksasao/e9b8564063b4cd7e6905 to your computer and use it in GitHub Desktop.
Save ksasao/e9b8564063b4cd7e6905 to your computer and use it in GitHub Desktop.
PowerPoint 2013 のノート部分をPepperさんに読み上げてもらう最小限のコード。License: WTFPL
# -*- coding: utf-8 -*-
import sys
from naoqi import ALProxy
data = sys.argv[1]
animSpeech = ALProxy('ALAnimatedSpeech', "192.168.1.10", 9559)
p = unicode(data, 'shift-jis').encode('utf-8')
sentence = "\RSPD="+ str( 100 ) + "\ "
sentence += "\VCT="+ str( 120 ) + "\ "
sentence += str(p)
sentence += "\RST\ "
configuration ={"bodyLanguageMode":"contextual"}
animSpeech.post.say(str(sentence), configuration)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;
namespace PowerPointAddIn1
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO で生成されたコード
/// <summary>
/// デザイナーのサポートに必要なメソッドです。
/// このメソッドの内容をコード エディターで変更しないでください。
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
this.Application.SlideShowNextClick += Application_SlideShowNextClick;
}
#endregion
// スライドショーでページが切り替わった場合に発生するイベント
void Application_SlideShowNextClick(PowerPoint.SlideShowWindow Wn, PowerPoint.Effect nEffect)
{
// PowerPointスライドの 「ノート」部分を取得する。
// http://msdn.microsoft.com/ja-jp/library/office/ff744720(v=office.15).aspx
// 等を参照
string note = Wn.View.Slide.NotesPage.Shapes.Placeholders[2].TextFrame.TextRange.Text;
if (note.Trim() != "")
{
string scriptPath = @"C:\Users\ksasa_000\Desktop\PepperTalkOnce.py";
System.Diagnostics.ProcessStartInfo process =
new System.Diagnostics.ProcessStartInfo();
process.FileName = "python.exe";
process.Arguments = "\"" + scriptPath + "\" " + note;
process.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
//アプリケーションを起動する
System.Diagnostics.Process.Start(process);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment