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 >
Wrap
Text File
|
1994-08-31
|
8KB
|
368 lines
{
IBMPAD.SCT
This is a script for the new thinkpad modems. The script now supports 14.4K
}
{
Define escape key string, used throughout.
}
set ESCKEYSTR "\033\033";
set erecovery 0;
{Save the speed so we can use it later!}
if speed=1200: set config_speed "1200";
if speed=2400: set config_speed "2400";
if speed=4800: set config_speed "4800";
if speed=9600: set config_speed "9600";
if speed=19200: set config_speed "19200";
{
Reset the modem.
}
prompt "Resetting the modem.\015\012";
set dtr 0;
pause 1;
set dtr 1;
set rts 1;
{
Talk to the modem using 1200 baud . Reset the modem then use the value set
in setdial.
}
set rbuf "";
set speed 1200;
send "ATV1\015";
waitfor max 2 seconds
keystr=ESCKEYSTR: goto userescape;
timeout:
prompt "No response from modem.\015\012";
prompt "Please confirm that COM port has been set to COM2.\015\012";
exit 1;
response="OK":
break;
endwaitfor;
{
Send the soft reset command and pull up config saved in profile 1.
}
send "ATZ1\015";
pause 1;
{Try to set the serial port speed higher than the modem speed to take }
{advantage of commpression.}
if config_speed="1200":set speed 4800;
if config_speed="2400":set speed 9600;
if config_speed="4800":set speed 19200;
if config_speed="9600":set speed 19200;
if config_speed="19200":set speed 19200;
pause 1;
if config_speed="1200": send "ATF4\015";
if config_speed="2400": send "ATF5\015";
if config_speed="4800": send "ATF6\015";
pause 1;
prompt "Serial port speed is: ";
prompt config_speed;
prompt "\015\012";
pause 1;
{ Set the modem so it will: }
{ }
{ -not echo commands }
{ -will return result codes }
{ -will return full word result codes }
send "ATEQV1\015";
pause 1; {wait 1 second}
set rbuf ""; {clear out the echo}
{ Issue an interrogate command to the modem so we can try }
{ and detect which type of modem it is. Any modem which does }
{ not respond, or which sends back a result code we do not }
{ recognize, will be assumed to be Hayes 1200 compatible. If }
{ a 9600 baud modem is detected, we must differentiate }
{ between the telebit modems other 9600 baud modems. The }
{ Telebit modems have an internal register, number 52, that }
{ the others do not. If the modem returns an error result }
{ code when we try to write the contents of this register, we }
{ assume it is not a Telebit modem. }
send "ATI\015"; {interrogate command}
waitfor max 5 seconds
keystr=ESCKEYSTR: goto userescape;
response="14400":
prompt "\015\012";
prompt "IBM V.32bis modem detected.";
prompt "\015\012";
set mtype 4;
pause 1;
send "ATV1EW1\015";
pause 1;
send "AT&C1&D3L1\015";
pause 1;
break;
timeout: prompt "\015\012";
prompt "Modem not found.\015\012";
prompt "Please confirm modem type.\015\012";
exit 1;
endwaitfor;
{
Tell the modem to wait longer for carrier
}
send "ATS7=210\015";
pause 1;
{ Dial the phone using the current value of number. }
{ Wait for a modem result code. If a connect code is }
{ received, set the baud rate to the proper value. If }
{ the line is busy tell the user to try again later. }
{ If a connection cannot be established, suggest }
{ appropriate action. }
set rbuf "";
{
Turn speaker on/off according to call_monitor variable.
}
if call_monitor: goto speakeron;
speakeroff:
send "ATM\015";
prompt "Call monitoring off";
prompt "\015\012";
goto sdone;
speakeron:
send "ATM1\015";
prompt "Call monitoring on\015\012";
sdone:
pause 2;
{
Send command to not wait for dial tone if blind dial set
}
if !blind_dial: goto nobd;
send "ATX1\015";
nobd:
send "AT\015"; {Telebit internal modem does not understand last command.}
pause 2;
{
If number does not begin with touch tone or pulse code,
default to touch tone.
}
{if number "T";}
{
Clear response buffer.
}
set rbuf "";
send "ATDT,"; {dial the phone}
prompt "Dialing ";
prompt number;
prompt "\015\012";
send number;
send "\015";
pause 1;
wait_for_connect:
waitfor max call_timeout seconds
keystr=ESCKEYSTR: goto userescape;
{See what carrier speed has been negotiated}
response="CARRIER 12000":
prompt "Carrier established at 12000\015\012";
goto wait_for_connect;
break;
response="CARRIER 1200":
prompt "Carrier established at 1200\015\012";
goto wait_for_connect;
break;
response="CARRIER 2400":
prompt "Carrier established at 2400\015\012";
goto wait_for_connect;
break;
response="CARRIER 4800":
prompt "Carrier established at 4800\015\012";
goto wait_for_connect;
break;
response="CARRIER 9600":
prompt "Carrier established at 9600\015\012";
goto wait_for_connect;
break;
response="CARRIER 14400":
prompt "Carrier established at 14400\015\012";
goto wait_for_connect;
break;
{Now the modem will tell what protocol has been established}
response="PROTOCOL: LAP-M":
set erecovery 1;
prompt "Connection established using LAP-M \015\012";
goto wait_for_connect;
break;
response="PROTOCOL: NONE":
set erecovery 0;
prompt "NO error protocol has been established.\015\012";
goto wait_for_connect;
break;
{Now find out if compression has been negotiated}
response="COMPRESSION: V.42BIS":
prompt "V.42BIS Compression has been negotiated.\015\012";
goto wait_for_connect;
break;
response="COMPRESSION: NONE":
prompt "NO Compression has been negotiated.\015\012";
goto wait_for_connect;
break;
{Now see if it connects using the right serial speed}
response="CONNECT 1200":
con1200:
prompt "\015\012";
prompt "Connection established at 1200 baud.";
prompt "\015\012";
pause 2;
passport;
break;
response="CONNECT\015":
goto con1200;
response="CONNECT 2400":
prompt "\015\012";
prompt "Connection established at 2400 baud.";
prompt "\015\012";
pause 2;
passport;
break;
response="CONNECT 4800":
prompt "\015\012";
prompt "Connection established at 4800 baud.";
prompt "\015\012";
pause 2;
passport;
break;
response="CONNECT 9600":
prompt "\015\012";
prompt "Connection established at 9600 baud.";
prompt "\015\012";
pause 2;
passport;
break;
response="CONNECT 19200":
prompt "\015\012";
prompt "Connection established at 19200 baud.";
prompt "\015\012";
set speed 19200;
pause 2;
passport;
break;
response="BUSY":
prompt "\015\012";
prompt "The line is busy.";
prompt "\015\012";
prompt "Please try again later.";
exit 20;
break;
response="NO DIALTONE":
prompt "\015\012";
prompt "The modem has detected no dialtone";
prompt "\015\012";
prompt "Please make sure that the modem is plugged into a phone jack";
exit 20;
break;
timeout:
prompt "\015\012Connection could not be established.";
prompt "\015\012Check cabling and phone line.";
set dtr 0; {clean up on the way out}
pause 2;
send "ATZ\015";
exit 21;
break;
endwaitfor;
{
User Escape
}
userescape:
prompt "\015\012";
prompt "User Escape.";
prompt "\015\012";
exit 22;