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


Click here to return to the 'Use iCal to set a response reminder for a Mail message' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use iCal to set a response reminder for a Mail message
Authored by: blueeye on Jul 11, '05 05:16:26PM

To avoid the delay caused by shell script mdfind, I found the following script much faster in producing a URL of the selected mail message, identified as variable theURL, to hand off to iCal.

property LibraryPath : (path to library folder from user domain) as string
property MailBoxPath : LibraryPath & "Mail:Mailboxes:"

tell application "Mail"
tell message viewer 1
set MailBoxName to ""
set b to item 1 of (get selected mailboxes)
set i to 1
try
repeat while class of b is mailbox
set {n, b} to {name, container} of b
if i is 1 then
set MailBoxName to n
else
set MailBoxName to n & ":" & MailBoxName
end if
set i to i + 1
end repeat
end try
end tell
set theMessages to selection --assuming that a message has been selected
repeat with eachMessage in theMessages
set msgID to id of eachMessage
end repeat
set URLPath to (MailBoxPath & MailBoxName & ".mbox:Messages:" & msgID & ".emlx")
tell application "System Events" to set theURL to URL of alias (URLPath)
end tell



[ Reply to This | # ]
Use iCal to set a response reminder for a Mail message
Authored by: mark hunte on Jul 11, '05 07:50:33PM
I do not seem to have any delay on my Mac using the mdfind, but i will try you script out,, cheers

also here is a way to jump to the event of the selected email. that zmagyar was
after using the id of the email, again I have been tied up so hav not had time to rewrite all of this into
on whole script.

but using these bits the script will now make the event reminder with a working
Url. and also be able to jump from a email to its event if it exists.

I will write it up soon, as I am sure others will, to their preferred version.

tell application "Mail"
	set theMessages to selection
	repeat with eachMessage in theMessages
		set theId to id of eachMessage as string
	end repeat
end tell

tell application "iCal"
	
	repeat with aCalendar in calendars
		tell aCalendar
			set the_none to "0"
			if exists (some event whose description contains theId) then
				
				set theEvent to (some event whose description contains theId)
				activate
				show theEvent
			else
				set the_none to "no match found"
			end if
			
		end tell
	end repeat
end tell
if the_none is equal to "no match found" then
	display dialog the_none
end if 

---
mh

[ Reply to This | # ]