home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
TE2OSB.ZIP
/
OSB.SCR
next >
Wrap
Text File
|
1992-08-31
|
7KB
|
226 lines
;; -------------------------------------------------------------------------
;; osb.scr -- Script for Os2shareware BBS 7/30/92 - 8/31/92
;;
;; This is not an original work of mine! I got most of it from
;; scripts that came with Brady Flowers' TE/2v1.21. See `readmy' file
;; that accompanies this one for important changes you may need.
;; -------------------------------------------------------------------------
global integer fGotBBS ;; Caller must declare this global variable if he
integer i ;; wants to test the success or failure
;string DialerEntry = "OSB" ;; <<== Change this for your setup
string MyName = "James;Smith" ;; <<== Change this to your name
integer hWatch1
integer hWatch2
string QWKInbound = "c:\dl" ;; directory to which files go
string QWKOutbound = "c:\kwq" ;; directory where qwk files are
string REPPacket = "OS2SHARE.REP"
string buffer
string SaveDLPath
integer SaveClobber
integer SaveQZM
integer SaveXonXoff
integer fREPPacket
integer fQWKPacket
integer fp1
;; -------------------------------------------------------------------------
subroutine GetBBS
fGotBBS = FALSE ;; All primed for failure
;; Try five times to cajole Bink into sending its initial banner by
;; transmitting space characters, one every two seconds.
i = 0
do while i < 5
sendbyte(' ')
if waitfor("Address", 3)
break
else
i = i + 1
sleep(2000)
endif
loop
;; If i is less than 5, then we got the Bink banner, now do the same
;; thing with ESCape characters to tell Bink we want the BBS. See the
;; comment above regarding testing for "Thank you" here.
if i < 5
i = 0
do while i < 5
sendbyte('^[')
if waitfor("Thank you", 3)
break
else
i = i + 1
sleep(2000)
endif
loop
;; If i is less than 5 here, it means Bink said "Thank you" and we
;; should be going into the BBS now.
if i < 5
fGotBBS = TRUE
endif
endif
endsub
;;-----------------------------------------------------------------------------
subroutine MaxLogin
if fGotBBS
hWatch1 = watchfor("Press ENTER to continue", "sendbyte(13)")
hWatch2 = watchfor("More [Y,n,t,=]? ", "transmit(""Y^M"")")
waitfor("What is your name:", 30)
transmit("%s;y;%s^M", myName, Password(""))
waitfor("o check for mail? [Y,n] ", 30)
transmit("n^M") ;; no mail check
LOGOPEN("c:\te2\osb.fil", 1) ;; open log for new file list
waitfor("ck for new files? [Y,n] ", 30)
transmit("Y^M") ;; yes for new file listing
waitfor ("ress <enter> for ", 30)
transmit("^M")
waitfor("Select:", 300)
cancelwatch(hWatch1)
cancelwatch(hWatch2)
else
;; Couldn't get thru Binkley for some reason?
Hangup(FALSE)
endif
endsub
;;-----------------------------------------------------------------------------
subroutine SetupQWK
SaveDLPath = DownLoadPath
SaveClobber = ClobberDL
SaveQZM = QueryZMRecover
SaveXonXoff = XonXoff
setxonxoff(0)
DownLoadPath = QWKInbound
;; Possible settings for ClobberDL:
;; -1 -> rename an existing file and continue xfer
;; 1 -> overwrite any existing file
;; 0 -> abort xfer if file exists
ClobberDL = 1
QueryZMRecover = FALSE
;; Set ZModem recovery OFF, it would be a real pain to have the recovery
;; menu pop up during an unattended transfer!
;; Discover if a .REP packet exists
REPPacket = QWKOutbound + "\" + REPPacket
fREPPacket = fopen(REPPacket, "r")
if (fREPPacket & 0x0000ffff)
fclose(fREPpacket)
fREPPacket = TRUE
else
fREPPacket = FALSE
endif
endsub
;; --------------------------------------------------------------------------
subroutine QWKXfer
if fREPPacket
transmit("ou^M") ;; for Offline Reader to upload rep
waitfor("^Q", 300)
if upload(ZMODEM, REPPacket)
erase(REPPacket)
else
FileError("Error uploading file, aborting script! ", REPPacket)
stop
endif
waitfor("Select:", 300)
transmit("d^M")
else
transmit("od^M")
endif
erase("c:\dl\os2share.old") ;; erases older qwk
rename("c:\dl\os2share.qwk", "\dl\os2share.old") ;; renames old qwk
fQWKPacket = muxwait("/[Y,n]?/Select:/", 300)
if fQWKPacket == 1
transmit("Y^M")
waitfor("<esc> to abort:", 300)
transmit("^M")
waitfor("cancel.", 300)
download(ZMODEM, "") ;; auto zmodem download
waitfor("Select:", 300)
endif
endsub
;;------------------------------------------------------------------------------
subroutine UnSetupQWK
DownLoadPath = SaveDLPath
ClobberDL = SaveClobber
QueryZMRecover = SaveQZM
setxonxoff(SaveXonXoff)
endsub
;;---------------------------------------------------------------------------
subroutine GetFile ;; this section downloads
;; files listed in a .get
fp1 = fopen("c:\te2\scrip\osb.get", "r") ;; file.
if (fp1 & 0xffff)
buffer = fgets(fp1)
fclose(fp1)
transmit("m^M")
waitfor("Select:", 60)
transmit("F^M") ;; file section
transmit("D %s^M", buffer)
waitfor("File(s) to download", 360)
transmit("^M")
waitfor("to cancel.", 300)
download(ZMODEM, "")
waitfor("Select:", 60)
erase("c:\te2\scrip\osb.get") ;; erases get file so it
else ;; can not be used again
gosub GetOff ;; accidently.
endif
endsub
;;------------------------------------------------------------------------------
subroutine GetOff
transmit("g;y;n^M")
waitfor("Please call again!", 30)
LOGCLOSE() ;; closes log
hangup(FALSE)
endsub
;;----------------------------------------------------------------------------
PROGRAM
if !connected
hangup(FALSE)
endif
if connected
gosub GetBBS
gosub MaxLogin
gosub SetupQWK
gosub QWKXfer
gosub UnSetupQWK
gosub GetFile
gosub GetOff
endif
end