本帖最后由 Gu_xl 于 2011-3-29 09:02 编辑
回复 x_s_s_1 的帖子
 - ;;;VoiceList 功能:返回可用的语音声音描述
- (defun VoiceList(/ sapi i VoiceLst)
- (setq Sapi (vlax-create-object "Sapi.SpVoice"))
- (setq Voices (vlax-invoke Sapi 'GetVoices))
- (setq i 0 VoiceLst '())
- (repeat (vla-get-count Voices)
- (setq VoiceLst (append VoiceLst
- (list (vlax-invoke (vla-item Voices i) 'GetDescription))))
- ;
- (setq i (1+ i))
- )
- (vlax-release-object Sapi)
- VoiceLst
- )
- ;;;设置朗读者,根据返回的语音声音描述列表选择朗读者
- (setq voice (nth 1 (VoiceLst)))
- ;;;创建语音对象
- (setq sapi (vlax-create-object "Sapi.SpVoice"))
- ;;;朗读
- (vlax-invoke sapi "Speak"
- (strcat "<VOICE REQUIRED='NAME=" voice "'>" "My autoCAD can speak !" )
- 0)
- (vlax-release-object sapi)
|