Solved

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

Posted on 2011-02-28
4
649 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
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
xmlmagician earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I had to figure it out myself. But it was no big deal.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now