AppleScript:如何让 AppleScript 在按下特定键时说出选定的短语?

发布于 2024-12-23 10:34:02 字数 808 浏览 2 评论 0原文

如何让 AppleScript 在按下特定键时说出选定的短语?

例如,如果按下“S”键,我希望在您键入时发生同样的事情: 说“s”

这是我现在的代码:

property this_text : "EMail"
tell application "Mail"
activate
say "loading complete, type your mail message now"
display dialog "Type your Email message." default answer "" buttons {"Cancel", "Continue"} default button 2
set the this_text to text returned of the result
set this_message to make new outgoing message at end of outgoing messages with properties {content:this_text, visible:true}
tell this_message
    make new to recipient at end of to recipients with properties {address:""}
    say "to who do you want to send this mail?"
end tell

end tell

say "don't forget to add an subject"

但即使使用 QuickSilver 我似乎也无法弄清楚。

这是我的一个朋友的应用程序,它看起来不太好,所以现在我希望应用程序说出按下了哪个键。

How do i make AppleScript say a selected phrase when pressing a specific key?

For example, if the key " S " is pressed i want the same thing to happen when you type :
Say "s"

This is my code for now :

property this_text : "EMail"
tell application "Mail"
activate
say "loading complete, type your mail message now"
display dialog "Type your Email message." default answer "" buttons {"Cancel", "Continue"} default button 2
set the this_text to text returned of the result
set this_message to make new outgoing message at end of outgoing messages with properties {content:this_text, visible:true}
tell this_message
    make new to recipient at end of to recipients with properties {address:""}
    say "to who do you want to send this mail?"
end tell

end tell

say "don't forget to add an subject"

But even with QuickSilver i can't seem to figure it out.

It is an Application for an Friend of mine which can't see good, so now i want the Application to say which key is pressed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守望孤独 2024-12-30 10:34:02

以下内容应该可以帮助您做到这一点:https://discussions.apple。 com/thread/665313?start=0&tstart=0

另外,由于您想要的命令是“say”,因此这里是它的文档:http://docs.info.apple.com/article .html?path=AppleScript/2.1/en/as304.html

The following should help you to do this: https://discussions.apple.com/thread/665313?start=0&tstart=0

Also, as the command you want is 'say', here's the documentation for it: http://docs.info.apple.com/article.html?path=AppleScript/2.1/en/as304.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文