Previous  |  Main  |  Next
AppleScript Logo

Mark ALL Messages Read

Script for: Mailsmith 1.x, 2.x (OS 9 & OS X)
Copyright: Free, use at your own risk!
Description: This script takes all unread messages within one or more selected mailboxes
and marks them as read (which is useful if you know that you have read all
those messages already!).

This script can be easily modified to apply batch changes of other boolean
message properties as e.g. 'answered', 'forwarded' or 'redirected'.
Necessary: None
Download: Mark_ALL_Messages_Read.hqx
The Script:
tell application "Mailsmith 1.1"
	if exists selection then
		set selected_mboxes to selection as list
		if selected_mboxes is not {} then
			if class of item 1 of selected_mboxes is mailbox then -- only deal with mailboxes
				repeat with i from 1 to count selected_mboxes
					set obj to item i of selected_mboxes
					my process_mailbox(obj)
				end repeat
			else
				my AboutInfo()
			end if
		else
			my AboutInfo()
		end if
	else
		my AboutInfo()
	end if
end tell


on process_mailbox(mbox)
	tell application "Mailsmith 1.1"
		-- set status of all contained messages to 'read':
		set seen of (every message of mbox whose seen is false) to true
		
		-- process submailboxes:
		repeat with i from 1 to count mailboxes of mbox
			set obj to mailbox i of mbox
			my process_mailbox(obj)
		end repeat
	end tell
end process_mailbox


on AboutInfo() -- inform the user to select one or more *mailboxes* in order to use this script:
	tell application "Mailsmith 1.1" to display dialog "With one ore more *mailboxes* selected " & ¬
		"this script will mark all contained messages as read!" with icon note buttons "OK" default button 1
end AboutInfo

 


Contact: Matthias Steffens  |  Previous  |  Main  |  Next  |  Last Updated: 11-Mar-00