;ASPECT script for Procomm PLUS Version 2 to log on to Telenet at 1200 baud
;on local line and go to PHONES for information.  Change the define below
;to show YOUR local Telenet number (which may require a change to 2400 baud
;below).  If you do not know your local Telenet number, phone (800)835-3638
;and ask them.  This file uses modified Translation Table download PCPLUS.XLT
;from Lib 3 if you don't want to modify yours.
;
DEFINE PHONE "242-8247"              ;define telenet phone number
DEFINE SERVICE "MAIL"                ;service desired
DEFINE NAME "PHONES"                 ;define telenet name
DEFINE PASSWORD "PHONES"             ;define telenet password
;
PROC MAIN                            ;label of main procedure
  LOG CLOSE                          ;close log in case it was open
  SET ATIME 1                        ;set alarm time 1 second
  SET DISPLAY ON                     ;turn on display of line characters
  SET ENQ OFF                        ;set enq to avoid download on login
  SET REMOTECMD OFF                  ;prohibit external control using ansi
  SET SOUND ON                       ;set sound on for alarm
  SET TRANSLATE ON                   ;set translation table to strip 8th
  IF NOT FROMDDIR                    ;if not linked to dialing directory
    EMULATE ANSI                     ;set emulation
    SET BAUDRATE 1200                ;set baudrate
    SET DATABITS 8                   ;set databits
    SET DUPLEX FULL                  ;set full duplex mode
    SET PARITY NONE                  ;set parity
    SET STOPBITS 1                   ;set stopbits
    LOCATE 0 0                       ;locate the cursor
    BOX 1 16 4 63 14                 ;draw a box
    ATSAY 2 18 14 "Calling Telenet on local line at 1200 8-N-1." ;message
    ATSAY 3 18 14 "   Session will be logged to TELENET.LOG.   " ;message
    LOCATE 6 0                       ;locate the cursor
    MDIAL PHONE "Telenet Phones"     ;dial string phone and message
    IF NOT CONNECTED                 ;if not connected
      HANGUP                         ;hangup
      CALL MAIN                      ;and start over
    ENDIF                            ;end the if case
  ENDIF                              ;end the if case
  PAUSE 1                            ;pause to be sure of carrier
  RFLUSH                             ;flush the buffer
  TRANSMIT "^MD^M"                   ;wake up telenet with [enter] D [enter]
  WAITFOR "TERMINAL="                ;wait for telenet prompt
  PAUSE 1                            ;pause
  TRANSMIT "D1^M"                    ;give type of terminal
  WAITFOR "@"                        ;make sure we got in
  IF NOT WAITFOR                     ;if we didn't get in
    HANGUP                           ;hangup
    IF FROMDDIR                      ;if calling from dialing directory
      EXIT                           ;exit script
    ENDIF                            ;end the if
    CALL MAIN                        ;and start over
  ENDIF                              ;end the if case
  RFLUSH                             ;flush the buffer
  LOG OPEN "TELENET.LOG"             ;open a log every time
  TRANSMIT SERVICE                   ;give connect order service string
  TRANSMIT "^M"                      ;transmit enter
  WAITFOR "name? "                   ;wait for prompt
  PAUSE 1                            ;pause
  TRANSMIT NAME                      ;transmit name string
  TRANSMIT "^M"                      ;transmit enter
  WAITFOR "Password? "               ;wait for prompt
  PAUSE 1                            ;pause
  TRANSMIT PASSWORD                  ;transmit password string
  TRANSMIT "^M"                      ;transmit enter
  WAITFOR "(1-6): " 60               ;wait for prompt
  ALARM                              ;make some noise
  CALL LOGOFF                        ;call proc logoff
ENDPROC                              ;endproc main
;
PROC LOGOFF                          ;label for proc
  WHILE 1                            ;open while
    WAITFOR "DISCONNECTED" FOREVER   ;wait for prompt after exit
    IF WAITFOR                       ;open if
      EXITWHILE                      ;exit while to next command
    ENDIF                            ;end the if
  ENDWHILE                           ;end the while
  WAITFOR "@"                        ;wait for
  LOG CLOSE                          ;close log just in case
  HANGUP                             ;hangup
  QUIT                               ;exit script, quit program
ENDPROC                              ;end the proc logoff
;
