Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create Outlook-like reminders for Mail ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create Outlook-like reminders for Mail
Authored by: drm0223 on Sep 15, '12 01:11:22PM

The work flow doesn't work, as it appears.

A '"' is needed a the end of the line starting
set the_subject to do shell script ...

The statements
tell list "Follow-ups"
end tell
are not needed and generate errors.

With these two changes, I got it to work! Thanks for the idea!



[ Reply to This | # ]
Create Outlook-like reminders for Mail
Authored by: prachigauriar on Sep 17, '12 07:56:57AM
Right, I forgot a close " on the sed command. If you update it as follows, things will work.

on run {input, parameters}
	set the_reminders to {}
	
	repeat with the_message in input
		tell application "Mail"
			-- If the subject starts with any number of "Re:" or "Fwd:", remove them
			set the_subject to do shell script "echo '" & the_message's subject & "' | sed -E -e 's/^((Re|Fwd): )*//g'"
			set the_name to "Re: " & the_subject
			set the_body to "message://%3c" & the_message's message id & "%3e"
		end tell
		
		tell application "Reminders"
			tell list "Follow-Ups"
				-- Set the date to 9am tomorrow
				set reminder_date to (current date) + 1 * days
				set time of reminder_date to 60 * 60 * 9
				
				set the_reminder to (make new reminder with properties {name:the_name, body:the_body, remind me date:reminder_date})
				set end of the_reminders to the_reminder
			end tell
		end tell
	end repeat
	return the_reminders
end run
As for the tell list "Follow-Ups" thing, that adds it to a specific list named "Follow-Ups". If you remove the tell block, itíll probably just add it to the default (or currently selected) list of reminders.
Edited on Sep 17, '12 08:00:15AM by prachigauriar


[ Reply to This | # ]