I am attempting to get the text and some header information from Apple Mail. I have written a working AppleScript that I plan to use from within Livecode. However, it throws an Applescript execution error when called using the Do command. A very truncated version of the script is listed below. The variable tMessageList is being set to a list of email objects. The error occurs when the code attempts to loop through the list of objects in the repeat loop. This same code works o.k. from applescript editor.
The applescript is held in a field and run from a normal button. The script of the button is here:tell application "Mail"
-- get all the messages in the list with same subject.
set tMessageList to selection
set tEmail to ""
set tbreak to "----------------------- ! -----------------------"
set tOutput to ""
set aMessage to ""
repeat with aMessage in tMessages -- loops from first to last
--From:
--set tSender to the sender of (item x) of tMessages
end repeat
end tell -- Apple Mail
Code: Select all
on mouseUp pMouseButton
put textencode(field "Applescript","UTF-8") into tScript
do tScript as applescript
answer the result
end mouseUp
Any ideas on why the repeat loop throws an execution error ?