home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / comm / dilscrpt.sit / DialScript_1.5_SIT / DialScript / Examples / cs.ds < prev    next >
Encoding:
Text File  |  1991-08-08  |  2.3 KB  |  79 lines  |  [TEXT/dIsR]

  1. -- UT CS 2400 Baud login script.
  2.  
  3. -- A complicated example.
  4.  
  5. -- To use 1200, remove the "send break". And set speed to 1200
  6.  
  7. -- The script tries to get the modem's attention and dial, even if it has
  8. -- to hang up to do it.  It uses timeouts to recover from problems.
  9. -- Problems after connect are assumed to be due to line noise, so it
  10. -- hangs up and dials again.
  11.  
  12. -- Of course, you need to set the strings for your username and password.
  13.  
  14. script cs
  15.    state init
  16.       set port modem; -- These sets are not needed.
  17.       set speed 2400; -- The values are the defaults.
  18.       set databits 8; -- And better to use settings file
  19.       set stopbits 1;
  20.       set parity none;
  21.       display "Beginning UT CS login script...";
  22.       next ModemReady;
  23.    end; -- init
  24.  
  25.    state ModemReady            -- Be sure we have modem's attention
  26.       send "\r"; send "AT\r";
  27.       select
  28.          "OK"      : next Dial;
  29.          timeout 3 :
  30.       end;
  31.       send "\r"; send "AT\r"; -- try again
  32.       select
  33.          "OK"      : next Dial;
  34.          timeout 3 : next HangUp;  -- failed again, maybe hangup
  35.       end;
  36.    end; -- ModemReady
  37.  
  38.    state HangUp              -- Hang up a Hayes modem
  39.       send ""; send "+++";   -- First send is for a delay
  40.       select
  41.         "OK"      : send "ATH\r"; next ModemReady;
  42.         timeout 3 :
  43.       end;
  44.       send ""; send "+++";  -- try again
  45.       select
  46.          "OK"      : send "ATH\r"; next ModemReady;
  47.          timeout 3 : display "Hangup timeout";
  48.       end;
  49.       send "\r"; send "ATH\r";  -- Maybe we are talking to modem somehow
  50.       next ModemReady;
  51.    end; -- HangUp
  52.  
  53.    state Dial
  54.       send "ATDT4718454\r";     -- The system's phone number
  55.       select
  56.          "CONNECT"      : next GotIt;
  57.          "BUSY"         : next ModemReady;
  58.          "NO CARRIER"   : next ModemReady;
  59.          timeout 22     : display "Dial timeout!"; next ModemReady;
  60.       end; 
  61.    end; -- Dial
  62.  
  63.    state GotIt
  64.       delay 1;
  65.       send break;   -- UNIX host needs a break to switch to 2400 baud
  66.       select 
  67.          "login:"     :
  68.          timeout 60   : display "login timeout!"; next HangUp;
  69.       end;
  70.       send "USERNAME\r";              -- Your username
  71.       select
  72.          "Password:" :
  73.          timeout 60  : display "password timeout!"; next HangUp;
  74.       end;
  75.       send "PASSWORD\r";            -- Your password string
  76.    end; -- GotIt
  77.  
  78. end; -- UTlogin
  79.