home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: OtherApp
/
OtherApp.zip
/
cm17ce.zip
/
fcinst.EXE
/
client.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
2000-01-18
|
4KB
|
175 lines
/* CLIENT.CMD - Interactive REXX script for CM17A Comm Engine */
/*
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.
This is an example to show how to access the CM17A Comm Engine functions.
*/
/* Load CM17A Comm Engine Functions */
call RxFuncAdd 'X10FLLoadFuncs', 'X10FLDLL', 'X10FLLoadFuncs'
call X10FLLoadFuncs
/* Load the REXXUTIL.DLL */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
pipename = '\PIPE\CM17ACE'
/* Note: If running over a network, precede the pipe name with the computer name as shown below. */
/* pipename = '\\CLIENT527\PIPE\CM17ACE' */ /* note the _two_ backslashes preceding the computer name */
SAY pipename
rc = FCLOpenPipe(pipename)
Say 'PipeOpen = ' || rc
IF rc = 0 then
DO
rc = FCLPeekPipe('0')
Say 'PipePeek ' || rc
IF Right(rc, 1) = 3 then
SAY 'pipe connected'
else
DO
SAY 'pipe unavailable, close'
rc = FCLClosePipe('0')
Say 'PipeClose ' || rc
END
END
ELSE
DO
SAY 'pipe not available'
rc = FCLClosePipe('0')
Say 'PipeClose ' || rc
END
keyhit = ''
DO FOREVER
SAY "Press R to read; W to write, P to peek, O to Open, S to cloSe,"
SAY "Press C to connect; D to disconnect, Zx for COMx port, U to unload,"
SAY "M for status,"
SAY "+ to Show, - to Minimize,"
SAY "ID1 HCDC ON/OFF/DIM/BRI for direct commands,"
SAY "H for help, X to Exit"
PARSE PULL keyhit
SELECT
WHEN keyhit = 'x' then
LEAVE
WHEN keyhit = 'h' then
DO
SAY 'PipePeek status: '
SAY ' 1: the pipe is disconnected;'
SAY ' 2: the pipe is listening for a connection;'
SAY ' 3: the pipe is connected;'
SAY ' 4: the pipe is closing.'
END
when POS('z', keyhit) = 1 | POS('Z', keyhit) = 1 then /* COMx */
do
PortNum = Substr(keyhit, 2, 1)
temp = '}SETPORTCOM' || PortNum
rc = FCLWritePipe(temp)
keyhit = ""
end
when keyhit = "c" | keyhit = "C" then /* connect */
do
temp = '}CONNECT'
rc = FCLWritePipe(temp)
keyhit = ""
end
when keyhit = "d" | keyhit = "D" then /* disconnect */
do
temp = '}DISCONNECT'
rc = FCLWritePipe(temp)
keyhit = ""
end
when keyhit = "u" | keyhit = "U" then /* unload */
do
temp = '}CLOSE'
rc = FCLWritePipe(temp)
keyhit = ""
end
when keyhit = "m" | keyhit = "M" then /* status */
do
temp = '}STATUS'
rc = FCLWritePipe(temp)
keyhit = ""
call SysSleep(2) /* wait two seconds */
rc = FCLReadPipe('0')
SAY 'Status = >' || rc || '<'
end
when keyhit = "+" then /* restore */
do
temp = '}SHOW'
rc = FCLWritePipe(temp)
keyhit = ""
end
when keyhit = "-" THEN /* min */
do
temp = '}MINIMIZE'
rc = FCLWritePipe(temp)
keyhit = ""
end
when POS('ID1', TRANSLATE(keyhit)) = 1 then /* direct cmd */
do
temp = '}' || keyhit
rc = FCLWritePipe(temp)
keyhit = ""
end
WHEN keyhit = 'p' then
DO
rc = FCLPeekPipe('0')
Say 'PipePeek ' || rc
END
WHEN keyhit = 'r' then
DO
rc = FCLReadPipe('0')
SAY 'reading from pipe >' || rc || '<'
END
WHEN keyhit = 'w' then
DO
rc = FCLWritePipe('}ID1 A1 ON')
SAY 'writing to pipe ' || rc
END
WHEN keyhit = 's' then
DO
rc = FCLClosePipe('0')
Say 'PipeClose ' || rc
END
WHEN keyhit = 'o' then
DO
rc = FCLOpenPipe(pipename)
Say 'PipeOpen = ' || rc
END
OTHERWISE
NOP
END
END
rc = FCLClosePipe('0')
call X10FLDropFuncs
EXIT