home *** CD-ROM | disk | FTP | other *** search
/ IBM Thinkpad Drivers FTP / MSMMWAVE.EXE / MWAVE.MDM next >
Text File  |  1995-03-02  |  7KB  |  302 lines

  1. ;**************************************************************************
  2. ;
  3. ;                    Microsoft Mail Script File
  4. ;
  5. ;       Filename: mwave.mdm
  6. ;       Date    : March 2, 1995
  7. ;       Script  : Script file for IBM MWAVE Modem
  8. ;       Version : V1.1
  9. ;
  10. ;     This script file contains the standard modem setup strings used by
  11. ;  the External, Transmit and Listen programs.  There are five procedures
  12. ;  defined in this script file for setting up the modem and for connecting
  13. ;  to a remote External machine.
  14. ;
  15. ;     The modem setup strings used here will be adequate for most people
  16. ;  but there may be some changes required if you are dialing overseas and
  17. ;  require a longer wait for Carrier Detect (S7 register) or if you wish
  18. ;  to change the speaker volume.  Note that if you used the -Innn option 
  19. ;  in version 1.0 or 2.0 that you will have to modify the S7 register and
  20. ;  recompile this script file.
  21. ;
  22. ;     Consult your modem manual for more information on setup options.
  23. ;
  24. ;  Script procedures defined:
  25. ;       INITIALIZE
  26. ;       RESET
  27. ;       CALL
  28. ;       ANSWER
  29. ;       DISCONNECT
  30. ;
  31. ;  Return codes for External, Transmit, Listen:
  32. ;       0  - OK
  33. ;       1  - CONNECT 300
  34. ;       2  - not defined
  35. ;       3  - NO CARRIER
  36. ;       4  - ERROR
  37. ;       5  - CONNECT 1200
  38. ;       6  - not defined
  39. ;       7  - BUSY
  40. ;       8  - NO ANSWER
  41. ;       9  - not defined
  42. ;      10  - CONNECT 2400
  43. ;      11  - not defined
  44. ;      12  - CONNECT 9600 (high speed connection)
  45. ;
  46. ;  Note: This script was written by a customer using the IBM Thinkpad
  47. ;        755CD with the MWave modem. It is unsupported by Microsoft.
  48. ;
  49. ;**************************************************************************
  50.  
  51.  
  52. INITIALIZE:
  53.     title "MWAVE 9600"
  54.  
  55.     baud 9600              ; set the baud rate
  56.     display "   Baud Rate : 9600"
  57.     return 0
  58.  
  59. RESET:
  60.     baud 9600              ; set the baud rate
  61.     display "   Baud Rate : 9600"
  62.  
  63.     clearrsp               ; clear out any ring signals
  64.     sendln "AT&F"           ; reset modem to default settings
  65.     wait 3
  66.     waitrsp 3
  67.  
  68.     if (response = "0^M")
  69.          return 0
  70.     else
  71.          return 4
  72.  
  73.  
  74.  
  75. CALL:
  76.     $attempts = 5
  77.  
  78. init_retry:
  79.     sendln "AT&F"           ; reset modem to default settings
  80.     wait 2
  81.     waitrsp 1
  82.  
  83.     if ("0" isin response)
  84.         goto reset_okay
  85.  
  86.     if ("OK" isin response)
  87.         {
  88. reset_okay:
  89.         sendln "ATE0L0M1V0X4&C1&D1&N0&U1\\Q3%C0%E0\\N0"
  90.         wait 3
  91.         waitrsp 4
  92.  
  93.         if ("0^M" isin response)
  94.         {
  95.         sendln 'AT"H0'
  96.         wait 5
  97.         waitrsp 5
  98.         clearrsp
  99.         sendln "ATS0=0S7=60S9=6S10=50S12=50S28=12"
  100.         wait 4
  101.         waitrsp 3
  102.         if (response = "0^M")
  103.              goto do_call
  104.            
  105.         }
  106.          }
  107.     dec $attempts
  108.     if ($attempts > 0)
  109.         goto init_retry
  110.  
  111.     return 4
  112.  
  113.  
  114.  
  115. do_call:        
  116.     $ret = 8               ; set default ret code to "no answer"
  117.  
  118.     waitrsp 2              ; clear the response buffer 
  119.     
  120.     if (response = "2^M")        
  121.     {
  122.     display ">>>Incoming Call - Abord Send<<<"
  123.     return $ret
  124.     }
  125.     clearrsp
  126.  
  127.     display "JUST ABOUT TO SEND ATD STRING"
  128.     echo 0                 ; do not display phone number
  129.  
  130.     sendln "ATD" + dial_mode + phone_number  ; execute the dial up 
  131.  
  132.     clearrsp
  133.     
  134.     wait 2
  135.     waitrsp 4
  136.     
  137.     echo 1                 ; turn echo back on
  138.     
  139.     display "EVERYTHING IS SET; WAITING FOR RESULT"
  140.     
  141.  
  142.     waitrsp 120            ; wait until the modem responds (max 2 minutes)
  143.  
  144.     if (response = "1^M")
  145.       {
  146.       display ">>> CONNECT 300 <<<"
  147.       $ret = 1
  148.       }
  149.     else if (response = "3^M")
  150.       {
  151.       display ">>> NO CARRIER <<<"
  152.       $ret = 8             ; no answer or no connect
  153.       }
  154.     else if (response = "5^M")
  155.       {
  156.       display ">>> CONNECT 1200 <<<"
  157.       $ret = 5
  158.       }
  159.     else if (response = "7^M")
  160.       {
  161.       display ">>> BUSY <<<"
  162.       $ret = 7             ; busy
  163.       }
  164.     else if ("10^M" isin response)
  165.       {
  166.       display ">>> CONNECT 2400 <<<"
  167.       $ret = 10
  168.       }
  169.     else if (response = "11^M")
  170.       {
  171.       display ">>> CONNECT 4800 <<<"
  172.       $ret = 11
  173.       }
  174.     else if ("12^M" isin response)
  175.       {
  176.       display ">>> CONNECT 9600 <<<"
  177.       $ret = 12
  178.       }
  179.     else if ("13^M" isin response)
  180.       {
  181.       display ">>> CONNECT 9600 <<<"
  182.       $ret = 12
  183.       }
  184.     else if ("14^M" isin response)
  185.       {
  186.       display ">>> CONNECT 19200 <<<"
  187.       $ret = 12
  188.       }
  189.     else if ("28^M" isin response)
  190.       {
  191.       display ">>> CONNECT 38400 <<<"
  192.       $ret = 12
  193.       }
  194.     else if ("41^M" isin response)
  195.       {
  196.       display ">>> CONNECT 38400 <<<"
  197.       $ret = 12
  198.       }
  199.  
  200.  
  201.     return $ret            ; return connect baud rate to application 
  202.     
  203.  
  204.  
  205. ANSWER:
  206.     $ret = 8               ; set default ret code to "no answer"
  207.  
  208.     waitrsp 1              ; see if phone is ringing 
  209.     
  210.     if (response = "2^M")  ; 2 is numeric form of "RING" 
  211.         {
  212.         if (listen = 1)    ; see if Listen program is running or not
  213.         sendln "ATD"   ; answer phone in originate mode (Listen)
  214.         else
  215.         sendln "ATA"   ; answer the phone normally
  216.  
  217.         waitrsp 120        ; wait for return code from modem (max 2 minutes)
  218.  
  219.  
  220.         if (response = "1^M")
  221.           {
  222.           display ">>> CONNECT 300 <<<"
  223.           $ret = 1
  224.           }
  225.         else if (response = "3^M")
  226.           {
  227.           display ">>> NO CARRIER <<<"
  228.           $ret = 8             ; no answer or no connect
  229.           }
  230.         else if (response = "5^M")
  231.           {
  232.           display ">>> CONNECT 1200 <<<"
  233.           $ret = 5
  234.           }
  235.         else if (response = "10^M")
  236.           {
  237.           display ">>> CONNECT 2400 <<<"
  238.           $ret = 10
  239.           }
  240.         else if (response = "11^M")
  241.           {
  242.           display ">>> CONNECT 4800 <<<"
  243.           $ret = 11
  244.           }
  245.         else if (response = "12^M")
  246.           {
  247.           display ">>> CONNECT 9600 <<<"
  248.           $ret = 12
  249.           }
  250.         else if (response = "14^M")
  251.           {
  252.           display ">>> CONNECT 19200 <<<"
  253.           $ret = 12
  254.           }
  255.        else if (response = "28^M")
  256.           {
  257.           display ">>> CONNECT 38400 <<<"
  258.           $ret = 12
  259.           }
  260.  
  261.        if ($ret = 8)           ; if there was no answer, make sure that
  262.           {                    ;   modem goes back on hook.  There seems
  263.           dtr 0                ;   to be a problem with these modems
  264.           wait 1               ;   where the modem can sometimes refuse
  265.           dtr 1                ;   to hang up if ATA fails to establish
  266.           }                    ;   a connection.
  267.        }
  268.  
  269.     return $ret            ; return connect baud rate to application 
  270.     
  271.  
  272.  
  273. DISCONNECT:
  274.     wait 2                 ; wait 2 seconds 
  275.  
  276.     send "+++"             ; send escape sequence to put modem back to 
  277.                    ;    command state 
  278.     wait 2                 ; wait 2 seconds 
  279.  
  280.     waitrsp 3              ; wait for response from modem
  281.  
  282.     clearrsp               ; clear the response buffer 
  283.  
  284.     sendln "ATH0"          ; hang up the phone 
  285.  
  286.     waitrsp 3              ; wait for a response 
  287.  
  288.     if (response != "0^M") ; if hang up failed, drop DTR to force hang up
  289.         {
  290.         DTR 0              ; drop DTR to reset modem 
  291.         wait 2             ; some modems require a delay here
  292.         DTR 1              ; raise DTR 
  293.         clearrsp           ; clear response buffer
  294.         }
  295.  
  296.     return 0               ; always return OK 
  297.  
  298.  
  299.  
  300.  
  301.  
  302.