Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Set Mail Signature with Run AppleScript Action inside an Automator workflow

Hello,

Not sure if I am posting this at the right spot, but I would need some assistance. I am trying to write an Automator Workflow application. The purpose for this application is to:
1. Drag one or more attachments on the application/droplet icon
2. Automator workflow creates a new mail message in Mail with the attached items already addressed and ready to go to

I setup the following Workflow inside Automator:
1. New Mail Message
2. Add Attachments to Front Message

So this is all working just fine. Now I would like to add a step in between of type "Run AppleScript". In this "Run AppleScript" action I have the following code:

on run {input, parameters}
tell application "Mail"
set the message signature of input to signature "My Signature Name"
end tell
return input
end run

So my workflow looks now like this:
1. New Mail Message
2. Run AppleScript
3. Add Attachments to Front Message

I am getting the following error:

Can’t make «class situ» "My Signature Name" of application "Mail" into the expected type.

So, in essence I am trying to select a signature for that particular new mail message in this workflow. And that does not work. Any help would be appreciated.

Martin

MacBook Pro 17" 2.33GHz, Mac OS X (10.6.2)

Posted on Dec 7, 2009 7:14 PM

Reply
Question marked as Best reply

Posted on Dec 7, 2009 7:25 PM

change the applescript action as follows


on run {input, parameters}
tell application "Mail"
set the message signature of (item 1 of input) to signature "My Signature Name"
end tell
return input
end run


see if it works now.
5 replies

Dec 7, 2009 7:54 PM in response to V.K.

V.K. thanks for your swift reply. So I made the changes per your instructions. I ran the "Application" inside Automator and it works. The mail message is created, then the AppleScript runs fine and selects the correct signature, and the attachments action will not work inside Automator anyway. So I thought it was solved.

Now I saved the workflow application and dragged 2 attachments on the Workflow application icon and the following happens:
- mail is created
- items are attached
- signature still set to None.

Then I tried changing the order inside the Automator workflow to:
- New Mail Message
- Add Attachments to Front Message
- Run AppleScript

But that didn't work either. No signature change. Any other suggestion?

Dec 7, 2009 8:05 PM in response to Martin R. Lerch

first, you don't need the extra action to add attachments. if you drop some items on the saved application they will be passed to the "new Mail message" action as input and will be added as attachments. also, in my testing it seems that the processes of attaching the attachments seem to bump against the process of adding the signature. it get the same result as you originally but if I add a delay to the run applescript action then it works as it should so try

1. new mail message.
2. run applescript

on run {input, parameters}
delay 1
tell application "Mail"
set the message signature of (item 1 of input) to signature "My Signature Name"
end tell
return input
end run

Set Mail Signature with Run AppleScript Action inside an Automator workflow

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.