TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Eric Anderson
from: David Johnson
date: 1994-10-28 13:19:00
subject: Rexx, Sbpro, Modem 1/ 4

EA> Does anyone here know how to (in REXX) have a program monitor a comm
port for a
EA> specific signal? example: detect the CONNECT 19200 signal, and perform an
EA> opperation if and only if that is detected.
EA> 
EA> Also, does anyone here know how to play a WAV file from an REXX file?
EA> 
/*-----------------------------------------------------------------------------

address cmd      /* Send commands to OS/2 command processor.  */
signal on error   /* When commands fail, call "error" routine. */
signal on halt    /* When user does a ctrl break               */

trace off
/*trace ?r*/

/* initialize variables */
FILE=''
FROM=''
TO=''
DEV=''
TIMEFMT=''

/* Setup keyword string array */
kwd.0 = 5
kwd.1 = 'FILE'
kwd.2 = 'DEV'
kwd.3 = 'TO'
kwd.4 = 'FROM'
kwd.5 = 'TIMEFMT'

/* Clear out argx variables */
do i = 1 to 5
  junk = value('arg'i,'')
end

arg inline                      /* Get the command line parms */
if (inline='' | inline='?') then
   do
     call Help
     exit 0
   end

/*
 * Check for each keyword
 * If "FILE" is found, look for quotes which signify possible embedded
 *   blanks.
 * Set argx (x is 1 to 5) to the entire keyword string, which ends in
 *   either a blank or a quote.
 */
do i = 1 to kwd.0

  kwdpos = pos(kwd.i, inline)   /* Position of matching keyword */
  if kwdpos > 0  then           /* Found a keyword */
  do

    if kwd.i = 'FILE' then      /* Check for quote after FILE= */
    do
      endchar = substr(inline, kwdpos+length(kwd.i)+1,1)
      if endchar  '"' then endchar = ' '
    end

    else  endchar = ' '         /* Not FILE=, use blank as delimiter */

    /*  Find delimiter (either next quote or blank) */
    fnend = pos(endchar, inline, kwdpos+length(kwd.i)+2)
    if fnend = 0 then           /* Ending quote/blank not found */
    do
      if endchar = '"' then
        say 'Missing ending quote mark for' kwd.i 'keyword'
      fnend = length(inline)    /* Assume it's just end of line */
    end

    /* Set argx to the keyword=data */
    junk = value('arg'i, substr(inline, kwdpos, fnend-kwdpos+1))

  end                           /* End if a keyword was found */

end                             /* End do i = 1 to num of keywords */

/* display values of the argx variables */
/* do i = 1 to 5
    say 'arg'i 'is' value('arg'i)
   end        */

parse var arg1 arg1a'='arg1b
parse var arg2 arg2a'='arg2b
parse var arg3 arg3a'='arg3b
parse var arg4 arg4a'='arg4b
parse var arg5 arg5a'='arg5b



 Continued in next message.

 * With foxes we must play the fox.
---
 * RoseReader 2.50* P004198 Entered at [PROGRAMMERS GLD]

--- QScan v1.067b

* Origin: Programmer's Guild BBS, Hamilton, Ont. (1:244/317)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 244/317 300 99 12/12 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.