首页 > 解决方案 > 启用键盘快捷键以确认 AppleScript 中的对话框

问题描述

我正在寻找一种允许用户使用键盘快捷键完成对话框条目的方法。这可能吗?

其他问题讨论了将快捷方式分配给AppleScript 对话框中的选项,而不是分配给“继续”/“确定”等按钮。

主要困难是我使用的是多行文本输入表单,因此Enter按钮只是创建一个新行,而不是像通常那样定位默认按钮。我希望cmdenter可以将其分配给默认按钮。

定义相关对话框的脚本行是:

set theResponse to display dialog "Enter tasks:" default answer "





" buttons {"Cancel", "Continue"} default button "Continue"

标签: dialogapplescriptkeyboard-shortcutsinteraction

解决方案


⌘-Enter(在数字小键盘上)按下 Continue


推荐阅读