Date coersion problem

I’m working on a very simple script where I check an email account for any message with a certain subject line, then create an iCal event based on the contents.

To make life easy, I’m pulling the start date as the first paragraph of the message. eg “5/28/2005 5:00 pm”, then converting it to a date so submit to iCal.

But it doesn’t work. I keep getting the error:

Mail got an error: Can’t make date “5/28/2005 5:00 pm” into type reference.

Even calling it under current application doesn’t work.

here’s a snippet of the code. The first line of the message is exactly the sample above:

	set curcontent to content of curmessage
	set tempeventstart to first paragraph of curcontent
	set eventstart to date tempeventstart

Any ideas?

Thanks,

Browser: Safari 412
Operating System: Mac OS X (10.4)

set tryDate to "5/28/2005 5:00 pm"
set convertedDate to date tryDate
convertedDate
--date "Saturday, May 28, 2005 5:00:00 PM"

works for me. Maybe you need to try the coercion outside of the Mail tell block:

tell application "Mail"
	--whatever code precedes the quoted snippet
	set curcontent to content of curmessage
	set tempeventstart to first paragraph of curcontent
end tell
set eventstart to date tempeventstart

Browser: Safari 125.12
Operating System: Mac OS X (10.3.8)

that was it, thanks!

outside of the tell block it works fine

Browser: Safari 412
Operating System: Mac OS X (10.4)