我希望将键盘快捷键绑定到动作"最小化当前应用程序中除当前窗口之外的所有窗口". (有问题的应用始终是Google Chrome浏览器。)
(像
⌘ + ⌥ + h
的排序
,翻译为"隐藏当前应用程序以外的所有应用程序"。)
我从来没有绑定过一个新的快捷方式,但是我怀疑一旦我有一个适用于该任务的AppleScript,就可以弄清楚.如果要更轻松地浏览该应用程序,我还会使用Better Touch Tool。
这个问题问的是同一件事,但答案不具有约束力 据我所知,它只是一个简单的键盘快捷键。
此问题问 同样的东西(除了Safari专用),并且用户建议使用AppleScript
tell application "Safari"
activate
tell application "System Events"
keystroke "h" using {command down, option down}
end tell
set miniaturized of (windows whose index is not 1) to true
end tell
当我在脚本中用" Google Chrome"替换" Safari"并尝试从脚本编辑器运行时,出现错误
Script error: Google Chrome got an error: Can’t make miniaturized of every window whose index ≠ 1 into type specifier.
有人可以帮忙吗? 谢谢
最新回答
- 2021-1-51 #
以下示例 AppleScript code将最小化 Google Chrome中除窗口之外的所有内容 :
因为您已经有了 BetterTouchTool 并假设它可以运行 AppleScript code或 AppleScript .scrpt 文件和快捷键,这可能是触发code的最简单方法。
也就是说,我运行 AppleScript的首选方法 脚本和快捷键,用于使用名为 FastScripts的第三方应用程序 ,但是您也可以使用 Automator 与一个 Run AppleScript action作为Service / Quick Action,并将其分配给键盘快捷键,网址为: System Preferences > Keyboard > Shortcuts > Services
Thekeyboard shortcutassigned to theService/Quick Actionneeds to not conflict with a defaultkeyboard shortcutfor whicheverapplicationisfrontmostat the time it's pressed, otherwise there may be unwanted behavior.
FastScripts can be run as a free app, up to 10 keyboard shortcuts, or upgraded for $24.95 USD to unlock unlimited keyboard shortcuts. I have no affiliation with Red Sweater Software, LLC, other then as a user of FastScripts.