;This is a Version 2.0 script that calls the CompuServe 800 number to get
;a list of the CompuServe phones for the area code of the number you enter
;in response to a prompt, logs this information (put in your own logfile
;pathname below in place of mine) and then logs off.  Provisions are made for
;the script to be called by a dialing directory entry or by name (Alt-F5).
;
PROC MAIN                        ;open and name the procedure
  SET TRANSLATE ON               ;because my defaults are set to 8N1, I must
                                 ;turn on the modified (128-256 changed to
                                 ;0-127) Translation Table
  LOG CLOSE                      ;in case it was open
  IF NOT FROMDDIR                ;if this is not being done from the dial dir
    ASSIGN S0 "18003463247"      ;assign the phone number to S0
    IF CONNECTED                 ;if connected when this script is called
      HANGUP                     ;hangup, or it won't work
      CALL MAIN                  ;and now call the script again
    ENDIF                        ;end the if connected
    EMULATE ANSI                 ;set this (dial dir does it too)
    MDIAL S0 "CIS Access Phones" ;still, if not from dial dir, dial the S0
    IF NOT CONNECTED             ;if we don't connect
      HANGUP                     ;hangup and
      PAUSE 5                    ;pause, and
      CALL MAIN                  ;start again
    ENDIF                        ;end the if not connected
  ENDIF                          ;end the if not from dial directory
  RFLUSH                         ;flush any chars in the buffer
  PAUSE 1                        ;pause
  TRANSMIT "^M"                  ;and then send an enter to get things going
  WAITFOR "Host Name:"           ;wait for the prompt
  RFLUSH                         ;flush the receive buffer, and
  LOG OPEN "C:\WORKING\CISPHONE.LOG" ;open a log file (YOUR PATHNAME HERE!)
  TRANSMIT "PHONES^M"            ;answer the prompt
  WHEN 0 "Press <CR> for more !" TRANSMIT "^M" ;if there is ever a prompt
                                 ;like this, send an enter
  WAITFOR "Enter choice !"       ;wait for prompt
  RFLUSH                         ;flush the buffer
  PAUSE 1                        ;pause
  TRANSMIT "1^M"                 ;and answer the prompt
  ALARM                          ;wake up operator so he can answer prompts
  WAITFOR "Last page !" 480      ;for 4 minutes wait for session end prompt
  CWHEN 0                        ;close the when ...for more!
  LOG CLOSE                      ;close the log
  HANGUP                         ;hangup the phone line
  EXIT                           ;exit the script leaving screen untouched
ENDPROC                          ;end the procedure