You can just put script in /Library/Scripts/iChat/ and use it in iChat > Preferences > Alerts > Event: Message Received. I use separate IM account and leave it running 24/7 on machine running Indigo.
Ideas:
- get device's status
- ???
Enjoy!
- Code: Select all
using terms from application "iChat"
-- handler to respond to all incoming messages.
on runIndigoRemoteControl(theMessage)
set theResponse to "Unknown command."
try
if theMessage is "flash" then
tell application "IndigoServer"
flash(2)
end tell
set theResponse to "Executing flash"
else if theMessage is "bedtime" then
tell application "IndigoServer"
execute group "scene - bedtime"
end tell
set theResponse to "Executing bedtime scene"
else if theMessage is "tail log" then
tell application "IndigoServer"
set theResponse to build event log list line count 30
end tell
else if theMessage is "help" then
-- display available commands on "help"
set theResponse to "Available Commands: flash, bedtime, tail log, turn on/off [device], toggle [device], dim/brighten [device], all lights on/off, execute group [name], tail log, send email to [emailAddress] [with subject text] [with body text]"
else
tell application "IndigoServer"
set result to (run script theMessage) as string
end tell
if result is "" then
set theResponse to "Executing " & theMessage
else
set theResponse to result
end if
end if
on error errorMessage
set theResponse to errorMessage
end try
return theResponse
end runIndigoRemoteControl
-- When first message is received, accept the invitation and send a greeting message from Indigo Remote Control.
on received text invitation theMessage from theBuddy for theChat
accept theChat
send "Welcome to Indigo Remote Control." to theChat
set theResponse to runIndigoRemoteControl(theMessage)
send theResponse to theChat
end received text invitation
-- On subsequent messages, pass the message directly to Indigo Remote Control.
on message received theMessage from theBuddy for theChat
set theResponse to runIndigoRemoteControl(theMessage)
send theResponse to theChat
end message received
-- Sample, so you can test run this through Script Editor.
display dialog "Send a command to Indigo Remote Control:" default answer "help"
set theMessage to the text returned of the result
set theResponse to runIndigoRemoteControl(theMessage)
display dialog theResponse
end using terms from
ps: borrowed a piece of code from script that came with iChat on Leopard for remote controlling iTunes.