【问题标题】:Dialog "cancel" button linked to escape key链接到转义键的对话框“取消”按钮
【发布时间】:2018-06-16 20:42:25
【问题描述】:

我有一点 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

【问题讨论】:

    标签: applescript


    【解决方案1】:

    Cancel 会自动链接到大写的 ESC 键。

    【讨论】:

    • 太棒了。它现在有效,我觉得很傻。感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 2015-08-27
    • 2012-01-10
    • 1970-01-01
    • 2020-05-29
    • 2010-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多