Skip navigation
This discussion is archived

Set Mail Signature with Run AppleScript Action inside an Automator workflow

3090 Views 5 Replies Latest reply: Dec 7, 2009 8:37 PM by Martin R. Lerch RSS
Martin R. Lerch Level 1 Level 1 (35 points)
Currently Being Moderated
Dec 7, 2009 7:14 PM
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)
  • V.K. Level 9 Level 9 (56,120 points)
    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.
    Mac Pro 3.2 GHz, Mac OS X (10.6.2), Mac Pro 2.66GHz, powerbook G4 1.5GHz
  • Barney-15E Level 7 Level 7 (33,285 points)
    Change it to
    tell application "Mail"
    set the message signature of item 1 of input to signature "My Signature Name"
    end tell
    The result from the previous action is an applescript list. It only contains one item, but it is a list so you must tell it to get item 1 of the list.
    1.8 SP G5/iMac G4 FP/MBP 2.33/PB G3 Pismo, Mac OS X (10.6.2), XLR8 G4 Upgrade for Pismo
  • V.K. Level 9 Level 9 (56,120 points)
    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

    Mac Pro 3.2 GHz, Mac OS X (10.6.2), Mac Pro 2.66GHz, powerbook G4 1.5GHz

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.