Is there a Keystroke for Complete Deletion of E-mails in the Spam Folder?

Many, many, thanks for the continuing support of SpamSieve. For now over 6 years, it has been one of my most treasured tools by taming my incoming e-mail stream. It continues to work superbly with almost never a false positive; however, just to be safe, I do periodically check my Spam folder in Mail and I’m hoping there’s a way to simplify my current practice of deleting the spam e-mails found there.

At present, once I’ve confirmed all the messages in the Spam folder are, indeed, spam, I do a Command-A to select them all and then hit the Delete key–which puts them into Mail’s Trash folder–but then I have to select that Trash folder and do both steps again. I’m hoping once selected in the Spam folder, there’s something I can do to get them completely off my computer in one step.

Is there a keystroke combination (or something else I could set up on my computer and trigger with a single keystroke) that, once the e-mails are selected in the Spam folder, would truly delete them–bypassing those messages first being put in the Trash folder? (If it’s some sort of script, I’d need the specifics as creating a script isn’t something I have done before.)

Thanks,

David
[SpamSieve v2.9.7; Mac OS 10.8.4 on MacBookPro6,2]

In Mail’s Accounts preferences, you can set it to auto-empty the trash. That might be the simplest solution here.

You could install the Apple Mail - Discard Spam script and use FastScripts to assign it a keyboard shortcut. This simply automates moving the messages to the trash and emptying the (whole) trash.

Already using that with “One month old”.

You could install the Apple Mail - Discard Spam script and use FastScripts to assign it a keyboard shortcut. This simply automates moving the messages to the trash and emptying the (whole) trash.
Bingo! Just what I’m looking for.

Thanks,
David

Does Your “Apple Mail - Discard Spam” Script Need a Tweak for OS 10.9 Mavericks?
I just updated my MacBookPro6,2–now running SpamSieve v2.9.10–from Mountain Lion to Mavericks and now invoking that script produces the attached advice that “GUI Scripting is not enabled”, but there does not appear to be in Mavericks a “Universal Access preference pane” to go to to “Enable access for assistive devices”. (There is an Accessibility preference, but not with that option to enable–and I’d expect the preference name change might be a showstopper.)

That script, along with FastScripts, had provided a huge enhancement to my workflow and I hope you can help get it working, again, for me.

Thanks,

David

GUI Scripting is not enabled.png

In Mavericks, the setting is under “Security & Privacy” > Privacy > Accessibility. You then have to check the box next to the app that’s running the script.

Re: Does Your "Apple Mail - Discard Spam" Script Need a Tweak for OS 10.9 Mavericks?

Thanks; that did the trick.

Now who is responsible for updating the text in that error message (which included the corrective action to take)–at least for Mavericks (and likely later OS updates)? The developer of FastScripts? The OS? Some other party? As I’ve shown, if it weren’t for your advice, I didn’t know what I had to do in lieu of what the corrective action said to do.

David

I’ve updated the error message in the script.

Thanks.

David

Error Message Using the “apple-mail-discard-spam” Script
Recently something is changing something such that when I invoke that “apple-mail-discard-spam” script using my assigned hot keys (control-delete), I get the error message (see attached screenshot):

Error Number:System Events got an error: Can’t get sheet 1 of window 1 of application process “Mail”. Invalid index. -1719"

As also shown in that screenshot, a sheet is open in the background asking whether I am sure I want to erase deleted items in the Trash mailbox. When I Close the error window, I then click the Erase button in the sheet and the erasure occurs. (Before, I’d initiate the script with my hot keys and it would do everything without further intervention–i.e., it deletes anything in my Spam mailbox and then empties my Trash mailbox.) Once the error has begun to occur, it is presented even if the Spam and Trash mailboxes are already empty when I initiate the script.

Once the error starts to occur following an initiation by my hot keys, it will persist for all subsequent initiation until some unknown event(s) or sequence of events occurs–and then it’ll perform normally until something changes to cause the errors to start up, again. Simply Quitting and Re-Launching Mail, and/or Log-out/Log-in, and/or a Restart won’t assuredly clear the error occurance.

Any suggestions? That script has been a real blessing as it’s a real time saver for me. I’d like to get back to where just my hot-keys initiation will be sufficient to complete the sequence of events.

David
MacBookPro11,3; OS 10.9.2; Mail Version 7.2 (1874); apple-mail-discard-spam.scpt date modified 25 Oct 2013, 13:44

Scripting Error.png

How are you assigning a hot key to the script—FastScripts? Does it work if you choose the command from the menu? Also, please try the current (2013-12-21) version of the script.

Yes. It’s Version 2.6.5 (433)–which its Check for Update reports is the current version.

Does it work if you choose the command from the menu?

Can’t try at the moment as, again for no known reason, it has stopped throwing that error.

Also, please try the current (2013-12-21) version of the script.

Will do. (Sorry, didn’t check to see if it were current as I didn’t look again after you had reported earlier in this thread that you had updated the script to correct a different error-message text in the script). I will report back if and when the error should begin occuring again with that later version of the script.

Thanks,
David

For the record, the .scpt file I found there–and have installed–carried Dates Created & Modified of 15 Jan 2014, 14:56.

And, at the moment, invoking that new script using the same hot-keys combination caused the script to complete without throwing up the error which, as earlier reported, had also been the reverted case with the earlier-installed 25 Oct 2013 version of the script. (The sheet asking to confirm the Trash erasure is still displayed–as it always had been–but is back to being cleared without my action on it.)

David

It has just begun to occur again with the latest version of the script.

David

OK. I’m not sure why that is happening for you. I’m working on an improved version of the script that will bypass the sheet. I’ll post here when it’s ready.

Many thanks; will look forward to that advice.

David

I’ve posted a new version of the Apple Mail - Discard Spam script that does not rely on GUI scripting, so it should be more reliable.

Thanks. Installed it; it (so far) isn’t throwing any errors; as promised, the sheet to confirm erasing the Trash mailbox no longer appears; and a new approach to eliminating the Spam mail seems to have been adopted.

Before, running the script not only deleted any entries in the Spam mailbox, but then also completely emptied (erased) the Trash mailbox (including e-mails there that hadn’t come from the Spam mailbox).

Now it appears that running the script directly erases anything in the Spam mailbox and leaves untouched what had already been in the Trash mailbox. I hope I’m interpreting correctly what is happening with the new script as, for me, that is an enhanced approach.

David

Yes, the original (before your posting) reason for writing the new script was to preserve the contents of the trash when discarding the contents of the Spam mailbox.

Michael: Might your <apple-mail-discard-spam.scpt> need any tweaking for use under OS 10.10 (Yosemite)? I’m running the version with creation & modification date/time of Aug 25, 2014, 13:05 using a Control-Delete keystroke combination to trigger the script using FastScripts under Yosemite on my MacBookPro11,3.

The script had been working just fine through OS 10.9.5, but now I’m finding the script is intermittently just moving messages in my Spam folder into the Trash folder and leaving them there–rather than directly deleting them. Although I had upgraded to Yosemite on its public release date, I just noticed this intermittent behavior of the script. Of the last 3 executions–each was with just one message in the Spam folder–the first 2 executions just moved the spam e-mail into the Trash Folder; the last performed properly and deleted the spam e-mail. (For what it’s worth, in all three instances the spam e-mail was still identified as unread.)

Any thoughts?

Thanks,
David

Status Update: Since then, the script has been executed at least 6 more times–often with multiple e-mails in the Spam folder–and has performed properly in each of those instances (i.e., those identified-as-spam e-mails were directly deleted).

If and when the script should misbehave again, I’ll provide another update to report the recurrence.

David