I'm looking to bind a keyboard shortcut to the action "minimize all windows from the current application except the current window." (The app in question is always Google Chrome.)
(Sort of like ⌘ + ⌥ + h
, which translates to "hide all applications except the current application".)
I've never bound a new shortcut, but I suspect I could figure it out once I have a working AppleScript for the task. I also use Better Touch Tool, in case it is easier to go through that app.
This question asks the same thing, but the answers are not bindable to a simple keyboard shortcut as far as I can tell.
This question asks the same thing (except specifically for Safari), and a user suggests the 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
When I replace "Safari" with "Google Chrome" in the script, and try to run it from Script Editor, I get the error
Script error: Google Chrome got an error: Can’t make miniaturized of every window whose index ≠ 1 into type specifier.
Can anyone help? Thanks