Converting Emails Into iCal ToDo's

In attempt to make my life a little more organized I am trying to make it so I can send texts to my Mail account. Then using the rules function in Mail run an Applescript to extract the contents of the message and use that for the summary of the ToDo in iCal.

However the script is not working how I would like it to - in fact it doesn’t really work at all. The rule is set up correctly, so it is something in the script. I am rather green when it comes to Applescript so it is most likely some stupid error, but I cannot figure out what it is. Any help or suggestions would be much appreciated.


using terms from application "Mail"
	on perform mail action with messages allMessages
		tell application "Mail"
			repeat with thisMessage in allMessages
				set theText to subject of thisMessages
				tell application "iCal"
					tell calendar "Email"
						make new todo at end with properties {summary:theText}
					end tell
				end tell
			end repeat
		end tell
	end perform mail action with messages
end using terms from

I’ve moved your post to this forum for a quicker answer. One thing I noticed right away:

repeat with thisMessage in allMessages
               set theText to subject of thisMessages

is inconsistent. thisMessages is not defined; just a typo.

Well that would do it. Thanks for the help.