Use AppleScript to send notification

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Use AppleScript to send notification Fri Oct 28, 2011 7:10 am • by smithjw
Ok, so I'm getting stuck using an embedded AppleScript to send an email via Sparrow in the background. I've got this so far

Code: Select all
tell application "Sparrow"
   set newNotification to make new outgoing message with properties {subject:"New Episode Downloaded", content:"Hello Christina,
   I've takent the liberty of downloading theFile for you. Enjoy"}
   tell newNotification
      make new to recipient at end of to recipients with properties {address:"smithjw@me.com"}
   end tell
   sendmessage newNotification
end tell

The email sends perfectly but I would like "theFile" to display the filename of what Hazel passes to it. Hope someone can help :). Really need to brush up on my AppleScript
DJ, Video Editor, & All round geek
smithjw
 
Posts: 9
Joined: Wed Jun 09, 2010 7:06 pm
Location: Melbourne, Australia

Re: Use AppleScript to send notification Thu Dec 08, 2011 1:51 pm • by a_freyer
You're sending the variable "theFile" as a string. I don't have sparrow to test, but this should work:

Code: Select all
tell application "Sparrow"
   set newNotification to make new outgoing message with properties {subject:"New Episode Downloaded", content:"Hello Christina,
   I've takent the liberty of downloading " & theFile & " for you. Enjoy"}
   tell newNotification
      make new to recipient at end of to recipients with properties {address:"smithjw@me.com"}
   end tell
   sendmessage newNotification
end tell
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Use AppleScript to send notification Thu Dec 08, 2011 5:51 pm • by smithjw
Cheers Andrew! Sad to see that Airport Location isn't supported on Lion but it was awesome while it lasted :). By the way, what happend to your website?
DJ, Video Editor, & All round geek
smithjw
 
Posts: 9
Joined: Wed Jun 09, 2010 7:06 pm
Location: Melbourne, Australia


Return to Open Discussion