I’m trying to write a script that replies to the currently selected email message. I can create the reply email easily enough with Mail’s
reply command, but I cannot seem to alter the content of the message.
Here’s what I have:
use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions tell application "Mail" set firstSelectedMessage to item 1 of (get selection) -- get the currently selected email set newMessage to reply firstSelectedMessage with opening window -- create a reply message -- Alter the reply message... set existingContent to newMessage's content set newContent to "Hello, Some additional text goes here... " & existingContent set newMessage's content to newContent -- Check that the change took set xxx to newMessage's content if xxx = newContent then display alert "Good!" else if xxx = existingContent then display alert "Nothing's Changed" else display alert "Bad" end if end tell
When I run this, I get the “Nothing’s Changed” alert. I cannot seem to get my changes to the reply message’s content to be accepted. Does anyone have any insight into this?
I’m running Mojave.