Jump to content

Mail Actions Workflow [Updated v0.7]


Recommended Posts

Introducing Mail Actions

Screen%20Shot%202013-02-03%20at%2022.17.

 

Go crazy minimal with Mail.app and still stay functional thanks to the power of Alfred 2 Workflows. See it in Action here

Features
Use Alfred to:

  • Navigate Mailboxes from Alfred.
    Drill down to the Mailbox you want and action the result.
  • Move/Copy selected emails with Alfred.
    Type a few keywords to choose the desired folder. ↩ to move, ⌥+↩ to copy.

Optimisations
In order to limit the overhead of always having to query and generate a list of all Mailboxes, the workflow store the information in a plist file that is updated every 7 days. The file is located at:

~/Library/Application Support/Alfred 2/Workflow Data/com.palobo.mailactions/mbCache.plist

Installation
Download and import or alternatively use AlfPT.


Usage
Keywords

  • mm - Move the selected messages to the chosen folder;
  • mm - With ⌥ as modifier copies the messages rather than moving
  • mg - Go To the chosen folder.
  • mgu - Show list of mailboxes with unread messages

  • minfo - Choose to view either Info & Usage or Change Log. Tries to use Marked otherwise it will use your default app for .md files.

Hotkeys

  • ⇧⌘A - Toggle script to Move/Copy messages
  • ⇧⌘Z - Toggle script to Go To Mailbox;
  • ⇧⌘R - Mark every unread message in current mailbox as read;
  • ⇧⌘D - Delete every message in current mailbox!! (USe with caution)
  • ⌘U - Show list of mailboxes with unread messages

 

Todo

  • Implement an action to update the cache on demand;
  • Add history feature, showing list of last X used mailboxes for quick access;
  • Filter list of mailboxes with unread mail;
  • Integrate other useful workflows such as send to evernote/taskpaper etc.;

Changelog

  • 23-04-2013
    • FIXED: Code optimisation by Carlos-SZ. Results are now limited to 20 mailboxes at a time. XML Encoding has also been optimised (Initial work by Carlos-Sz, improved by Ursan Razvan).
  • 04-02-2013
    • FIXED: Unread count was getting stored with folder list and not being updated on each run;

    • NEW: Hotkey to mark all messages (unread messages in current mailbox) as read;

    • NEW: Hotkey to delete every message in current mailbox (useful for me anyway)

    •  

      NEW: Keyword/Hotkey to show list of mailboxes with unread messages

  • 03-02-2013
    • Now shows unread count next to mailboxes that have unread emails.
  • 29-01-2013
    • Added Support for Local Mailboxes
    • Added a new Action to view Info & Usage or Change Log
  • 28-01-2013
    • Fixed small encoding bug where special characters weren't encoded thus forming invalid XML.
  • 27-01-2013
    • Fixed wrong information in the Go To action (Thanks CarlosNZ);
    • Uploaded to AlfPT (Forgot to do that initially)
Edited by Pedro Lobo
Link to comment

This is fantastic. Nice work! I think I could get used to this. (And to think I once paid money for a "Mail action" software that wasn't actually all that useful in the end :rolleyes: )

 

Just one thing: the "mg" keyword still shows "Choose mailbox to move to" instead of "Goto mailbox" (but it does behave as expected). :huh:

 

screenshot20130127at748.png

 

Cheers.

Link to comment
This is fantastic. Nice work! I think I could get used to this. (And to think I once paid money for a "Mail action" software that wasn't actually all that useful in the end :rolleyes: )

 

Just one thing: the "mg" keyword still shows "Choose mailbox to move to" instead of "Goto mailbox" (but it does behave as expected). :huh:

 

screenshot20130127at748.png

 

Cheers.

 

Oops, Nice catch. Fixed and updated the first post and also uploaded to AlfPT (forgot to do it before)

 

Cheers,

PL

Link to comment

Hey Pedro, one more little bug I've found - it seems to have problems with Mailboxes that have the "&" character in them. One of mine, called "Bills & Invoices" just doesn't show up all. I can only assume it's the "&" character causing trouble.

Link to comment
Hey Pedro, one more little bug I've found - it seems to have problems with Mailboxes that have the "&" character in them. One of mine, called "Bills & Invoices" just doesn't show up all. I can only assume it's the "&" character causing trouble.

 

Hey Carlos,

 

Thanks for the info. I'm also seeing this with a few other folders. Strange thing is that it's with normal names even, such as "Other". I'll have a look into this later tonight and update with a fix once I've found it.

Link to comment

Tracked this down. Think it may be a bug in Alfred. I've already created a bug report so we'll have to wait and see. As soon as I get some feedback I'll update here.

 

In the meantime I guess we'll just have to do it "the old fashioned way" :D

Link to comment
Hey Pedro, one more little bug I've found - it seems to have problems with Mailboxes that have the "&" character in them. One of mine, called "Bills & Invoices" just doesn't show up all. I can only assume it's the "&" character causing trouble.

Hey Carlos,

 

Got it fixed, at least in my tests it's working ok. Update (download link above or via AlfPT) and let me know if you catch any other bugs.

 

Cheers,

PL

Link to comment

I’ve just installed it. It’s a great idea but it does not list any mailbox (mm and mg commands) at all.

 

By the way, there is no "...Workflow Data/com.palobo.mailactions/mbCache.plist” in my "~/Library/Application Support/Alfred 2” folder. Maybe the the Workflow is not creating it as soon as it is installed?

 

Thank you.

 

 

Upate 01:

 

Here’s an error from the Workflow log:

 

getList.scpt: execution error: Can’t make "Finder got an error: Can’t make \"Macintosh HD:Users:XXX:Library:Application Support:Alfred 2:Workflow Data:\" into type item." into type boolean. (-1700)

 

 

Update 02:

 

I checked the Workflow code and it seems it was expecting the “Workflow Data” to exist. I created it and now the Workflow lists mailboxes but in a strange way e.g. missing mailboxes, sometimes as I type the last letter is repeated… I’ll check a bit more. 

 

Update 03:

 

By the way, the mbCache.plist didn’t list mailboxes created On My Mac. It seems it is listing only default mailboxes, such as INBOX or TRASH or JUNK and mailboxes created On iCloud.

 

Update 04:

 

I edited the mbCache.plist to make some tests and it seems the Workflow is expecting an account name but local (on mac) mailboxes are not attached to an account.

 

 

Update 05:

 

I’ve edited “moveMsg.scpt” and removed the "of account acct” part of the code and it is working for local (on mac) mailboxes. However, this part of the code seems to be necessary for mailboxes attached to an account (such as iCloud).

 

I had to manually edit mbCache.plist to add the local mailboxes first though.

 

In resume, the Workflow as it is does not work with local mailboxes but I think there is a way… :)

 

Conclusion:

 

In order to work with local mailboxes the account string could be null so the moveMsg.scpt can filter action to move considering an account or not.

 

However, I’m not sure how you will list local mailboxes in the mbCache.plist.

Link to comment

Heh, nice test Carlos.

 

Point 1: Workflow Data should exist. What version are you using? If I'm not mistaken, Workflow Data was introduced in b86 (or sooner).

Point 2: Yeah, I don'r really use local mailboxes so I didn't foresee that, sorry about that. I'll have a look into fixing that soon.

 

Cheers,

PL

Link to comment
Pedro, if I trigger the mail action with the hotkey (shift+command+A or shift+command+Z), every letter is typed twice after the second letter. ex, if I want to type icloud, it will be typed as iclloouudd. it works fine if I trigger by typing "mm" or "mg".

Ar you running the latest version? If I recall correctly that was a bug in an earlier version. (Repeated Keys After Using Auto-Complete At The Beginning Line [Fixed b86])

 

I can't replicate this on my setup. What are you using? OS version and Alfred 2 version?

 

Cheers,

PL

Link to comment
Alfred 2.0 (94) and ML 10.8.2. also made sure that these hotkeys are not used anywhere else.

Hmm, that is strange indeed. I can't replicate this no matter how I try. Have you tried changing hotkeys?

 

Please try the following:

  1. Change hotkeys and try again (Fixed if not then step 2);
  2. Remove the hotkey trigger and re-add. Try again if not fixed try step 3;
  3. Install this simple workflow and trigger the hotkey see if that happens too: http://cl.ly/2I3f2k1g2A2Z
Link to comment

Hmm, that is strange indeed. I can't replicate this no matter how I try. Have you tried changing hotkeys?

 

Please try the following:

  1. Change hotkeys and try again (Fixed if not then step 2);
  2. Remove the hotkey trigger and re-add. Try again if not fixed try step 3;
  3. Install this simple workflow and trigger the hotkey see if that happens too: http://cl.ly/2I3f2k1g2A2Z

1. not fixed.

2. not fixed

3. test workflow works fine.

this issue of repeating keys is only in Mail Actions workflow. all my other workflows are not affected.

Link to comment
1. not fixed.

2. not fixed

3. test workflow works fine.

this issue of repeating keys is only in Mail Actions workflow. all my other workflows are not affected.

Ah, finally managed to replicate on my system too. 

 

Trigger hotkey, start typing something. Delete to beginning of line and start type again. I'll update the bug report above stating that this is still happening. It could be something on the workflows end but not sure.

 

Will report back with more news once I have it.

 

Here's a quick video of the error in action, can you confirm this is what happens to you too? (http://cl.ly/0d0p3g0A3M2K)

Link to comment
Ah, finally managed to replicate on my system too. 

 

Trigger hotkey, start typing something. Delete to beginning of line and start type again. I'll update the bug report above stating that this is still happening. It could be something on the workflows end but not sure.

 

Will report back with more news once I have it.

Here's a quick video of the error in action, can you confirm this is what happens to you too? (http://cl.ly/0d0p3g0A3M2K)

this is not exactly the same.

Trigger Hotkey, start typing, first two letters are typed ok, after that each letter is displayed/typed twice.

example: iclloouudd, inbbooxx.

Link to comment

FYI - the duplicate keypress thing is a known bug in Alfred, reported elsewhere (can't find the thread right now). I've seen it on my own workflows too - it seems to happen after you backspace or edit your query in the Alfred window. So I don't think you need to worry about that particular one.

Link to comment
FYI - the duplicate keypress thing is a known bug in Alfred, reported elsewhere (can't find the thread right now). I've seen it on my own workflows too - it seems to happen after you backspace or edit your query in the Alfred window. So I don't think you need to worry about that particular one.

 Yeah, I've updated the bug report already. Supposedly it was fixed in b94 but still persists.

 

Andrew as always is on the case ;)

Link to comment
FYI - the duplicate keypress thing is a known bug in Alfred, reported elsewhere (can't find the thread right now). I've seen it on my own workflows too - it seems to happen after you backspace or edit your query in the Alfred window. So I don't think you need to worry about that particular one.

happens on my side without any backspace or editing.

@Pedro, one more thing I have noticed, there is duplicate key press only when i type account name/description. If I type any folder name (inbox, archive or spam), there is no such issue.

Link to comment
Heh, nice test Carlos.

 

Point 1: Workflow Data should exist. What version are you using? If I'm not mistaken, Workflow Data was introduced in b86 (or sooner).

Point 2: Yeah, I don'r really use local mailboxes so I didn't foresee that, sorry about that. I'll have a look into fixing that soon.

 

Cheers,

PL

 

Point 1: I was using b72. I have updated to b94.

 

Point 2: Great! Thank you.

Link to comment
this is not exactly the same.

Trigger Hotkey, start typing, first two letters are typed ok, after that each letter is displayed/typed twice.

example: iclloouudd, inbbooxx.

 

Good news, Andrew's managed to nail this bug. Should be all good in the next release so we'll just have to wait a little.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...