home *** CD-ROM | disk | FTP | other *** search
/ IBM Presents OS/2 Software Hits 1995 / OS-2_SW_HITS_2ND_EDITION_1995.ISO / i02 / ibmpad.sct < prev    next >
Text File  |  1994-08-31  |  8KB  |  368 lines

  1. {
  2.             IBMPAD.SCT
  3.  This is a script for the new thinkpad modems. The script now supports 14.4K
  4.  
  5. }
  6.  
  7. {
  8. Define escape key string, used throughout.
  9. }
  10. set ESCKEYSTR "\033\033";
  11.  
  12. set erecovery 0;
  13.  
  14.  
  15. {Save the speed so we can use it later!}
  16.  
  17. if speed=1200: set config_speed "1200";
  18. if speed=2400: set config_speed "2400";
  19. if speed=4800: set config_speed "4800";
  20. if speed=9600: set config_speed "9600";
  21. if speed=19200: set config_speed "19200";
  22.  
  23.  
  24. {
  25. Reset the modem.
  26. }
  27. prompt "Resetting the modem.\015\012";
  28. set dtr 0;
  29.  
  30. pause 1;
  31.  
  32. set dtr 1;
  33. set rts 1;
  34.  
  35.  
  36.  
  37. {
  38. Talk to the modem using 1200 baud . Reset the modem then use the value set
  39. in setdial.
  40. }
  41.  
  42. set rbuf "";
  43.  
  44. set speed 1200;
  45.  
  46. send "ATV1\015";
  47.  
  48.  
  49. waitfor max 2 seconds
  50.  
  51.     keystr=ESCKEYSTR: goto userescape;
  52.  
  53.     timeout:
  54.     prompt "No response from modem.\015\012";
  55.     prompt "Please confirm that COM port has been set to COM2.\015\012";
  56.     exit 1;
  57.  
  58.     response="OK":
  59.     break;
  60.  
  61. endwaitfor;
  62.  
  63.  
  64.  
  65. {
  66. Send the soft reset command and pull up config saved in profile 1.
  67. }
  68. send "ATZ1\015";
  69. pause 1;
  70.  
  71. {Try to set the serial port speed higher than the modem speed to take }
  72. {advantage of commpression.}
  73.  
  74. if config_speed="1200":set speed 4800;
  75. if config_speed="2400":set speed 9600;
  76. if config_speed="4800":set speed 19200;
  77. if config_speed="9600":set speed 19200;
  78. if config_speed="19200":set speed 19200;
  79. pause 1;
  80.  
  81. if config_speed="1200": send "ATF4\015";
  82. if config_speed="2400": send "ATF5\015";
  83. if config_speed="4800": send "ATF6\015";
  84. pause 1;
  85.  
  86.  
  87.  
  88. prompt "Serial port speed is: ";
  89. prompt config_speed;
  90. prompt "\015\012";
  91.  
  92.  
  93. pause 1;
  94.  
  95.  
  96.  
  97. {   Set the modem so it will:                           }
  98. {                                                       }
  99. {                -not echo commands                     }
  100. {                -will return result codes              }
  101. {                -will return full word result codes    }
  102.  
  103. send "ATEQV1\015";
  104. pause 1;                     {wait 1 second}
  105. set rbuf "";                 {clear out the echo}
  106.  
  107.  
  108. {   Issue an interrogate command to the modem so we can try   }
  109. { and detect which type of modem it is.  Any modem which does }
  110. { not respond, or which sends back a result code we do  not   }
  111. { recognize, will be assumed to be Hayes 1200 compatible.  If }
  112. { a 9600 baud modem is detected, we must differentiate        }
  113. { between the telebit modems other 9600 baud modems.  The     }
  114. { Telebit modems have an internal register, number 52, that   }
  115. { the others do not.  If the modem returns an error result    }
  116. { code when we try to write the contents of this register, we }
  117. { assume it is not a Telebit modem.                           }
  118.  
  119. send "ATI\015";              {interrogate command}
  120.  
  121. waitfor max 5 seconds
  122.  
  123.     keystr=ESCKEYSTR: goto userescape;
  124.  
  125.  
  126.     response="14400":
  127.     prompt "\015\012";
  128.     prompt "IBM V.32bis modem detected.";
  129.     prompt "\015\012";
  130.     set mtype 4;
  131.     pause 1;
  132.     send "ATV1EW1\015";
  133.     pause 1;
  134.     send "AT&C1&D3L1\015";
  135.     pause 1;
  136.  
  137.  
  138.  
  139.     break;
  140.  
  141.     timeout:  prompt "\015\012";
  142.     prompt "Modem not found.\015\012";
  143.     prompt "Please confirm modem type.\015\012";
  144.     exit 1;
  145.  
  146. endwaitfor;
  147.  
  148.  
  149. {
  150. Tell the modem to wait longer for carrier
  151. }
  152. send "ATS7=210\015";
  153. pause 1;
  154.  
  155.  
  156.  
  157. {   Dial the phone using the current value of number.  }
  158. { Wait for a modem result code.  If a connect code is  }
  159. { received, set the baud rate to the proper value.  If }
  160. { the line is busy tell the user to try again later.   }
  161. { If a connection cannot be established, suggest       }
  162. { appropriate action.                                  }
  163.  
  164.  
  165. set rbuf "";
  166.  
  167. {
  168. Turn speaker on/off according to call_monitor variable.
  169. }
  170. if call_monitor: goto speakeron;
  171.  
  172. speakeroff:
  173.     send "ATM\015";
  174.     prompt "Call monitoring off";
  175.     prompt "\015\012";
  176.     goto sdone;
  177.  
  178. speakeron:
  179.     send "ATM1\015";
  180.     prompt "Call monitoring on\015\012";
  181.  
  182. sdone:
  183. pause 2;
  184.  
  185. {
  186. Send command to not wait for dial tone if blind dial set
  187. }
  188. if !blind_dial: goto nobd;
  189. send "ATX1\015";
  190. nobd:
  191.  
  192. send "AT\015";                                                                                                                                  {Telebit internal modem does not understand last command.}
  193. pause 2;
  194.  
  195.  
  196. {
  197. If number does not begin with touch tone or pulse code,
  198. default to touch tone.
  199. }
  200. {if number "T";}
  201.  
  202. {
  203. Clear response buffer.
  204. }
  205. set rbuf "";
  206.  
  207. send "ATDT,";                  {dial the phone}
  208. prompt "Dialing ";
  209. prompt number;
  210. prompt "\015\012";
  211. send number;
  212. send "\015";
  213. pause 1;
  214.  
  215. wait_for_connect:
  216.  
  217. waitfor max call_timeout seconds
  218.  
  219.     keystr=ESCKEYSTR: goto userescape;
  220.  
  221. {See what carrier speed has been negotiated}
  222.  
  223.     response="CARRIER 12000":
  224.     prompt "Carrier established at 12000\015\012";
  225.     goto wait_for_connect;
  226.     break;
  227.  
  228.     response="CARRIER 1200":
  229.     prompt "Carrier established at 1200\015\012";
  230.     goto wait_for_connect;
  231.     break;
  232.  
  233.     response="CARRIER 2400":
  234.     prompt "Carrier established at 2400\015\012";
  235.     goto wait_for_connect;
  236.     break;
  237.  
  238.     response="CARRIER 4800":
  239.     prompt "Carrier established at 4800\015\012";
  240.     goto wait_for_connect;
  241.     break;
  242.  
  243.     response="CARRIER 9600":
  244.     prompt "Carrier established at 9600\015\012";
  245.     goto wait_for_connect;
  246.     break;
  247.  
  248.     response="CARRIER 14400":
  249.     prompt "Carrier established at 14400\015\012";
  250.     goto wait_for_connect;
  251.     break;
  252.  
  253.  
  254.  
  255. {Now the modem will tell what protocol has been established}
  256.  
  257.     response="PROTOCOL: LAP-M":
  258.     set erecovery 1;
  259.     prompt "Connection established using LAP-M \015\012";
  260.     goto wait_for_connect;
  261.     break;
  262.  
  263.     response="PROTOCOL: NONE":
  264.     set erecovery 0;
  265.     prompt "NO error protocol has been established.\015\012";
  266.     goto wait_for_connect;
  267.     break;
  268.  
  269. {Now find out if compression has been negotiated}
  270.  
  271.     response="COMPRESSION: V.42BIS":
  272.     prompt "V.42BIS Compression has been negotiated.\015\012";
  273.     goto wait_for_connect;
  274.     break;
  275.  
  276.     response="COMPRESSION: NONE":
  277.     prompt "NO Compression has been negotiated.\015\012";
  278.     goto wait_for_connect;
  279.     break;
  280.  
  281. {Now see if it connects using the right serial speed}
  282.  
  283.     response="CONNECT 1200":
  284. con1200:
  285.     prompt "\015\012";
  286.     prompt "Connection established at 1200 baud.";
  287.     prompt "\015\012";
  288.     pause 2;
  289.     passport;
  290.     break;
  291.  
  292.     response="CONNECT\015":
  293.     goto con1200;
  294.  
  295.     response="CONNECT 2400":
  296.     prompt "\015\012";
  297.     prompt "Connection established at 2400 baud.";
  298.     prompt "\015\012";
  299.     pause 2;
  300.     passport;
  301.     break;
  302.  
  303.     response="CONNECT 4800":
  304.     prompt "\015\012";
  305.     prompt "Connection established at 4800 baud.";
  306.     prompt "\015\012";
  307.     pause 2;
  308.     passport;
  309.     break;
  310.  
  311.     response="CONNECT 9600":
  312.     prompt "\015\012";
  313.     prompt "Connection established at 9600 baud.";
  314.     prompt "\015\012";
  315.     pause 2;
  316.     passport;
  317.     break;
  318.  
  319.  
  320.     response="CONNECT 19200":
  321.     prompt "\015\012";
  322.     prompt "Connection established at 19200 baud.";
  323.     prompt "\015\012";
  324.     set speed 19200;
  325.     pause 2;
  326.     passport;
  327.     break;
  328.  
  329.     response="BUSY":
  330.     prompt "\015\012";
  331.     prompt "The line is busy.";
  332.     prompt "\015\012";
  333.     prompt "Please try again later.";
  334.     exit 20;
  335.     break;
  336.  
  337.     response="NO DIALTONE":
  338.     prompt "\015\012";
  339.     prompt "The modem has detected no dialtone";
  340.     prompt "\015\012";
  341.     prompt "Please make sure that the modem is plugged into a phone jack";
  342.     exit 20;
  343.     break;
  344.  
  345.     timeout:
  346.     prompt "\015\012Connection could not be established.";
  347.     prompt "\015\012Check cabling and phone line.";
  348.     set dtr 0;                              {clean up on the way out}
  349.     pause 2;
  350.     send "ATZ\015";
  351.     exit 21;
  352.     break;
  353.  
  354. endwaitfor;
  355.  
  356.  
  357.  
  358.  
  359. {
  360. User Escape
  361. }
  362.  
  363. userescape:
  364.     prompt "\015\012";
  365.     prompt "User Escape.";
  366.     prompt "\015\012";
  367.     exit 22;
  368.