Answering Phone Calls via Keyboard Shortcut

Answering Phone Calls via Keyboard Shortcut

Learn how to save time and reduce distractions by answering phone calls with a keyboard shortcut.

Scroll Down for more info

If you are like me, you get occasional phone calls as you are working. Maybe I am a productivity freak, but I don’t like having to be distracted enough to move my mouse to the upper-right edge of my two monitors just to answer the phone.

As such, I came up with an AppleScript snippet that can be used in conjunction with Alfred to create a global hotkey for answering the phone. Mine is Cmd+Shift+Home.

To set this up, run the following instructions:

  1. Open Alfred’s preferences.
  2. Go to the Workflows tab.
  3. Choose the “+” icon, and choose a Blank Workflow.
  4. Assign a Name to it, and click Create.
  5. Right-click, and select Triggers > Hotkey.
  6. Press your preferred combination (mine is Cmd+Shift+Home).
  7. Right-click, and select Actions > Run NSAppleScript.
  8. Paste the code below, and click Save.
  9. Give it a whirl, and see how it goes.

Please note that you may have to go into System Preferences > Security > Privacy > Accessibility and allow Alfred to control your computer.

The Code:

tell application "System Events"
    tell process "FaceTime"
        set acceptButton to a reference to (button "Accept" of window 1)

        if acceptButton exists then
            click acceptButton
        end if
    end tell
end tell

Bonus:

You can run the above steps again, selecting another key combination (mind is Cmd+Shift+End), to decline / end phone calls. Here is that script:

tell application "System Events"
  tell process "FaceTime"
    set declineButton to a reference to (button "Decline" of window 1)

    if declineButton exists then
        click declineButton
    end if

    set endButton to a reference to (button "End" of window 1)

    if endButton exists then
        click endButton
    end if
  end tell
end tell

We enjoy looking for any and every way to boost our productivity. If we can have a distraction eliminated, that is a positive thing. Enjoy!

SwiftOtter, Inc.
It relates to macOS and Productivity.
Joseph Maxwell - president / senior developer at Swift Otter

President / senior developer at SwiftOtter - @josephmaxs