Thanks all for the reply - here's the gist of it.
I want to use AHP Smart Macro to run my logger script, named "logger.bat". In order to get the logger output the right information, I want to use a Smart Macro to run the following:
logger.bat DOOR FRONT OPEN
then capture the three command line variables and output it to a CSV file. The goal is to have a log that looks something like this:
DATE,TIME,TYPE,LOCATION,ACTION,DESCRIPTION
2011-01-03,10:05:36,DOOR,FRONT,OPEN,Front Door was opened.
2011-01-03,10:05:41,DOOR,FRONT,CLOSE,Front Door was closed.
Hoewever, AHP does not run the command if I give it the command line paramters, and it will not allow me to put " in the field.
Here is the modified fle that has to be run per command (in other words, I need one batch file per action I want to log - GOD AWFUL.
@echo off
:: ###########################################################################
:: X10 Command Logger
::
:: Purpose: To give the basic ability for ActiveHome to
:: log events seen in macros, etc to a CSV file
:: that can later be reviewed, edited, audited, etc
::
:: Example Use Case: Log when doors are opened, etc
::
::
:: ###########################################################################
set TYPE=GARAGE DOOR
set LOCATION=BOB
set DESCRIPTION=Bob's garage door was opened
set ACTION=OPEN
set LOGDIR=D:\\logs\\
set LOGFILE=%LOGDIR%\\home.log
set CURDATE=%date:~10,4%-%date:~4,2%-%date:~7,2%
set CURTIME=%time:~0,8%
:: ###########################################################################
:: See if the log file exists, and if not, create it and populate the headings
:: ###########################################################################
if not exist %LOGFILE% (
echo DATE,TIME,TYPE,LOCATION,ACTION,DESCRIPTION > %LOGFILE%
)
echo %CURDATE%,%CURTIME%,%TYPE%,%LOCATION%,%ACTION%,%DESCRIPTION% >> %LOGFILE%
Just realized this as I was typing, but if the script is called from a ,location that is present in the PATH variable, I wonder if it will let me do it then?
Bob