对话框“取消”按钮链接到转义键

时间:2018-06-16 12:16:58

标签: 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

1 个答案:

答案 0 :(得分:1)

Cancel如果大写,则自动链接到ESC键。

相关问题