;
; This is a script file that demonstrates how
; to establish a slip connection with a host.
;
; A script file must have a 'main' procedure.
; All script execution starts with this 'main'
; procedure.
;


; Main entry point to script
;
proc main

   ; Change these variables to customize for your
   ; specific Internet service provider.

   integer nTries = 3

   ; This is the login prompt and timeout values

   string szLogin = "Login:"
   integer nLoginTimeout = 3

   ; This is the password prompt and timeout values

   string szPW = "Password:"
   integer nPWTimeout = 3

   ; This is the prompt once your password is verified

   string szPrompt = ":~$"

   ; This is the command to send to establish the 
   ; connection.  This script assumes you only need
   ; to issue one command to continue.  Feel free
   ; to add more commands if your provider requires
   ; it.

   string szConnect = "pppd^M"

   ; Set this to FALSE if you don't want to get an IP
   ; address

   boolean bUseSlip = TRUE


   ; Delay for 2 seconds first to make sure the
   ; host doesn't get confused when we send the
   ; two carriage-returns.

   delay 2
   transmit "^M^M"

   ; Attempt to login at most 'nTries' times

   while 0 < nTries do

      ; Wait for the login prompt before entering
      ; the user ID, timeout after x seconds

      waitfor szLogin then DoLogin 
        until nLoginTimeout

TryAgain:
      transmit "^M"        ; ping
      nTries = nTries - 1

   endwhile


DoLogin:
   ; Enter user ID

   ;transmit $USERID, raw
   transmit "aoml", raw
   transmit "^M"

   ; Wait for the password prompt 

   waitfor szPW until nPWTimeout
   if FALSE == $SUCCESS then
      goto TryAgain
   endif

   ; Send the password

   ;transmit $PASSWORD, raw
   transmit "aoml", raw
   transmit "^M"

   ; Wait for the prompt

   waitfor szPrompt

   transmit szConnect
   goto Done


Done:

endproc
