Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rctneil

macrumors regular
Original poster
Jul 29, 2013
192
100
Hey,

As I hate the numbers next to all my Junk and Deleted folders for all my mailboxes in Mac Mail, i'd like a shortcut that effectively does the following:

  1. Open Mail
  2. Clicks the "Mailbox" menu
  3. Clicks the "Erase Junk Mail" option
  4. Click "Erase" in the popup.
  5. Clicks the "Mailbox" menu
  6. Hovers the "Erase Deleted Items" option
  7. Clicks "In All Accounts..." submenu item
  8. Click "Erase" in the popup.

I want to be able to glance at the messages that end up in junk but then be able to manually run this shortcut to perform the above task.

I'm struggling to achieve this?, Is it possible?
 

Artiste212

macrumors regular
Aug 26, 2012
143
73
I'd like to script some of the actions that I have in Mail, especially to do what I can with a rule (only when the mail comes in). But I understand there is very limited scripting in Mail. So does this ruin the possibility of using Shortcuts, too?
 

Fishrrman

macrumors Penryn
Feb 20, 2009
29,175
13,223
I set up a function key to quickly erase deleted msgs in all accounts.

I choose F15 (but one could choose any other F key or whatever key combo you wished, so long as it doesn't interfere with another one that you use).

What I did:
Go to keyboard pref pane
Click on Shortcuts panel
In the list on the left, click on App Shortcuts
Click the "+" icon to create a new shortcut
In the resulting dialog asking which app, choose Mail
For the Menu Title, you need to be careful because it's a "nested menu":
Mailbox->Erase Deleted Items->In All Accounts
Chose the keyboard command you want (again, I chose F15)
Save it.

Now, with Mail open, when I want to erase all deleted messages, I do this:
Hit F15
In the resulting dialog, "Are you sure you want to erase deleted items in the Trash mailbox", the "erase" button is selected as the default, so I just hit "enter" on the keyboard.
Everything is deleted.

So... I've reduced the "emptying the trash" routine to a quick:
F15, then hit enter.

And it's gone!

I still have to delete junk, bulk, and read messages manually.
Probably best to keep doing that manually, to prevent erasing something that you might actually have wanted to see.

But the quick "one, two" keystroke to empty the trash now makes things easier.

NOTE:
The "->" trick for nested menus works everywhere else, as well.
Something it took me a LONG time to discover !
 

rctneil

macrumors regular
Original poster
Jul 29, 2013
192
100
I set up a function key to quickly erase deleted msgs in all accounts.

I choose F15 (but one could choose any other F key or whatever key combo you wished, so long as it doesn't interfere with another one that you use).

What I did:
Go to keyboard pref pane
Click on Shortcuts panel
In the list on the left, click on App Shortcuts
Click the "+" icon to create a new shortcut
In the resulting dialog asking which app, choose Mail
For the Menu Title, you need to be careful because it's a "nested menu":
Mailbox->Erase Deleted Items->In All Accounts
Chose the keyboard command you want (again, I chose F15)
Save it.

Now, with Mail open, when I want to erase all deleted messages, I do this:
Hit F15
In the resulting dialog, "Are you sure you want to erase deleted items in the Trash mailbox", the "erase" button is selected as the default, so I just hit "enter" on the keyboard.
Everything is deleted.

So... I've reduced the "emptying the trash" routine to a quick:
F15, then hit enter.

And it's gone!

I still have to delete junk, bulk, and read messages manually.
Probably best to keep doing that manually, to prevent erasing something that you might actually have wanted to see.

But the quick "one, two" keystroke to empty the trash now makes things easier.

NOTE:
The "->" trick for nested menus works everywhere else, as well.
Something it took me a LONG time to discover !

Thanks for this. I did not know about that option!

I've set deleted up for F12 and junk for F10. F11 didn't seem to work for me?

It's such a shame that this type of thing isn't possible with the new Shortcuts app. I was literally trying to make a shortcut feature but it doesn't give me the option to do so.

Thanks for the tip!
 

hg.wells

macrumors 65816
Apr 1, 2013
1,066
789
Automator is your friend, you could set up a simple script to do something like this:

on run {input, parameters} tell application "Google Chrome" to activate tell application "System Events" keystroke "A" keystroke "B" keystroke "C" end tell return input end run

Or you can record a series of steps:

 

Coltaine

macrumors 6502
Jan 7, 2012
321
337
I set up a function key to quickly erase deleted msgs in all accounts.

I choose F15 (but one could choose any other F key or whatever key combo you wished, so long as it doesn't interfere with another one that you use).

What I did:
Go to keyboard pref pane
Click on Shortcuts panel
In the list on the left, click on App Shortcuts
Click the "+" icon to create a new shortcut
In the resulting dialog asking which app, choose Mail
For the Menu Title, you need to be careful because it's a "nested menu":
Mailbox->Erase Deleted Items->In All Accounts
Chose the keyboard command you want (again, I chose F15)
Save it.

Now, with Mail open, when I want to erase all deleted messages, I do this:
Hit F15
In the resulting dialog, "Are you sure you want to erase deleted items in the Trash mailbox", the "erase" button is selected as the default, so I just hit "enter" on the keyboard.
Everything is deleted.

So... I've reduced the "emptying the trash" routine to a quick:
F15, then hit enter.

And it's gone!

I still have to delete junk, bulk, and read messages manually.
Probably best to keep doing that manually, to prevent erasing something that you might actually have wanted to see.

But the quick "one, two" keystroke to empty the trash now makes things easier.

NOTE:
The "->" trick for nested menus works everywhere else, as well.
Something it took me a LONG time to discover !
Thank you very much for that tip!
I came here in search of a Shortcuts function to quickly delete Junk Mails and the Trash. The native keyboard shortcuts are too complicated. Now I set F13 for quickly deleting Junk Mails and F14 for quickly deleting the Trash. Makes the whole action quicker and the key easy to memorize.
 

zebonaut

macrumors newbie
Mar 28, 2013
21
7
Currently; the Earth
Better Still use Voice control. Set it up for the proper keyboard commands or menu titles in the Mail app. Option Command J is Erase Junk. Shift Command Delete is Erase all deleted items. Then simply say "Erase Junk" then "Erase Deleted Items". You'll get the popup box to confirm.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.