applescript - 链接到转义键的对话框“取消”按钮
问题描述
我有一点 AS 打开一个对话框并提示用户输入,按钮选项为“取消”和“发送”(“发送”是默认按钮)。因为它是默认按钮,所以当我按下键盘上的回车键时,“发送”就会激活。当我按下键盘上的退出键时,我想激活“取消”。有没有办法将键盘键与按钮链接起来?我正在寻找一种编码解决方案,而不是应用程序设置解决方案,因为这块 AS 将由另一个应用程序运行。
任何帮助表示赞赏,示例代码如下!
set returnedThings to (display dialog ":message:" default answer "" with icon note buttons {"cancel", "send"} default button "send")
set theMsg to text returned of the returnedThings
set theBtn to button returned of returnedThings
if theBtn is "send" and theMsg is not "" then
-- do application specific tasks
end if
解决方案
Cancel
如果大写,则自动链接到 ESC 键。
推荐阅读
- stm32 - 未定义对 f_opendir 的引用
- powershell - PowerShell 命令中的 /w 1 和 /C 是什么?
- node.js - BLOB 作为 LOB 和 Buffer 随机返回
- git - 列出更改和依赖的模块
- php - PHP / Laravel - 共享关系的独特结果
- javascript - JS读取本地大图文件的像素数据
- python - 为什么`object`是`type`的实例而`type`是`object`的实例?
- javascript - 运行离线时钟 28 小时 56 分 56 秒的 Android Widget 时钟
- typescript - 尝试将 typescript 库与 webpack 捆绑时导出未定义
- javascript - 如何在 ReactJs/Redux 中调试浏览器网络操作中的意外时间间隔?