home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxppp.zip
/
mindspr.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-09-16
|
3KB
|
136 lines
/* mindspr.cmd */
parse arg interface ,
cr='0d'x
crlf='0d0a'x
/* REPLACE WITH YOUR ACCOUNT INFO */
login='userid'
pass='password'
phone='atdt4043350600'
/* CHANGE TO MATCH YOUR MODEM SETTINGS */
/* Note: you may only need to change the ComPort */
ComPort='COM2'
ModeOptions='57600,n,8,1,rts=hs,octs=on,dtr=on,buffer=on'
/* You need Ray Gwinn's SIO Drivers to run at 115200 bps */
say ''
say 'MindSpring PPP Connection Script ',
'(interface' interface')'
'mode 'ComPort||': ' ModeOptions
call flush_receive
call lineout , 'Reset modem...'
/* Change to match your modem settings */
/* DOESNT WORK call send 'AT&F1S37=29S109=768' || cr */
call send 'ATZ' || cr
call waitfor 'OK', 5 ; call flush_receive 'echo'
/* ------------------------------- */
if RC = 1 then do
call lineout , 'Modem not resetting... Trying again'
call send '```'
call waitfor 'OK'
call send 'ATHZ' || cr
call waitfor 'OK', 3
end
/* CHANGE HERE FOR A DIFFERENT LOGIN SEQUENCE */
call charout , 'Now Dialing...'
call send phone || cr
call waitfor 'ogin:' ; call flush_receive 'echo'
call send login || cr
call waitfor 'assword:' ; call flush_receive 'echo'
call send pass || crlf
call lineout , ' '
say 'LOGIN COMPLETED'
/* All done */
exit 0
send:
parse arg sendstring
call ppp_com_output interface , sendstring
return
waitfor:
parse arg waitstring , timeout
if timeout = '' then
timeout = 5000 /* L O N G delay if not specified */
waitfor_buffer = '' ; done = -1; curpos = 1
ORI_TIME=TIME('E')
if (remain_buffer = 'REMAIN_BUFFER') then do
remain_buffer = ''
end
do while (done = -1)
if (remain_buffer \= '') then do
line = remain_buffer
remain_buffer = ''
end
else do
line = ppp_com_input(interface,,10)
end
waitfor_buffer = waitfor_buffer || line
index = pos(waitstring,waitfor_buffer)
if (index > 0) then do
remain_buffer = substr(waitfor_buffer,index+length(waitstring))
waitfor_buffer = delstr(waitfor_buffer,index+length(waitstring))
done = 0
end
call charout , substr(waitfor_buffer,curpos)
curpos = length(waitfor_buffer)+1
if ((done \= 0) & (TIME('E')>timeout)) then do
call lineout , ' WAITFOR: timed out '
done = 1
end
end
timeout=0
RC=done
return RC
readpass:
answer = ''
do until key = cr
key = ppp_getch()
if key \= cr then do
answer = answer || key
end
end
say ''
return answer
flush_receive:
parse arg echo
/* If echoing the flush - take care of waitfor remaining buffer */
if (echo \= '') & (length(remain_buffer) > 0) then do
call charout , remain_buffer
remain_buffer = ''
end
/* Eat anything left in the modem or COM buffers */
/* Stop when nothing new appears for 100ms. */
do until line = ''
line = ppp_com_input(interface,,100)
if echo \= '' then
call charout , line
end
return