Using Apple Mail I wanted to have a single hotkey to file mail into a folder.  I used to use a plugin called Mail-ActOn but it’s gotten more expensive and has way more features than I need.

Step 1. Create a service using Automator

Fire up Automator, create a new “Quick Action” (the cog wheel thing), add  a “Run AppleScript” box and enter the code as shown below.  Save it with a useful name, in this case “Move to Completed”.  

You can adjust this to save to any folder you like.  You can have lots of scripts that save to different folders or perform other useful Mail actions.

Step 2. Create a key binding

Select Apple Preferences → Keyboard → Shortcuts → Services

Right at the bottom of the list you should see your new action with “none” in the right-hand column.  Double click on “none” and enter the key combination you would like to invoke the action.

Step 3.  Enable access

Select Apple Preferences → Security & Privacy → Privacy → Accessibility and now add Automator to the apps that can control your computer.  Hit the + at the bottom of the list and then choose the Automator app.  You probably will need to unlock this panel, click on the padlock icon and enter the administrator password.

Mac hotkey to refile email