[MlMt] Deleting large numbers of items

Kee Hinckley kee+freron at hinckley.com
Sun Jan 26 18:30:07 EST 2014


I had just come to the same conclusion, and actually I like this 
solution better, since in general, I'd like to be notified of any major 
move to trash. I went with the script:

~~~
         script = '#!/bin/bash
count=`wc -l | tr -d " "`
if [ "$count" -gt "5" ]
then
     /usr/local/bin/growlnotify -n MailMate -a MailMate -m "$count 
messages deleted."
fi
';
~~~

However it doesn't _quite_ work on the top level trash, although not in 
a way that makes a big difference. It gets notified once for each actual 
trash mailbox. So if I delete six items, and three are under one account 
and three are under another, it won't be triggered. That's okay though, 
about the only time that would happen is when I'm deleting stuff from my 
junk mailbox.

Do I need to create a Bundle to do this? I hijacked an existing one and 
added a command for testing. Or is there some place I can put arbitrary 
commands?

On 22 Jan 2014, at 8:49, Benny Kjær Nielsen wrote:

> On 21 Jan 2014, at 22:27, Kee Hinckley wrote:
>
>> Short of the addition of the ability to launch a piece of AppleScript 
>> or a Bundle with the current selection, I can't think of any way to 
>> do this. But I wanted to put it out there as a suggestion. (Is it 
>> possible to do either of those things?)
>
> Initial reaction was no. Then perhaps. Then probably. Then yes, except 
> for a bug in the code handling notifications.
>
> You could add a rule to the destination mailbox running a bundle 
> command which looks something like this:
>
> ~~~
> {
> 	name    = 'Notify';
> 	input   = 'formatted';
> 	formatString = "${#body-part-id}\n";
> 	output  = 'actions';
> 	executionMode = multipleMessages;
> 	script  = '#!/bin/bash
> count=`wc -l | tr -d " "`
> if [ "$count" -gt "5" ]
> then
> 	printf "{ actions = ( { type = notify; formatString = \\\"Moving 
> ${count} messages from \\${from.name}\\\"; }, { type = playSound; path 
> = \'Basso.aiff\'; } ); }"
> fi
> ';
> 	uuid = '4BCAA993-94F6-4F14-B90A-E9DA5A854CBD';
> }
> ~~~
>
> The script is inlined which makes it a bit ugly (a lot of escaping), 
> but the logic is simple. If there is more than 5 lines in the input (1 
> message per line) then tell MailMate to show a notification and play a 
> sound. The sound works now, but I don't think the notification works 
> properly before the next update of MailMate is out. The `formatString` 
> for the notification is based on the first message in the set.
>
> Of course, this is going to be shown independently of your action. Any 
> large number of messages moved to the mailbox is going to trigger it.
>
> (And there is a general issue with notifications on Mavericks when 
> Growl is not installed I believe.)
>
> -- 
> Benny
> _______________________________________________
> mailmate mailing list
> mailmate at lists.freron.com
> http://lists.freron.com/listinfo/mailmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20140126/7bb51c9d/attachment.html>


More information about the mailmate mailing list