Send an email directly to a fix address in background (Mail)

General discussions about LaunchBar
Post Reply
ptujec
Wizard
Wizard
Posts: 321
Joined: Fri Dec 19, 2008 11:36 am
Contact:

Send an email directly to a fix address in background (Mail)

Post by ptujec » Thu Feb 12, 2009 12:37 am

I use this script to send my wife quick notes.
(Would be cool if the script would be more flexible when it comes to the recipient. But unlike Quicksilver there is no "third window" in LaunchBar. Should be possilble though ...)

You have to edit this script for your purpose (address and greeting/last line)
Give it a name and save it in "~/Library/Application Support/LaunchBar/Actions"

Code: Select all

--------------------------------------------------------- 
-- This scripts lets you write a message in LaunchBar and send it in the background to a fix address
--
-- http://www.mactipper.com/2008/12/applescript-to-send-screenshot.html
-- http://www.macosxhints.com/article.php?story=2005030715313097
--
-- modified by @ptujec for LaunchBar
---------------------------------------------------------

on handle_string(message)
   
   -- the recipients address
   set the_address to "example@example.com"
   
   -- inserts the message typed in LaunchBar to email subject
   set the_subject to message
   
   -- inserts the message typed in LaunchBar to the email body
   -- and adds a greeting at the end like i.g. "Best Regards, ..."
   set the_body to message & "\n\n" & "Best Regards, ..."
   
   tell application "Mail"
      set new_message to make new outgoing message with properties {visible:false, subject:the_subject, content:the_body}
      set MessageFont to message font
      set MessageFontSize to message font size
      tell new_message
         make new to recipient at end of to recipients with properties {address:the_address}
         set font of content to MessageFont
         set size of content to MessageFontSize
      end tell
      send new_message
   end tell
   
end handle_string
Last edited by ptujec on Tue Feb 17, 2009 5:03 pm, edited 1 time in total.

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Thu Feb 12, 2009 1:32 am

Why not just select an email address in LaunchBar and hit the spacebar? Then enter your message and hit Return.

The workflow is a bit different but seems to be about the same amount of work, maybe less. And it doesn't require a custom script.

-Dennis

ptujec
Wizard
Wizard
Posts: 321
Joined: Fri Dec 19, 2008 11:36 am
Contact:

Post by ptujec » Thu Feb 12, 2009 3:36 pm

Dennis wrote:Why not just select an email address in LaunchBar and hit the spacebar? Then enter your message and hit Return.

The workflow is a bit different but seems to be about the same amount of work, maybe less. And it doesn't require a custom script.

-Dennis


For me thats not the same, because the thing you mention does not run in the background. The standard action opens Mail and you have to insert a subject bevor sending it. Thats not what I want for a quick note.

I liked this better in QuickSilver ... Just read on twitter that this keept s.o. from using LB http://is.gd/jhDt

Post Reply