1

Since I installed Sierra I can't get a piece of AppleScript working which worked before.

I'm trying to create a message (in Apple Mail) with a signature, but keep getting errors.

I used to create/fill the message like this:

set msg to make new outgoing message with properties {content:messageContent}
set message signature of msg to signature "X"

Before Sierra this worked perfect, now I'm getting an error saying: Mail got an error: AppleEvent handler failed.

So I tried several things and ended up (using AppleScript dictionaries) with:

set msg to make new outgoing message with properties {content:messageContent, message signature:signature "X"}

Which ends up in an error saying: Mail got an error: Can’t make class outgoing message.

Anyone who can help me out on this one?

2 Answers2

0

This is a known bug. I had the same issue.

You also failed to mention that this is for Mail in your original reply. Might want to include the application in future posts!

PHennessey
  • 186
  • 1
  • 7
0

I was having the same problem and came across a working solution. The "button 3" used to be "button 2" until I upgraded to Sierra 10.12.4 this past weekend.

Keystroke "F", is just the first letter of my signature name. Modify that as you wish.

try
    set message signature of theMessage to signature "your signature name"

on error

    tell application "Mail" to activate
    tell application "System Events"
        tell process "Mail"
            click pop up button 3 of window 1
            delay 0.01
            keystroke "F"
            delay 0.01
            keystroke return
            delay 0.01
        end tell
    end tell

end try
Darrell O.
  • 53
  • 1
  • 6