1

I have the following Apple Script:

tell application "Mail"
    make new outgoing message with properties {message signature:(signature named "MyTestSignature")}
    activate
end tell

This will open a new e-mail window and change the signature to the pre-defined signature called MyTestSignature.

But I don't want Apple Script to create a new window. Instead I want Apple Script to change the signature of the e-mail that's already open and in the foreground.

How can I do that?

2
  • 1
    What have you tried so far?
    – nohillside
    Commented Aug 25, 2023 at 8:52
  • @nohillside I played around with the script above but with no success.
    – David
    Commented Aug 25, 2023 at 9:13

1 Answer 1

1

I finally found a solution myself.

Here's the working code:

tell application "Mail"
    activate
end tell

tell application "System Events"
    tell process "Mail"
        click pop up button "Signatur:" of window 1
        click menu item "Test-Signatur" of menu 1 of pop up button "Signatur:" of window 1
    end tell
end tell

ATTENTION: This is German language. You'll have to change Signatur: (two times in code, and don't forget the colon) to your language, depending on how the button is called in your Apple Mail app. Also you need to replace Test-Signatur by the exact name of the signature you want to select.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .