词典来源>>程序>>添加
已启用(勾选) 类型(音频) 名称(喜欢写啥都可以) 命令行(powershell -ExecutionPolicy Bypass -File “C:\Program Files\GoldenDict-ng\tts.ps1” “%GDWORD%”)
注:powershell -ExecutionPolicy Bypass -File "C:\Program Files\GoldenDict-ng\tts.ps1" "%GDWORD%"
这条命令中的C:\Program Files\GoldenDict-ng\tts.ps1是我们调用的powershell脚本的绝对路径
tts.ps1中的内容为:
param([string]$word)
Add-Type -AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.SelectVoice(‘Microsoft Hazel Desktop’)
$synth.Rate = 0
$synth.Volume = 100
$synth.Speak($word)
上面的方法需要多弄一个tts.ps1脚本文件.当然也有一条命令优雅解决的,不过目前GoldenDict-ng有bug当我们搜索的文字内容有’的时候就没有声音输出了。原版的GoldenDict没有这个问题。具体命令如下:
PowerShell -Command “Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.SelectVoice(‘Microsoft Hazel Desktop’); $synth.Rate = 0; $synth.Volume = 100; $synth.Speak(‘%GDWORD%’);”