New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Applescript for sending selection as new Mail


Post Reply New Thread Subscribe

 
Thread Tools
gurth4ng

 
Member Since: Sep 06, 2008
Posts: 5
gurth4ng is on a distinguished road

gurth4ng is offline
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:
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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)

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
Attached is a screen shot of my solution. I rely that this is for Safari only.
Attached Images
File Type: png Screen shot 2009-09-18 at 2.32.49 PM.png (78.1 KB, 7 views)

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
gurth4ng

 
Member Since: Sep 06, 2008
Posts: 5
gurth4ng is on a distinguished road

gurth4ng is offline
thx for your replies

what i finally did was something similar.

QUOTE Thanks

Post Reply New Thread Subscribe


« Terminal - Static Library | Question About iMac »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Applescript for Mail pyth OS X - Development and Darwin 4 08-26-2010 05:53 PM
Mail mycough OS X - Apps and Games 4 09-20-2009 07:24 PM
My Mail isn't working! dragonflame8184 OS X - Apps and Games 2 04-12-2007 01:38 PM
Mail Mail, oh my poor mail... Steve1 OS X - Apps and Games 0 05-12-2006 09:14 AM
Mail Folder "exclusively locked" by user klippe OS X - Apps and Games 3 09-06-2005 07:20 PM

All times are GMT -4. The time now is 10:11 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?