Jump to content

Need help - mark all messages read (Mail.app)


Recommended Posts

Hi All, 

 

I receive a lot of email notifications in different mailboxes and it's getting annoying to click every mailbox and read-all. So I want to create Alfred workflow which would do this with one action.

 

I've found this applescript:

 

tell application "Mail"

     set read status of every message of inbox to true

end tell

 

So this is how my setup looks:

 

mailapp.jpg

 

I think I covered everything but it's not working. It finds the action but when confirming it, nothing happens (emails stay unread).

 

Help will be appreciated.

 

Thanks

Link to comment

Bump, anyone?

 

I was testing out the code that you provided and it didn't work, as you said, but... I tweaked it a little to do..

tell application "Mail" to set the read status of every message in every mailbox of every account to true

 

It appeared to be working but I quit it before it finished because it was taking forever. Give me a little more time to tinker with it and see if I can't speed it up a bit. I'm going to see if I can't just grab a list of all unread messages and set just those to read. Maybe that will be slightly faster.

Link to comment

@David: thanks, that would be great.

 

@barrettj: fixed, thanks, and will keep that in mind.

 

Just curious if you tried Pedro's script and it worked for what you were looking for? If it works, it may be easier to use his than trying to reinvent the wheel with a new script. Just keep me in the loop with what you find and need and I'll try to help out.

 

Thanks

Link to comment

Thanks (I was searching Google not the forum :unsure: ). Downloaded it but I'm not that knowledgeable to be able to decode it and reuse it for my own use. What I've found useful is this command:

 

osascript getUnread.scpt {query} 

 

Which "gets" unread mailboxes but I don't have an idea on how to just get messages inside and mark them as read.

 

Help is appreciated. :)

Edited by D.J.
Link to comment

Thanks (I was searching Google not the forum :unsure: ). Downloaded it but I'm not that knowledgeable to be able to decode it and reuse it for my own use. What I've found useful is this command:

 

osascript getUnread.scpt {query} 

 

Which "gets" unread mailboxes but I don't have an idea on how to just get messages inside and mark them as read.

 

Help is appreciated. :)

 

If I give you some AppleScript to get you going would that suffice or are you unfamiliar with AppleScript all together?

Link to comment

Thanks (I was searching Google not the forum :unsure: ). Downloaded it but I'm not that knowledgeable to be able to decode it and reuse it for my own use. What I've found useful is this command:

 

osascript getUnread.scpt {query} 

 

Which "gets" unread mailboxes but I don't have an idea on how to just get messages inside and mark them as read.

 

Help is appreciated. :)

 

Nevermind, I decided to just go ahead and bang it out. This is still kinda slow because its having to mark that read status of each message on the server, but it does work.

 

It grabs a list of all accounts, then a list of all mailboxes that have an unread count higher than 0, then sets all the messages that are unread in those areas to read.

 

tell application "Mail"
	set allAccounts to the name of every account
	repeat with currAccount in allAccounts
		set unreadMboxes to (every mailbox in account currAccount whose unread count is not 0)
		repeat with currMbox in unreadMboxes
			set (the read status of every message in currMbox whose read status is false) to true
		end repeat
	end repeat
end tell

 

Enjoy.

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