首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AppleScript和语音

AppleScript和语音
EN

Stack Overflow用户
提问于 2011-02-14 05:57:08
回答 2查看 1.1K关注 0票数 2

是否可以使用AppleScript来停止Mac当前正在生成(或已经排队)的任何语音?

我基本上是在寻找与AppleScript "say“命令相反的命令。

EN

回答 2

Stack Overflow用户

发布于 2013-01-17 09:21:22

试试这个,一个完整的AppleScript解决方案(不需要外壳):

代码语言:javascript
复制
-- say some text asynchronously
say "Hello, world!" waiting until completion no
-- delay 1 second before stopping
delay 1
-- stop text by saying nothing, which stops current speech
say "" with stopping current speech
票数 3
EN

Stack Overflow用户

发布于 2011-02-16 13:38:52

要停止该演讲,您必须停止运行该演讲的进程。当你说“Mac当前正在生成的任何语音”时,这是很难做到的,因为可能有不同的进程生成语音。你必须找出一种方法来确定是什么产生了演讲。

下面是一个生成语音的示例,因此我知道要终止哪个进程才能停止语音。

代码语言:javascript
复制
set theText to "Is it possible to stop any speech that the Mac is currently producing (or has queued) using an AppleScript? I'm basically looking for the opposite of the AppleScript \"say\" command."
set thePID to do shell script "say " & quoted form of theText & " > /dev/null 2>&1 & echo $!"

delay 1
do shell script "kill " & thePID
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4987171

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档