Jump to content


Photo

Mail Actions Workflow [Updated v0.7]

mail workflow

  • Please log in to reply
108 replies to this topic

#1 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 26 January 2013 - 01:10 AM

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, 23 April 2013 - 02:57 PM.

  • phyllisstein, drking, anas and 2 others like this

#2 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationAuckland, New Zealand

Posted 27 January 2013 - 06:49 AM

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.


Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#3 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 27 January 2013 - 10:31 AM

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



#4 CarlosNZ

CarlosNZ

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationAuckland, New Zealand

Posted 28 January 2013 - 06:56 AM

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.


Twitter: @CarlosNZ | My Alfred Workflows: Carl's Geekzone

#5 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 28 January 2013 - 10:38 AM

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.



#6 spacecadet9

spacecadet9

    Member

  • Member
  • PipPip
  • 51 posts

Posted 28 January 2013 - 12:51 PM

Holy moly, this is just what I have been dreaming of!

 

Thanks a million...



#7 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 28 January 2013 - 06:23 PM

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



#8 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 28 January 2013 - 06:23 PM

Holy moly, this is just what I have been dreaming of!

 

Thanks a million...

You're most welcome ;)



#9 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 28 January 2013 - 09:55 PM

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



#10 Carlos-Sz

Carlos-Sz

    Advanced Member

  • Member
  • PipPipPip
  • 737 posts

Posted 29 January 2013 - 04:18 AM

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.



#11 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 29 January 2013 - 10:07 AM

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



#12 civilian

civilian

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 January 2013 - 11:13 AM

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".



#13 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 29 January 2013 - 11:44 AM

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



#14 phyllisstein

phyllisstein

    Advanced Member

  • Member
  • PipPipPip
  • 368 posts
  • LocationNew York, NY

Posted 29 January 2013 - 11:53 AM

Hot damn. I just wish this had come along before I bought MailHub!


  • Pedro Lobo and CarlosNZ like this

alp, Alfred.framework, and my assorted workflows are now abandonware. You can find them at https://github.com/p...stein/Workflows.

 


#15 civilian

civilian

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 January 2013 - 11:53 AM

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



#16 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 29 January 2013 - 12:07 PM

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


#17 civilian

civilian

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 January 2013 - 12:31 PM

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.



#18 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 29 January 2013 - 12:46 PM

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)



#19 civilian

civilian

    Member

  • Member
  • PipPip
  • 41 posts

Posted 29 January 2013 - 12:54 PM

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.



#20 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 29 January 2013 - 01:03 PM

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.

Yeah, I think it's all related somehow, check this latest video for what I mean http://cl.ly/2W1H2E2u2i1n and this too Screen%20Shot%202013-01-29%20at%2013.03.





Also tagged with one or more of these keywords: mail, workflow

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users