|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
help with Applescript to email device actions?
| Author |
Message |
|
bob
Joined: Jun 14, 2006 Posts: 500
|
 help with Applescript to email device actions?
I have an Applescript that logs device actions into a log file then runs an Applescript from crontab to email a copy of that log. I use it to see if everything actioned on time in the house when I am travelling.
The following Applescript is a start to doing the same thing only logging device actions directly into an email. The problem I have is the email sends after every action and I want to collect actions for a 24 hour period then send the email. I though of saving the email as a draft after each device action, then a new device action would reopen it, log and then save as a draft again. Then at mignight have crontab run an Applescript to send any draft messages. Does anyone have any idea how to keep the email collecting device actions?
on LogDevice(DeviceName)
tell application "Mail"
set theAddress to "someone@someisp.com"
set theSubject to "Device Status List"
set theSender to ""
set theName to ""
tell application "IndigoServer"
set theCurrentDate to (current date) as string
set UnitDisc to description of device DeviceName
set UnitType to model of device DeviceName
set unitstate to on state of device DeviceName
set UnitAdd to address of device DeviceName
if unitstate is true then
set unitstate to "ON"
else
set unitstate to "OFF"
end if
set theBody to theCurrentDate & ", " & DeviceName & ", " & UnitDisc & ", " & UnitType & ", " & UnitAdd & ", " & unitstate
end tell
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set sender to theSender
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
end tell
send newMessage
end tell
end LogDevice
|
| Mon May 14, 2007 3:01 pm |
|
 |
|
Bert Rozenberg
Joined: May 11, 2007 Posts: 11
|
 Re: help with Applescript to email device actions?
bob wrote:Does anyone have any idea how to keep the email collecting device actions?
Just leave out the 'send newMessage'
Bert
|
| Mon May 14, 2007 4:11 pm |
|
 |
|
bob
Joined: Jun 14, 2006 Posts: 500
|
 Re: help with Applescript to email device actions?
Thanks for your suggestion but leaving out the Send newMessage doesn't solve the problem.
|
| Tue May 15, 2007 3:16 am |
|
 |
|
Matt
Joined: Aug 13, 2006 Posts: 390 Location: Northern Idaho
|
Make a time/date action in indigo to execute an automator application that finds the newest log file in the Indigo 2 folder and emails it to you at a specified time.
|
| Fri May 18, 2007 9:13 pm |
|
 |
|
Bert Rozenberg
Joined: May 11, 2007 Posts: 11
|
 Re: help with Applescript to email device actions?
bob wrote:Thanks for your suggestion but leaving out the Send newMessage doesn't solve the problem.
It does if you use "save" (or "save newMessage") instead.
|
| Sun May 20, 2007 2:45 am |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|