Solved

create e-mail with apple script - I'm looking for a very simple command

Posted on 2011-02-28
4
666 Views
Last Modified: 2012-06-27
Hello!

I need a very simple AppleScript that just creates an e-mail. The command needs to be systemwide and not be dependent on the application Mail being open. I just need a new e-mail window.

I have tried various variations of the shell command
do shell script "mail"

Open in new window


But I always get an error message that one of the characters is missing.

The Windows equivalent of this command is “mailto:". This will always open a new e-mail in the default mail application.

 your help is greatly appreciated!
0
Comment
Question by:speechrec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
xmlmagician earned 250 total points
ID: 34995717
try this one
tell application "Mail"
			set theNewMessage to make new outgoing message with properties {subject:"Subject text", content:"Content text", visible:true}
			tell theNewMessage
				make new to recipient at end of to recipients with properties {address:"email address"}
				send
			end tell
		end tell

Open in new window

0
 

Author Comment

by:speechrec
ID: 34995840
I know that one, but I don't want any recipient, subject line or content.
Just a naked email.
The kind of e-mail I want

okay,
I've figured it out, partly at least:
tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true}
end tell

Open in new window


It opens in the background. Is there a way to make it the topmost window?
0
 

Assisted Solution

by:speechrec
speechrec earned 0 total points
ID: 34995927
Okay, I've got it.

tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true}
end tell
-- Mail in den Vordergrund bringen!
tell application "Finder"
	try
		set frontmost of process "Mail" to true
	end try
end tell

Open in new window


I'll give you some of the points. Thanks for your help!
0
 

Author Closing Comment

by:speechrec
ID: 35042255
I had to figure it out myself. But it was no big deal.
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question