home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 5.9 / 2000-06_-_Disc_5.9_Imperfect.iso / ELINK / Config / eln950a.cab / PPPMENU.SCP < prev    next >
Text File  |  1995-12-31  |  3KB  |  137 lines

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