Page 1 of 1

Use AppleScript to send notification

PostPosted: 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

Re: Use AppleScript to send notification

PostPosted: 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

Re: Use AppleScript to send notification

PostPosted: 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?