僅寫關鍵性程式碼:
//遍歷語音庫,將語音庫加入選擇 import com.sapi.voice; var voice = com.sapi.voice(); for name,lang,gender,age,vendor,description in voice.eachVoices(){ //comboboxvoiceLang是選擇框元件 mainForm.comboboxvoiceLang.add(name); } //設定語音庫,透過名字 if(""!=mainForm.comboboxvoiceLang.selText){ voice.setVoiceByName(mainForm.comboboxvoiceLang.selText) } //閱讀文字 //閱讀速度 voice.rate=1; voice.speakAsync("這是要閱讀的內容");