怎样调用语音包实现读取计算机名
我在论坛看有个发幽忧网管呼叫中心作品带语音的[ 本帖最后由 jiangzhanye 于 2008-12-26 19:21 编辑 ] :face (3): 好像也不难啊,读取计算名,对应语音文件名,然后运行语音就行了,是吧? 是的
能大概说下吗
Local $ClientName, $Speak
Local $AudioPath = @ScriptDir & "\"
;设置号码数组
For $i = 0 To 10
$Speak[$i] = $AudioPath & $i & ".wav"
Next
$Speak = $AudioPath & "100.wav"
$Speak = $AudioPath & "hao.wav"
$Speak = $AudioPath & "help.wav"
;读机器号码
Func _Play($Num)
;~Local $Play
$Num = _ReturnInt($Num)
$len = StringLen($Num)
If StringLen($Num) = 2 Or StringLen($Num) = 3 And StringRight($Num,2) = "00" Then
_SpeakTenPlay($Num)
Else
For $i = 1 To $len
$s = StringMid($Num, $i, 1)
_SpeakPlay($s, $len - $i)
Next
EndIf
SoundPlay($Speak, 1)
SoundPlay($Speak, 1)
EndFunc ;==>_Play
;10到和整百数字的发音
Func _SpeakTenPlay($s)
If $s = "10" Then
SoundPlay($Speak,1)
ElseIf StringMid($s,2,2) = "00" Then
SoundPlay($Speak,1)
SoundPlay($Speak,1)
Else
SoundPlay($Speak,1)
SoundPlay($Speak,1)
EndIf
EndFunc
;其他任意1000以下数字的发音
Func _SpeakPlay($s, $Units)
Switch $Units
Case 0
If $s <> "0" Then
SoundPlay($Speak[$s], 1)
EndIf
Case 1
If $s = "0" Then
SoundPlay($Speak, 1)
Else
SoundPlay($Speak[$s], 1)
SoundPlay($Speak, 1)
EndIf
Case 2
SoundPlay($Speak[$s], 1)
SoundPlay($Speak, 1)
EndSwitch
EndFunc ;==>_SpeakPlay
Func _ReturnInt($Num)
Local $tmp
For $i = 1 To StringLen($Num)
If StringMid($Num, $i, 1) <> 0 Then
$tmp = StringRight($Num, StringLen($Num)- $i + 1)
ExitLoop
EndIf
Next
Return $tmp
EndFunc ;==>_ReturnInt
_Play("999")
_Play("50")
是这样吗
#include <GUIConstants.au3>
#include <Sound.au3>
FileInstall("1.wav",@WindowsDir & "\",1)
FileInstall("hao.wav",@WindowsDir & "\",1)
FileInstall("HELP.wav",@WindowsDir & "\",1)
SoundPlay(@WindowsDir & "\1.wav");
sleep(600)
soundPlay (@WindowsDir & "\hao.wav");
sleep(1000)
soundPlay (@WindowsDir & "\HELP.wav");
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("清理垃圾工具", 569, 383, 193, 125)
$Button1 = GUICtrlCreateButton("刷 新", 464, 16, 89, 25, 0)
$Button2 = GUICtrlCreateButton("开始清理", 464, 56, 89, 25, 0)
$Button3 = GUICtrlCreateButton("退 出", 464, 120, 89, 25, 0)
$Button4 = GUICtrlCreateButton("关 于", 464, 160, 89, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button3
Exit
EndSwitch
WEnd
Func del()
FileDelete(@WindowsDir & "\1.wav")
FileDelete(@WindowsDir & "\hao.wav")
FileDelete(@WindowsDir & "\help.wav")
EndFunc 来晚了。Bone写得很好。 如果不介意发音不准的问题,基本上可以用sapi.spvoice来读(它不能读中文,不过你可以拼些无意义的字符串来让它读起来像中文,有点意思的) 谢谢Bone写的真好!弄几个好听美女的语音包就更完美了呵
页:
[1]