Get Variables from Mail-Content

Hi folks,

I’m just starting to use automator and applescript (coming from the web- and flash-dev corner).
I’ve already written some “autohotkey” scripts under winXP, but applescript is way different from that one
and i’m not really getting into it somehow…

Here’s what I’m trying:

  • a Mail rule sorts all incoming messages with a certain header into the mailbox “Automator”
    works fine, not a big deal…

  • those e-mails contain numerous variables, one per paragraph, which will all be needed in later parts of the script
    i’ve tried to catch the single paragraphs with the following script,
    but it doesn’t work


tell application "Mail"
	set m to every message in mailbox "Automator" of account "IMAP" whose deleted status = false
	repeat with eachMes in m
		set mes to content of message eachMes as Unicode text
		set pcnt to count of paragraphs in mes
		set mailvars to {}
		repeat with pgraph from 1 to pcnt
			set par to the paragraph pgraph of mes
			if par ≠ 0 then
				set mailvars to every word of par
				my passover(mailvars)
			end if
		end repeat
	end repeat
end tell


on passover(pge)
	tell application "TextEdit"
		write pge
	end tell
end passover

it produces following error message:
«class ctnt» of «class mssg» (item 1 of {«class mssg» id 260168 of «class mbxp» “Automator” of «class mact» “IMAP” of application “Mail”}) of application “Mail” kann nicht in Typ Unicode text umgewandelt werden.
(engl.: “couldn’t convert message to unitext”)

changing line

set mes to content of message eachMes as Unicode text

to

set mes to content of message eachMes

gives
žMail" hat einen Fehler erhalten: žmessage (message id 260168 of mailbox “Automator” of account “IMAP”)" kann nicht gelesen werden.
(engl.: “message could not be read”)

Would be extremely thankful for any tips and hints!

Model: MBP 2,33 c2d, MacMini 1,83 c2d, all on 10.5.2
Browser: Safari 525.18
Operating System: Mac OS X (10.5)

Hi,

the Unicode text coercion is not needed, the class of content is Unicode text.
eachMes is a reference to a message, the additional message causes the error


.
set mes to content of eachMes
.

Yap, that’s it! Thanks a lot!