' On_Off_Toggle.txt 2000/01/17 Glenn Reimche (control@corpacc.com) ' ' If a device is on then turn it off, else turn it on ' ' Based on the light toggle script, but allows passing of parameters ' so you only need one script for all devices. ' ' includes : ' ' getParms - Fake parameter reading - 11/15/99 Rick LaBanca, ' http://members.home.com/rickla1/ha ' ' Due to no parameter passing by homeseer, here's a hack! ' ' Create an event ' Set the event to run this script ' Under the App/Sound/Email tab, in the mail message: ' Enter one parameter per line as: ' devicecode=A6 ' devicename=Table Lamp ' ' DeviceName is used only for speaking, so anything can be entered here ' ' You need Rick's excellent scripts (ut.zip) to make this work! ' Go to http://www.homeautomationforum.com/downloads/downloads.html ' Then again, how did you get this ? #include ut_readline.txt #include ut_getparms.txt sub main() dim state dim devicecode dim devicename dim vars ' Ricks's stuff to get the paramaetrs from the email message set vars = CreateObject("Scripting.Dictionary") getParms(vars) devicecode = vars("devicecode") devicename = vars("devicename") ' Say the device name hs.speak devicename ' Set the new state based on the current state if ah.ison(devicecode) then state = "off" else state = "on" end if ' Say the new state, then set the new state hs.speak state ah.execx10 devicecode,state,0 end sub