I am try to create a simple AS that can copy ONLY the from "email address" from the current selected apple mail email and not the name also. …
You may use :
tell application "Mail" set theSelectedMessages to the selection set eachMessage to item 1 of theSelectedMessages log result set theSender to sender of eachMessage set theSenderAsList to my decoupe(theSender, {"<", ">"}) log result set cleanSender to item 2 of theSenderAsList log result set the clipboard to cleanSender end tell
#=====
on decoupe(t, d) local oTIDs, l set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d} set l to text items of t set AppleScript's text item delimiters to oTIDs return l end decoupe
#=====
You may reduce it to :
tell application "Mail" set eachMessage to item 1 of (get the selection) set the clipboard to item 2 of my decoupe(sender of eachMessage, {"<", ">"}) end tell
#=====
on decoupe(t, d) local oTIDs, l set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d} set l to text items of t set AppleScript's text item delimiters to oTIDs return l end decoupe
#=====
Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) dimanche 26 juillet 2015 22:44:51
|