home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: OtherApp
/
OtherApp.zip
/
cm17ce.zip
/
fcinst.EXE
/
cmda1on.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
2000-01-18
|
3KB
|
94 lines
/* CMDA1ON.CMD - X10 Command Control from the OS/2 Desktop */
/*
This is an example to show how to access the CM17A Comm Engine functions.
This program connects to the Comm Engine pipe, turns on a module and exits.
You can change the X10 commands below to any house, device or function code
and rename this script accordingly. Consult the Comm Engine documentation
for details on X10 command structure.
Written by: Lone Peak Automation, LLC
Date: Jan. 15, 2000
This program requires the CM17A Comm Engine.
See http://home.att.net/~ASchw for more information.
Important: The CM17A Comm Engine must be running and be connected
to the X10 FireCracker before using this script.
*/
/* Load the REXXUTIL.DLL */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
/* Load CM17A Comm Engine Functions */
call RxFuncAdd 'X10FLLoadFuncs', 'X10FLDLL', 'X10FLLoadFuncs'
call X10FLLoadFuncs
/* Unremark pipename below for your Comm Engine */
pipename = '\PIPE\CM17ACE' /* pipe for CM17A Comm Engine */
/*
/* if using over network, replace CLIENT527 with your own computer's name */
pipename = '\\CLIENT527\PIPE\CM17ACE'
*/
piperr = MakePipe( pipename ) /* open control pipe */
IF piperr = 1 then
EXIT
/*
Edit your X10 command here. Refer to Comm Engine documentation for valid commands.
Some valid commands are: A12 ON, B1 OFF, E10 DIM 30, M5 BRI 25
*/
temp = '}ID1 A1 ON' /* X10 House, Device and Function code */
rc = FCLWritePipe(temp) /* write command to Comm Engine */
CALL SysSleep 2 /* Delay of 2 seconds to wait for command execution */
rc = FCLReadPipe('0') /* read confirmation */
/* next line can be remarked out for troubleshooting */
/* SAY 'reading from pipe >' || rc || '<' */
/*
Close pipe to free up Comm Engine.
If pipe is not closed and the command line window
remains open, then the Comm Engine stays tied up.
Closing of command line window will also close the
pipe automatically.
*/
rc = FCLClosePipe('0')
call X10FLDropFuncs
EXIT
/* Open control pipe */
MakePipe: PROCEDURE
ARG pipename
piperr = 1
rc = FCLOpenPipe(pipename)
IF rc = 0 then
DO
rc = FCLPeekPipe('0')
IF Right(rc, 1) = 3 then
DO
SAY pipename || ' connected'
piperr = 0
END
else
DO
SAY pipename || ' unavailable, close'
rc = FCLClosePipe('0')
END
END
ELSE
DO
SAY pipename || ' not available'
rc = FCLClosePipe('0')
END
RETURN piperr