Mac Mail: Archive Message vs Trash using DELETE key Macro

Hello all. I'm new to Keyboard Maestro. The change to Mac OS Sierra Mail with not allowing the DELETE key to archive mail in Gmail IMAP prompted me to try this avenue. Otherwise the DELETE key sends my mail to trash, and I do not want that.

I included the macro that I created to workaround the issue, and it works...however the problem is that outside of the mail app there is oftentimes a significant delay (1-3 seconds) when I use the DELETE key normally. I inserted the sound notification just so I know when and how the macro functions.

Thanks in advance for any advice and suggestions.

Keyboard Maestro “Archive Message in Mail” Macro

1 Like

Currently your macro is in the Global Macro Group, but you only need it when Mail is frontmost.

So, create another Macro Group that is only active when Mail app is frontmost, and put the macro into that group.

Otherwise KM has to check each time you hit the Delete key if Mail is frontmost. Which could be the reason for the delay.

@Tom: Bam! That was it. I wanted to do exactly that but being a new user didn’t know how to implement it. Thanks much!! …works flawlessly.

OK, now, with the macro in the Mail Macro Group, you can further optimize it a bit:

Done. Thanks again, @Tom! Being a former programmer, it looks like I’m going to have fun with this app. Cheers.

Welcome to the forum, and to the small group of us who are or have been programmers. A lot of old-timers here. I just turned 60, and most of the others have seen their share of sunrises too.

I’ve found KM to be a programmer’s best dream. Not only can you do great things with it out of the box, but it also supports AppleScript, Swift, and my preference, JavaScript for Automation (JXA). Talk about heaven!

My advice is to enjoy the ride, but don’t get frustrated. It’s nearly impossible to learn all the features and uses of KM. Read this forum regularly - even posts that don’t sound interesting often contain golden nuggets.

And make sure you have a place to store notes, tips and tricks, so you can find them later.

Most importantly, ask questions!

Have fun!

Thanks, @DanThomas…happy to be onboard!

Dan, as you know, I use Evernote for this. What do you use?

@Tom and/or other gurus, the above correction I applied last night seemed fine on the surface, but it’s not working correctly. After 2+ hours of troubleshooting and trying to figure it out myself, I’m at a loss…again. The “archive” function of the macro works perfectly, the problem arises when I’m composing a new mail message or replying to a message. When hitting the DELETE key, the macro runs but delays sending the DELETE function for the ~1-5 seconds. It’s occasionally immediate but not often.

I again inserted an audible sound alert to go along with the DELETE function in the “otherwise execute the following actions” section. The audible ding rapidly repeats itself until the DELETE function is actually executed. It’s as if the macro is in some type of loop but I’m not sure why or how.

I tried multiple other settings both in and out of the macro, restarting from scratch…all with the same result.

Thanks in advance for any help–I can only assume that I am not the only one needing this function to work correctly with Gmail in OS Sierra Mail.

Since Delete is the hotkey for your macro, it’s not a good idea for the macro to “type” the delete key. Sometimes it works, but usually, you end up with strange things like what you’re seeing.

I recommend you either change the hotkey, or instead of typing the “delete” key, see if there’s a menu you can use.

If you really want to use the delete key like this, then try this:

  1. Before you re-type the delete key, use a “Set Macro or Group Enable” action to disable the macro.
  2. “Type” the delete key.
  3. Pause for long enough for the key to get processed. How long? I dunno. Try values until it works.
  4. After the pause, re-enable the Macro.

I use Quiver, but let’s not hijack this thread. :stuck_out_tongue:

@DanThomas: Niiiiice! That worked. I attached a screen grab of how I implemented far so good. Thanks again for the assist.

1 Like

Hi, to use not the DELETE key, I use shortcuts @CurtS, @JMichaelTX & @Tom At my age it is hard to remember this alee, so I use a context menu in each app with BetterTouch Tool :wink:

In the short video times my workflow to delete the trash with a swipe gesture and a macro

Interesting looking app, @appleianer. I’ll check it out…thanks.

Thank you very much @CurtS. If you have any questions about BetterTouch Tool, please let me know :nerd_face:

Here again the macro for the final deletion of the trash....

Mail trash delete.kmmacros (2,8 KB)