unfortunately you can’t save messages as RTF text unless you create the RTF code manually on the fly.
Take a look at Andreas Amann’s mail scripts, he also published the Xcode source of his project.
In the Archive Messsage script the RTF code will be created by the script itself.
Sorry to revive an old subject, but I really need to save mail as rtf with embedded attachments.
I’ve got some of the GUI scripting for the Save sheet in mail OK, but the ‘Where’ and the ‘Format’ boxes elude me.
Could someone please advise me how to script these in the following script, and if possible, show me how to save to a path to a folder on the desktop rather than the desktop itself.
Any help much appreciated.
Regards
Santa
set TheDesktop to path to desktop
tell application "Mail"
activate
set t to message 1 of mailbox "Trash"
open t
tell application "System Events" to tell process "Mail"
keystroke "s" using {command down, shift down}
tell window 1
set value of text field 1 of sheet 1 to "test mail"
set temp to value of checkbox "Include Attachments" of group 1 of sheet 1
if temp = 0 then click checkbox "Include Attachments" of group 1 of sheet 1
-- I want to ensure 'Desktop' (or a desktop folder) is selected
-- also ensure a save as rich text format.
end tell
end tell
end tell
tell application "Mail"
activate
set t to message 1 of mailbox "Trash"
open t
tell application "System Events" to tell process "Mail"
keystroke "s" using {command down, shift down}
tell window 1
set value of text field 1 of sheet 1 to "test mail"
if value of checkbox "Include Attachments" of group 1 of sheet 1 = 0 then click checkbox "Include Attachments" of group 1 of sheet 1
tell pop up button 1 of sheet 1
repeat until exists
delay 0.2
end repeat
click
tell menu 1
click menu item "Desktop"
end tell
end tell
tell group 1 of sheet 1
tell pop up button 1
repeat until exists
delay 0.2
end repeat
click
tell menu 1
click menu item 1
end tell
end tell
end tell
end tell
end tell
end tell
Actually, i had to make a small correction, as inserting a value into the text field stopped the ‘Save’ button being hilited.
tell application "Mail"
activate
set t to message 1 of mailbox "Trash"
open t
tell application "System Events" to tell process "Mail"
keystroke "s" using {command down, shift down}
tell window 1
repeat until exists
delay 0.2
end repeat
select text field 1 of sheet 1
keystroke "test mail 4"
if value of checkbox "Include Attachments" of group 1 of sheet 1 = 0 then click checkbox "Include Attachments" of group 1 of sheet 1
tell pop up button 1 of sheet 1
repeat until exists
delay 0.2
end repeat
click
tell menu 1
click menu item "Desktop"
end tell
end tell
tell group 1 of sheet 1
tell pop up button 1
repeat until exists
delay 0.2
end repeat
click
tell menu 1
click menu item 1
end tell
end tell
end tell
keystroke return
end tell
end tell
close window 1
end tell