2012年3月27日 星期二

Speech Platform v11 -- 1

文字轉語音又弄了半天半,擔心x64平台,x86發展工具
1. 系統說明
    Windows 7 x64 作業系統
    VS2010 x86 工具
    ASUS A43S 筆電
2. Ref : http://www.microsoft.com/download/en/details.aspx?id=27224

Instructions


  • First install the Microsoft Speech Platform - Runtime 11.0
  • Click the file you want to download from the list below.
  • Do one of the following:
    • To start the installation immediately, click Open or Run this program from its current location.
    • To copy the download to your computer for installation at a later time, click Save or Save this program to disk
1. 下載 Speech Platform Runtime 安裝
2. 下載 MSSpeech_TTS_zh-TW_HanHan.msi 中文安裝
3. 下載 MSSpeech_SR_zh-TW_TELE 中文安裝
4. 下載SDK安裝
5. Console mode testing program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// Add SpeechLib.DLL from COM component
using SpeechLib;

namespace Speech5
{
    class Program
    {
        static void Main(string[] args)
        {
            SpVoice 說 = new SpVoice();
            說.Speak("本專題運用DXStudio與VS 2010開發工具,建立視窗型的角色扮演應用程式,除整理DXStudio可運用的場景、人物、物件等元件,以DXStudio編輯器,自行規劃場景與加入人物,綜合運用javascript與C#程式,開發遊戲所需之程式模組");
            說.Speak("This is a test for English speaking.", SpeechVoiceSpeakFlags.SVSFDefault);
        }
    }
}
測試OK!

2012年3月18日 星期日

Workflow-(i)

Hello world for workflow:
1. There are four templates for workflow applications
2. Hello world : WorkflowConsoleApplication
Basic structure is almost same as C# console mode application
namespace/class/Main

namespace WorkflowConsoleApplication2
{

    class Program
    {
        static void Main(string[] args)
        {
            WorkflowInvoker.Invoke(new Workflow1());
        }
    }
}
One more file in the project
Workflow1.xaml
2-1 the graphic form 
2-2 tag form
2-3 說明:

主程式進入點,由Workflow1.xaml類別建置物件
 WorkflowInvoker.Invoke(new Workflow1()); 
Workflow1.xaml 類別可用圖形界面,建構活動

3. Workflow1.xaml 可以用C#建置
 static Activity wf = new Sequence()
        {
            Activities = {
                                new WriteLine()
                                {
                                   Text = "Before the 1 minute delay."
                                },
                                new Delay()
                                {
                                    Duration = TimeSpan.FromSeconds(20)
                                },
                                new WriteLine()
                                {
                                    Text = "After the 1 minute delay."
                                }
                              }
        };
        
        static void Main(string[] args)
        {
            WorkflowInvoker.Invoke(new Workflow1()); // Call WorkFlow1.xaml
            try
            {
                WorkflowInvoker.Invoke(wf, TimeSpan.FromSeconds(60)); // Based on static Activity to create.
            }
            catch (TimeoutException ex)
            {
                Console.WriteLine(ex.Message);
            }


        }




2012年3月1日 星期四

Convert Powerpoint to images

1. Add reference

// Add Microsoft.Office.Iterop.PowerPoint v 14.0.0.0 (@NET)
// Add Microsoft Office 14.0 Object Library (@COM)
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
2. Prepare myppt.pptx in debug or release folder
3. ConsoleMode program (Open vs2010 by administrator role)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// Add Micorsoft.Office.Iterop.PowerPoint v 14.0.0.0
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            ApplicationClass ppt = new ApplicationClass();
            Presentation pptPresentation = ppt.Presentations.Open(@"E:\Working\pptimage\ConsoleApplication1\ConsoleApplication1\bin\Debug\myppt.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
            for (int i = 1; i <= pptPresentation.Slides.Count ; i++)
            {
                pptPresentation.Slides[i].Export(@"E:\Working\pptimage\ConsoleApplication1\ConsoleApplication1\bin\Debug\slide" + i.ToString() + ".jpg", "jpg", 320, 240);
            }
           
        }
    }
}

4. Change both of  properties in
    Microsoft.Office.Iterop.PowerPoint v 14.0.0.0 (@NET)
    Microsoft Office 14.0 Object Library (@COM)
    Embed Interop Type -> False


5. Note: 1. The default directory of Slides[].Export is My Document
              2. It seems not to work without excuted by administrator role.