|
|
on buildMessageList()
tell application "Mailsmith 1.1"
set xs to (the selection) as list
try
set cName to class of (item 1 of xs)
on error
return false
end try
set msgList to {}
if cName is mailbox then
repeat with i in xs
set msgList to msgList & every message of i
end repeat
else if cName is string then
set msgList to {message of window 1}
else if cName is message then
set msgList to xs
else
return false
end if
return {msgList:msgList}
end tell
end buildMessageList
-- An example of how buildMessageList can be used
on run
tell application "Mailsmith 1.1"
set messageList to my buildMessageList()
if class of messageList is list then
-- write a file with the subject of each message
set nf to new file with prompt "Choose output file"
set wf to open for access nf with write permission
repeat with curMsg in messageList
set curHead to subject of curMsg
write curHead & return to wf
end repeat
close access wf
else
display dialog "Sorry, no messages were selected"
end if
end tell
display dialog "The subject of " & the number of items of messageList & " messages have been written to the file"
end run
|
|||||||||