# ************************************************************ # * Trumpet Winsock 2.1f LOGIN.CMD for Multiple PPP accounts * # * - copyright 1996 by Albert P. Belle Isle - * # ************************************************************ # # ASSIGN A SEPARATE ICON FOR EACH PROVIDER # with command line # # \tcpman -inpath=\<$provider>.ini # # a separate .ini-file is required for each provider # (in same format as trumpwsk.ini and named $provider.ini, # where $provider is an 8-or-less character string) and # with entries for each of the [DEFAULT VARS] required, # or script won't run (use "" for empty string variables) # # [examples for NetCom and UltraNet are appended after the script] # # winsock demand-loading by a program uses a trumpwsk.ini # identical to your favorite $provider.ini file, except # with online-check=0 and dial-option=0 to provide for the # off-line use of Web Browsers and Mail composing before dial-in. # # *************************************************************** # # #BEGINNING OF SCRIPT # ########## LOAD [DEFAULT VARS] FROM .INI-FILE ########### load $ModemType load $InitString load %ModemTimeOut load $provider load $multinumbers load $prefix # #[if you haven't run setup.cmd you can enter now] if ![load $number] | pos("yes",$multinumbers) if [query $number Enter $provider phone number] save $number end end if ![load $username] if [username Enter your $provider" username"] save $username end end if ![load $password] if [password Enter your $provider" password"] save $password end end ############ END OF [DEFAULT VARS] LOADING ############### # # #### SET DIALING VARIABLES #### #[times in seconds] %attempts = 25 %answerwait = 30 %redialpause = 2 %dcdtimeout = 5 #### END DIALING VARIABLES #### # # ###### SET LOGIN VARIABLES ##### #["wait-for" strings with common defaults] if ![load $userprompt] $userprompt = "ogin:" end if ![load $passprompt] $passprompt = "assword:" end if ![load $addrtag1] $addrtag1 = "PPP session from (" # for SLIP accounts use # $addrtag1 = "SLIP session from (" end if ![load $addrtag2] $addrtag2 = " to " end if ![load %numaddresses] %numaddresses = 2 end # #[time-out in seconds] %servertimeout = 20 ###### END LOGIN VARIABLES ##### # # ####### MODEM INITIALIZATION ####### set dtr on status Initializing $ModemType modem... output AT$InitString\13 if ![input %ModemTimeOut OK\n] set dtr off message Modem is not responding set dtr on abort end ####### END OF INITIALIZATION ####### # # #################### DIALING ROUTINE ##################### #[initialize looping variables] $response = " " %n = 0 %redial = 1 # #[enter dialing loop] while %redial > 0 %n = %n + 1 if %n = %attempts set dtr off display More than %attempts unsuccessful dial attempts. sleep 1 set dtr on exit end status Dialing $provider at $number (attempt no. %n) output ATDT$number\13 # #[wait for response from modem] repeat %redial = 0 if ![read %answerwait $response] set dtr off status No Response - Re-Dialing sleep %redialpause %redial = 1 set dtr on end %bus = pos("BUSY",$response) %con = pos("CONNECT",$response) until %con > 0 | %bus > 0 | %redial > 0 # #[ if ! %con > 0 %redial = 1 if %bus > 0 status BUSY end end sleep %redialpause #[continue loop unless CONNECT (%redial=0)] end # wait %dcdtimeout dcd ################### END OF DIALING ####################### # ################ LOG-IN DIALOG ################ status Connected - $username logging in... # #[wait for username prompt] if ![input %servertimeout $userprompt] set dtr off message No Username Prompt set dtr on exit else output $prefix$username\13 end # #[wait for password prompt] if ![input %servertimeout $passprompt] set dtr off message No Password Prompt set dtr on exit else output $password\13 end # status Login successful....Establishing PPP connection. # #[wait for welcome and IP address] if ![input %servertimeout $addrtag1] set dtr off message Not able to negotiate PPP connection set dtr on exit else if %numaddresses > 0 #[accept IP address input into variable \i] address 30 end end # #[wait for 2nd IP address and/or completion message] if ![input %servertimeout $addrtag2] set dtr off message Not able to negotiate PPP connection set dtr on exit else #[if 2 addresses, overwrite server address with your address] if %numaddresses > 1 address 30 end end # status Connected. Your IP address is \i. # #[sound bell] display \07 # ############### END OF LOG-IN ################## # #sleep 1 # ##################### LAUNCH APPLICATION PROGRAMS ##################### #exec "c:\windows\modemsta\modemsta" #[always launch ModemSta program] # #[unless default .ini-file # (winsock demand-loading by a program uses trumpwsk.ini) # launch others with their own provider-specific .ini-files] #if !pos("trumpwsk.ini",$inipath) # exec "e:\internet\eudora\eudora" # exec "e:\internet\netscape\netscape -Id:\internet\netscape\"$provider".ini" #end ##################### END OF PROGRAM LAUNCHING ######################### # # #[signal tcpman to enable PPP] exit # #END OF SCRIPT # .INI-FILE DEFAULT VARIABLE EXAMPLES #*********** FOR NETCOM.INI ************ # # [default vars] # $ModemType="USRobotics Sportster V.34" # $InitString="&F1L1s0=0" # %ModemTimeOut=3 # $provider=NetCom # $multinumbers=yes # $prefix="#" # #**************************************** #*********** FOR ULTRANET.INI *********** # # [default vars] # $ModemType="USRobotics Sportster V.34" # $InitString="&F1L1s0=0" # %ModemTimeOut=3 # $provider=UltraNet # $multinumbers=no # $prefix="" # $addrtag1="IP address is " # $addrtag2="MTU is 1500." # %numaddresses=1 # #****************************************