XTensionlist Digest, Vol 3, Issue 283

Jack Barse jblists at barse.org
Sat Nov 18 09:12:21 PST 2006


On Nov 17, 2006, at 3:10 PM, James wrote:

> I am using BlueElite to monitor my cell phone presence
> as a way to indicate to Xtension when I am in the
> house. I currently have this test script which I am
> using to send me an email when I come and go. This is
> the script for arriving home.
>
> set time_now to (time string of (current date))
>
> set curr_subject to "\"James got home @ " & time_now &
> "\""
> set script_text to "mail -s " & curr_subject & "
> some_email at yahoo.com"
>
> do shell script script_text
> write log "Sending message : " & curr_subject
>
> Does anyone have any insight into why the messages get
> queued up and not sent? It may be realted to my ISP
> but I am wondering if there is some other blackmagic
> going on. I am tempted to buy MondoMail but it seems
> like a waste if all I want to do is send email.

James, is there a reason why you wouldn't just script mail.app,  
rather than use the system 'mail' command? I've got a script that  
sends me an text message via email whenever a given motion detector  
fires and nobody's home. As Rob pointed out, the syntax can be pretty  
arcane but it's pretty useful once you get past that bit. (I can't  
take credit for the underlying script here, and unfortunately I can't  
remember where I found it.)

This is the 'on' script of the motion detector called 'JT Room  
Motion' (with my cell phone's address removed :-) ). It'd be fairly  
straightforward to have the BPE prox detector run a modified version  
of this, I think, as long as mail.app was running on the same machine  
as BPE.

if (status of "Somebody's Home") is false then
  if (time delta of "JT Room Motion") is greater than 60 then
   tell application "Mail"
    set newMessage to make new outgoing message at end of outgoing  
messages
     tell newMessage
      -- set visible to true (*comment out whole line to stop  
'blinking' windows*)
      set content to "There is motion in JT's room at " & time string  
of (current date) & " on " & date string of (current date) & "."
      set subject to "JT Room Motion"
      make new to recipient with properties  
{address:"address at domain.tld"}
    end tell
    send newMessage
   end tell
  end if
end if

HTH,
Jack


More information about the XTensionlist mailing list