Under Windows or OS/2 the MODE command is used to set baud rates etc. (try
mode /? for details). 

Below is an old .rex program I have (I think it works under Windows but
haven't needed to use it for years); it used the mode command.

Mike

- - - - -

/* Simple dialing command -- assumes Hayes modem, in command mode */
/* MFC, 21 November 1990 */
/* Last touched (OS/2 version) 15/10/92 */
arg number options
if number='' then do
  say 'Please specify a number to dial'
  say 'Form is:  DIAL number [options]'
  say 'Where options may be any of:'
  say '  COM1 .. COM9      to select serial port'
  say '  TONE, PULSE       to select dialing mechanism'
  say '  LOUD, QUIET       to control speaker volume'
  say '  WAIT nn           to adjust wait time (1-40 secs)'
  exit 1; end

device='com1'       /* Device (port) to use */
dial='T'            /* Tone or Pulse dial (T/P) */
prefix=''           /* Prefix always added to number */
volume=2            /* Speaker Volume (Low=1, High=3) */
wait=30             /* Seconds to wait for an answer (1-40) */
speed=1200          /* Baud rate for modem */
show=1              /* Set to 1 to see modem commands and responses */
pause=','           /* Pause string before dial */

act=';'             /* remain in command mode after dial */
act='R'             /* revert to answer mode after dial  */
act='@'             /* wait for ringback                 */



/* Loop processing options */
do while options<>''
  parse var options word options
  select
    when word='PULSE' then dial='P'
    when word='TONE'  then dial='T'
    when word='COM1'  then device=word
    when word='COM2'  then device=word
    when word='COM3'  then device=word
    when word='COM4'  then device=word
    when word='COM5'  then device=word
    when word='COM6'  then device=word
    when word='COM7'  then device=word
    when word='COM8'  then device=word
    when word='COM9'  then device=word
    when word='QUIET' then volume=1
    when word='LOUD'  then volume=3
    when word='WAIT'  then do
                           parse var options wait options
                           if \datatype(wait,'W') | wait<1 | wait>40
                            then do
                             say "Invalid WAIT time -- set to 20"
                             wait=20; end
                           end
    when word='SHOW'  then show=1
    otherwise say 'Unknown option "'word'" ignored'
    end
  end

/* Set the mode for talking to the modem */
'@mode' device':'speed',N,8,1,octs=off,dtr=on,rts=on >nul'

call modem 'Z'                          /* reset the modem */
-- call modem 'E0'                         /* don't echo commands */
call modem 'E1'                         /* do echo commands */
call modem 'L'volume                    /* set speaker volume */
call modem 'S7='wait                    /* wait time for answer */
call modem 'M2'                         /* speaker on after connect */
call modem 'V1'                         /* verbose (english) RCs */

say 'Dialing' number'...'
say 'Pick up phone when dialing ends; use Ctrl-Break to quit'
call modem 'D'dial||pause||prefix||number||act  /* dial */

exit

/* Issue an "AT" command to a modem; returns response */
modem: procedure expose device show
signal on halt
command='AT'arg(1)                      /* build modem command */
if show then say '>>' command

--trace r

call stream device,'c','open'           /* ensure clean state */
if stream(device, 's')\='READY' then do
 say 'Cannot open dial device "'device'"'
 exit; end

call lineout device, command            /* do the command */
trace o
do until left(response,1)>'A'           /* wait for good response */
  /* Next line (delay) only needed on AT/1.1 */
  /* do 1000; i=1; end */
  response=linein(device)               /* get any response */
  end
if show then say '<<' response
return response


halt: exit   /* Quiet exit if CTRL-Break while modeming */


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to