home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09964.iso / patches / DSCRPT.EXE / SLIP.SCP < prev    next >
Text File  |  1995-12-31  |  2KB  |  120 lines

  1. ;
  2. ; This is a script file that demonstrates how
  3. ; to establish a slip connection with a host.
  4. ;
  5. ; A script file must have a 'main' procedure.
  6. ; All script execution starts with this 'main'
  7. ; procedure.
  8. ;
  9.  
  10.  
  11. ; Main entry point to script
  12. ;
  13. proc main
  14.  
  15.    ; Change these variables to customize for your
  16.    ; specific Internet service provider.
  17.  
  18.    integer nTries = 3
  19.  
  20.    ; This is the login prompt and timeout values
  21.  
  22.    string szLogin = "Userid:"
  23.    integer nLoginTimeout = 3
  24.  
  25.    ; This is the password prompt and timeout values
  26.  
  27.    string szPW = "Password?"
  28.    integer nPWTimeout = 3
  29.  
  30.    ; This is the prompt once your password is verified
  31.  
  32.    string szPrompt = "InternetLR/E>"
  33.  
  34.    ; This is the command to send to establish the 
  35.    ; connection.  This script assumes you only need
  36.    ; to issue one command to continue.  Feel free
  37.    ; to add more commands if your provider requires
  38.    ; it.
  39.  
  40.    string szConnect = "slip^M"
  41.  
  42.    ; Set this to FALSE if you don't want to get an IP
  43.    ; address
  44.  
  45.    boolean bUseSlip = TRUE
  46.  
  47.  
  48.    ; Delay for 2 seconds first to make sure the
  49.    ; host doesn't get confused when we send the
  50.    ; two carriage-returns.
  51.  
  52.    delay 2
  53.    transmit "^M^M"
  54.  
  55.    ; Attempt to login at most 'nTries' times
  56.  
  57.    while 0 < nTries do
  58.  
  59.       ; Wait for the login prompt before entering
  60.       ; the user ID, timeout after x seconds
  61.  
  62.       waitfor szLogin then DoLogin 
  63.         until nLoginTimeout
  64.  
  65. TryAgain:
  66.       transmit "^M"        ; ping
  67.       nTries = nTries - 1
  68.  
  69.    endwhile
  70.  
  71.    goto BailOut
  72.  
  73. DoLogin:
  74.    ; Enter user ID
  75.  
  76.    transmit $USERID, raw
  77.    transmit "^M"
  78.  
  79.    ; Wait for the password prompt 
  80.  
  81.    waitfor szPW until nPWTimeout
  82.    if FALSE == $SUCCESS then
  83.       goto TryAgain
  84.    endif
  85.  
  86.    ; Send the password
  87.  
  88.    transmit $PASSWORD, raw
  89.    transmit "^M"
  90.  
  91.    ; Wait for the prompt
  92.  
  93.    waitfor szPrompt
  94.  
  95.    transmit szConnect
  96.  
  97.    if bUseSlip then
  98.       ; An alternative to the following line is
  99.       ;
  100.       ;     waitfor "Your address is "
  101.       ;     set ipaddr getip
  102.       ;
  103.       ; if we don't know the order of the IP addresses.
  104.  
  105.       set ipaddr getip 2
  106.    endif
  107.  
  108.    goto Done
  109.  
  110. BailOut:
  111.    ; Something isn't responding.  Halt the script
  112.    ; and let the user handle it manually.
  113.  
  114.    set screen keyboard on
  115.    halt
  116.  
  117. Done:
  118.  
  119. endproc
  120.