home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / SYSOP / WINSOCKR.ZIP / LOGIN.CMD < prev    next >
OS/2 REXX Batch file  |  1994-10-21  |  2KB  |  115 lines

  1. #trace on
  2. #
  3. # set up some strings for dialling up
  4. #
  5. if ![load $number]
  6.   if [query $number "Enter your dial up phone number"]
  7.     save $number
  8.   end
  9. end
  10. if ![load $username]
  11.   if [username "Enter your login username"]
  12.     save $username
  13.   end
  14. end
  15. if ![load $password]
  16.   if [password "Enter your login password"]
  17.     save $password
  18.   end
  19. end
  20. $modemsetup = "&c1&k3"
  21. $prompt = ">"
  22. $userprompt = "sername:"
  23. $passprompt = "assword:"
  24. $slipcmd = "slip"
  25. $addrtarg = "Your address is"
  26. $pppcmd = "ppp"
  27.  
  28. %attempts = 10
  29. #
  30. #
  31. #----------------------------------------------------------
  32. #
  33. # initialize modem
  34. #
  35. output "atz"\13
  36. if ! [input 10 OK\n]
  37.   display "Modem is not responding"\n
  38.   abort
  39. end
  40. #
  41. # setup our modem commands
  42. #
  43. output "at"$modemsetup\13
  44. input 10 OK\n
  45. #
  46. # send phone number
  47. #
  48. %n = 0
  49. repeat
  50.   if %n = %attempts
  51.     display "Too many dial attempts"\n
  52.     abort
  53.   end
  54.   output "atdt"$number\13
  55.   %ok = [input 60 CONNECT]
  56.   %n = %n + 1
  57. until %ok
  58. input 10 \n
  59. #
  60. #  wait till it's safe to send because some modem's hang up
  61. #  if you transmit during the connection phase
  62. #
  63. wait 30 dcd
  64. #
  65. # now prod the terminal server
  66. #
  67. output \13
  68. #
  69. #  wait for the username prompt
  70. #
  71. input 30 $userprompt
  72. output $username\13
  73. #
  74. # and the password
  75. #
  76. input 30 $passprompt
  77. output $password\13
  78. #
  79. # we are now logged in
  80. #
  81. input 30 $prompt
  82. if %ppp
  83.   #
  84.   # jump into ppp mode
  85.   #
  86.   output $pppcmd\13
  87.   #
  88.   input 30 \n
  89.   #
  90.   display "PPP mode selected.  Will try to negotiate IP address."\n
  91.   #
  92. else
  93.   #
  94.   # jump into slip mode
  95.   #
  96.   output $slipcmd\13
  97.   #
  98.   # wait for the address string
  99.   #
  100.   input 30 $addrtarg
  101.   #
  102.   # parse address
  103.   #
  104.   address 30
  105.   input 30 \n
  106.   #
  107.   # we are now connected, logged in and in slip mode.
  108.   #
  109.   display \n
  110.   display Connected.  Your IP address is \i.\n
  111. end
  112. #
  113. # now we are finished.
  114. #
  115.