• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Select a mail template/sjabloon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select a mail template/sjabloon


  • Subject: Re: Select a mail template/sjabloon
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 10 Jun 2015 21:55:09 +0200


Le 10/06/2015 à 10:28, Fred Diepeveen <email@hidden> a écrit :

Hi,
I've some templates in mail. These are very handy when I need to send out a lot of emails with standard text/links/logo's etc. Can anybody help me how to select a template in applescript when creating a new mail message? I don't want to use signature. 
Mvgr.

Here is the piece of code I posted some hours ago in macScripter as an answer to a resembling question.


set MsgSender to "email@hidden" -- must be configured address, or will default (but still runs fine).
set MsgRecipient to "email@hidden" -- changed this to valid recipient

tell application "Mail"
set TheMessages to the selection -- this is a list
repeat with current_Message in TheMessages -- individual message
set fwd_Message to forward current_Message with opening window
tell fwd_Message
activate
set sender to MsgSender
set my_recipient to make new to recipient at end of to recipients with properties {address:MsgRecipient}
my grabIt()
end tell
end repeat
end tell

on grabIt()
tell application "System Events" to tell process "Mail"
set frontmost to true
keystroke "a" using {command down}
keystroke "x" using {command down}
end tell
delay 0.5
--set theDatas to the clipboard


tell application "TextEdit"
activate
set tEditDoc to make new document
end tell
tell application "System Events" to tell process "TextEdit"
set frontmost to true
keystroke "v" using {command down}
end tell


tell application "TextEdit" to tell tEditDoc
delete (paragraphs 1 thru 10)
end tell
set the clipboard to ""
tell application "System Events" to tell process "TextEdit"
set frontmost to true
keystroke "a" using {command down}
keystroke "c" using {command down}
end tell
delay 0.5
tell application "TextEdit"
close tEditDoc without saving
end tell


tell application "Mail" to activate


tell application "System Events" to tell process "Mail"
set frontmost to true
keystroke "a" using {command down}
keystroke "v" using {command down}
end tell


end grabIt


Yvan KOENIG (VALLAURIS, France) mercredi 10 juin 2015 21:55:05












 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Select a mail template/sjabloon (From: Fred Diepeveen <email@hidden>)

  • Prev by Date: Re: Setting default printer request.
  • Next by Date: Re: Re: Setting default printer request.
  • Previous by thread: Select a mail template/sjabloon
  • Next by thread: Adding a prefix or suffix to all headings in Word
  • Index(es):
    • Date
    • Thread