3

Is there a way I can make a keyboard shortcut for this?

Tab, Tab, ⬇︎, S, Return ⏎, Return ⏎

Is there a way I can bind this to a keyboard shortcut, i.e. ⌘ Command⌥ OptionG?

5

You can use Automator to create a service for this. Open Automator and click “New Document,” then choose the Service template:

Click Service, then click “Choose”

Next, click on the “Service receives selected text” dropdown and choose “no input:”

Next, add a “Run AppleScript” action:

  1. Click “Actions” in the sidebar
  2. Ensure the “Library” row in the first column is selected
  3. Search for “AppleScript”
  4. Double-click the “Run AppleScript” row in the search results

In the action on the right side of the window, paste this AppleScript into the text box:

on run {input, parameters}
    tell application "System Events"
        repeat 2 times
            keystroke tab
        end repeat
        keystroke (ASCII character 31) -- down arrow
        keystroke "s"
        repeat 2 times
            keystroke return
        end repeat
    end tell
    return input
end run

Next, click the “compile” (hammer 🔨) button to verify that the code was pasted correctly:

Choose File → Save (or + S), and type in a name you’ll remember. Next, open System Preferences ( → System Preferences…) and click “Keyboard.” Under the “Shortcuts” tab, select “Services” in the left list. Scroll to the bottom of the main list, under the “General” section, and select the service you just created. Click the “Add Shortcut” button and type the keyboard shortcut you’d like to use.

The shortcut should now work.

Based on the other answer

2

You can use Automator.app to create a service for this. Open new Automator document as a service, choose on top, that You won't have an input of any type. Then add a block Run AppleScript, enter this code:

on run {input, parameters}
    tell application "System Events"
        keystroke tab
        keystroke tab
        keystroke (ASCII character 31) --down arrow
        keystroke "s"
        keystroke return
        keystroke return
    end tell
    return input
end run

Save this and give this service a name You'll remember. Then go to Preferences.app -> Keyboard -> Keyboard Shortcuts. Select Application Shortcuts in the left pane, click + to add new shortcut. Enter the name of Your service and assign keyboard shortcut for it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .