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:
- Open Alfred’s preferences.
- Go to the Workflows tab.
- Choose the “+” icon, and choose a Blank Workflow.
- Assign a Name to it, and click Create.
- Right-click, and select Triggers > Hotkey.
- Press your preferred combination (mine is Cmd+Shift+Home).
- Right-click, and select Actions > Run NSAppleScript.
- Paste the code below, and click Save.
- 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.
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
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!