Applescript for sending selection as new Mail

Joined
Sep 6, 2008
Messages
5
Reaction score
0
Points
1
Hello. What i'm trying to achieve is adding an option to Safari for getting the selected text and sending it to Mail as the content of a new email message, along with the website's url. The already available action "New Mail Message" is able to do half of what i'm asking: it can send my selection to Mail as the content of a new emal message, but nothing more. I'm trying to compose an Applescript to run from within my Automator Service, but i'm getting an error:
The action "Run AppleScript" encountered an error.

Any ideas?

Here is the script i'm using:
Code:
on run {input, parameters}
	
	set myBodyText to value of variable "mySelection" of front workflow
	set siteURL to value of variable "mySiteURL" of front workflow
	
	tell application "Mail"
		make new outgoing message with properties {visible:true, subject:"Something Interesting", content:"" & siteURL & myBodyText}
	end tell
	
	return input
end run

And here is a screenshot of my Automator Workflow:
2qi2xom.jpg
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Hit the return key after the "end run" line. And here I thought that was a Microsoft issue.

Also you might want a line gap between the URL and the body so here is a hint;
Code:
	-- define our carriage return and line feed
	set CLRF to (ASCII character 13) & (ASCII character 10)
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Attached is a screen shot of my solution. I rely that this is for Safari only.
 

Attachments

  • Screen shot 2009-09-18 at 2.32.49 PM.png
    Screen shot 2009-09-18 at 2.32.49 PM.png
    78.1 KB · Views: 9

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top