home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
comm
/
brc_3asp.zip
/
EXECAUTO.ASP
next >
Wrap
Text File
|
1993-05-28
|
24KB
|
667 lines
; Script File: EXECAUTO.ASP
comment ; begin a comment block
Note: This script is written for ProComm Plus version 2. !!!
It does the following things:
■ reads my personal mail and leaves it marked for the QWK facility
to pick up.
■ displays the new files in selected collections.
■ does downloads, access displays, and extra information displays in
selected collections.
■ downloads new messages via the QWK door.
■ uploads any replies I have written.
It also takes into account the new display mode in the file system
where there is a letter and a space in front of the file names as well
as the apparent '50 files at a time' limit on downloads.
This script can be used in a cold-start mode (let it do the dialing
in an unattended session) -or- it can be called up after a connection
is made (you must be at the main menu). For instance, I sometimes start
a call from my 'get connected and log-on' script to read/send/answer
messages, do file scans or whatever and then invoke this script so
that it can do the rest of my business for me.
This script is written for a modem that uses the Hayes/AT command set.
If your modem is different, change the dialing command and response code.
***** Instant commands must be "on" on EXEC-PC. *****
***** Your download protocol on EXEC-PC must be Zmodem. *****
***** You should be logged into your download directory. *****
The files 'EXECFILE.?, 'EXECEXTR.?' and 'EXECACCS.?' used in the
(D)ownload, (E)xtra info and (A)ccess procedures respectively contain
filenames and descriptions. I build them with the LIST program,
selecting and writing/appending lines to them while viewing file lists
in logfiles. After the downloads are finished for each file area,
It appends the EXECFILE.? file to another file named 'download.log'.
The leading letter and space, if any, are stripped off.
A program runs at the end of the script that inserts these descriptions
into the downloaded ZIP files and changes the DATE/TIME of the ZIP
files to the date/time of the newest file each contains.
EXECFILE.*/EXECEXTR.*/EXECACCS.* (and 'download.log') look like this:
JOKIN-31.ZIP 28383 110591 JOKIN AROUND JOKE SERIES #31
EXECSRCH.ZIP 27984 123188+SEARCH EXEC-PC LISTINGS FOR STRINGS - OFFLINE SAVE
XFERNREV.ZIP 7660 020689 UTILITY TO REVERSE ORDER OF EXEC-PC XFER.ARC FILES
The file extension is the letter of the file area. This script uses:
..... Regular collections .....
(A) [NDEA] Mahoney IBM Compatible MS-DOS
(B) [ DEA] FREE! - DOWNLOAD LISTS
(C) [ DEA] FREE! - UTILITIES AND VARIETY
(D) [NDEA] MS Windows
(G) [NDEA] Adult Pictures & Files PG,R,X
(H) [NDEA] Picture files (.GIF,.PIC,etc)
..... CD-ROM collections .....
(A) [ DEA] >> ALL CD-ROMs Combined!
(B) [ DEA] >> ALL ADULT CD-ROMs Combined!
As noted within the brackets:
N = Do a (N)ew files list
D = Do a (D)ownload
E = Do an (E)xtra info
A = Do an (A)ccess
endcomment ; end the comment block
; start of script processing *******************************************
define MaxDlCount 50 ; maximum # of files that can be downloaded at one shot
define DownLog "c:\pcplus\download.log" ; name of d/l log file
define QwkDlDir "c:\pcplus\download\" ; download directory for mail file
define QwkUlName "c:\pcplus\download\execpc.rep"
; ************************************************************************
proc main ; Let's get started.
string QwkDlName
string QwkNewName
string ExecMmDd = "EXEC"
restart: ; we may come back here if we lose our connection
; These two 'when' statements are active for the life of the call.
when 0 "Press any key to continue ->" transmit "^M"
when 1 "More? ([Y]/Stop/Continuous" transmit "~~~~~~C"
substr S0 $DATE 0 2 ; extract month
strcat ExecMmDd S0 ; add month to name
substr S0 $DATE 3 2 ; extract day
strcat ExecMmDd S0 ; add day to name
if connected ; this statement allows use of this script during a call
goto do_files ; skip the log open/dialing/mail procedures
endif
call execlogon ; get connected and log on
; I expect to get new bulletins in the QWK mail packet ...
;transmit ";" ; should be at Top Menu
;waitfor "Chain->"
;transmit "~~B;*^M" ; read bulletins
;waitquiet 10 forever ; end of bulletins
;transmit "q" ; quit bulletin menu
;waitfor "?=HELP)" ; wait for top command
; Read my personal mail (if any) and leave it marked for later retrieval
transmit ";"
waitfor "Chain->"
transmit "R;N^M"
waitquiet 15 forever ; wait forever for 15 seconds of quiet
; start of file processing **********************************************
; call each procedure using the file area designation
do_files:
; get lists of the NEW files ********************************************
call newfiles with "a" ; Mahoney IBM Compatible MS-DOS
call newfiles with "d" ; MS Windows
call newfiles with "g" ; Adult Pictures & Files PG,R,X
call newfiles with "h" ; Picture files (.GIF,.PIC,etc)
; see if any files to (D)ownload ****************************************
findfirst "c:\pcplus\download\execfile.?"
if found
call download with "a" ; Mahoney IBM Compatible MS-DOS
call download with "b" ; FREE! - DOWNLOAD LISTS
call download with "c" ; FREE! - UTILITIES AND VARIETY
call download with "d" ; MS Windows
call download with "g" ; Adult Pictures & Files PG,R,X
call download with "h" ; Picture files (.GIF,.PIC,etc)
endif
; see if any files to (E)xtra info **************************************
findfirst "c:\pcplus\download\execextr.?"
if found
call extrainf with "a" ; Mahoney IBM Compatible MS-DOS
call extrainf with "b" ; FREE! - DOWNLOAD LISTS
call extrainf with "c" ; FREE! - UTILITIES AND VARIETY
call extrainf with "d" ; MS Windows
call extrainf with "g" ; Adult Pictures & Files PG,R,X
call extrainf with "h" ; Picture files (.GIF,.PIC,etc)
endif
; see if any files to (A)ccess ******************************************
findfirst "c:\pcplus\download\execaccs.?"
if found
call accesser with "a" ; Mahoney IBM Compatible MS-DOS
call accesser with "b" ; FREE! - DOWNLOAD LISTS
call accesser with "c" ; FREE! - UTILITIES AND VARIETY
call accesser with "d" ; MS Windows
call accesser with "g" ; Adult Pictures & Files PG,R,X
call accesser with "h" ; Picture files (.GIF,.PIC,etc)
endif
; see if any CD-ROM files to do *****************************************
findfirst "c:\pcplus\download\exec????.?zz" ; requests for cd-rom files
if found
; see if any files to (D)ownload *************************************
call download with "azz" ; >> ALL CD-ROMs Combined!
call download with "bzz" ; >> ALL ADULT CD-ROMs Combined!
; see if any files to (E)xtra info ***********************************
call extrainf with "azz" ; >> ALL CD-ROMs Combined!
call extrainf with "bzz" ; >> ALL ADULT CD-ROMs Combined!
; see if any files to (A)ccess ***************************************
call accesser with "azz" ; >> ALL CD-ROMs Combined!
call accesser with "bzz" ; >> ALL ADULT CD-ROMs Combined!
endif
if not connected ; if connection was lost
log close ; close the logfile
hangup ; hang up the phone
goto restart ; start over again
endif
; the following is just to see if the designations have changed
transmit "f" ; log into the files area
waitfor "?=HELP" 90 ; wait for top command
transmit "z" ; log into the CD-ROM files area
waitfor "?=HELP" 90 ; wait for top command
transmit "^^^" ; go to the main menu
waitfor "?=HELP" 90 ; wait for top command
; end of file processing *************************************************
; now let's gather and download a QWK mail packet
transmit "K" ; select QWK processing
WaitFor ") ? -" 30
transmit "N" ; select [N]ew messages
WaitFor "[Q]uit" 30
transmit "~~Z" ; select [Z]modem protocol
waitquiet 30 forever ; wait for end of Zmodem d/l
QwkDlName = QwkDlDir
strcat QwkDlName "execpc.qwk"
QwkNewName = QwkDlDir
strcat QwkNewName ExecMmDd
strcat QwkNewName ".qwk"
rename QwkDlName QwkNewName
transmit "^^^"
if not connected
goto lost_it
endif
; if we have a QWK message response packet, UPLOAD it here!
isfile QwkUlName
if success
transmit "K" ; select QWK processing
WaitFor ") ? -" 30
transmit "U" ; select [U]pload
WaitFor "[Q]uit" 30
transmit "Z" ; select [Z]modem protocol
sendfile zmodem QwkUlName ; transmit the file
if success ; if it worked Ok
QwkNewName = QwkDlDir
strcat QwkNewName ExecMmDd
strcat QwkNewName ".rep"
rename QwkUlName QwkNewName
endif
transmit "^^^"
endif
if not connected
goto lost_it
endif
transmit "^^^" ; go to TOP MENU
waitfor "?=HELP)" 90
if not connected
goto lost_it
endif
;transmit "W" ; do a 'who is on' list
;waitfor "'W' to repeat, Q=quit) ->" 90 ; end of list
;transmit "Q"
;waitfor "?=HELP)" 90
transmit ";"
waitfor "Chain->" 30
transmit "~~g;n^M" ; <G>oodbye, <N>o message
waitfor "click" ; EXEC-PC's disconnection signal
lost_it:
log close ; close the logfile
if connected ; if we're still connected
hangup ; hang up the phone
endif
comment
The following line runs the 'add comment & fix date' program. It uses
the file 'c:\pcplus\download.log' to insert the EXEC-PC file list
description into the comment area of downloaded ZIP files and changes
their date to reflect the latest date of any file within the ZIP.
The 'zipcomdt' program should be accessible through your 'path'.
See the download procedure regarding the download log file.
endcomment
dos "zipcomdt c:\pcplus\download.log" noclear
quit ; exit ProComm Plus, go back to DOS
endproc ; end of the Main procedure
;**********************************************
proc execlogon
start_logon: ; Build a name for the log file: EXECmmdd.LOG
assign s0 "exec"
date s2 ; capture the date as mm/dd/yy
substr s1 s2 0 2 ; extract the month
strcat s0 s1 ; append: execMM
substr s1 s2 3 2 ; extract the day
strcat s0 s1 ; append: execMMDD
strcat s0 ".log" ; append: execMMDD.log
log open s0 ; open (create or append) the logfile
dialexec:
if not fromddir ; if not called via the dialing directory
clear
strfmt S0 "Dialing EXEC-PC at %s on %s" $TIME1 $DATE
message S0
transmit "ATDT~789-4210^M" ; dial EXEC-PC with commands to the modem
waitfor "connect" 60 ; wait 60 seconds for a connection
if not waitfor ; if modem did not return "connect"
hangup
;;;; pause 9900 ; pause for 2 hours & 45 minutes
pause 3600 ; pause for 1 hour
goto dialexec ; try again
endif
endif
if not connected ; if connection was lost
log close ; close the log file
hangup ; hang up the phone
goto start_logon ; try again
endif
if not fromddir ; if not originated from the dialing directory
waitfor "What is your FIRST name ->" 90
transmit "Bruce^M"
waitfor "What is your LAST name ->" 90
transmit "Clawson^M"
waitfor "Password ->" 90
transmit "hoosierknights;Q^M" ; go directly to the top menu
waitfor "?=HELP)" 90 ; wait for top command
if not connected ; if connection was lost
log close ; close the logfile
hangup ; hang up the phone
goto start_logon ; start over again
endif ; (if not connected)
endif ; (if not fromddir)
endproc
;**********************************************
proc newfiles ; list new files since last call
strparm filearea ; file area to list (A/B/C/D/etc)
string request = "~~f;?^M" ; Files/area
strupdt request filearea 4 1 ; plug file area in place of ?
transmit ";"
waitfor "Chain->" 90
transmit request ; go to file area
waitquiet 10 forever ; wait for prompt
transmit "n" ; get new files
waitquiet 10 forever ; wait for end of list
pause 2
transmit "^^^" ; go to top menu
waitfor "?=HELP)" 15
endproc ; end of 'newfiles' procedure
;**********************************************
proc download ; download a list of files
strparm filearea ; file area to download
string filename = "c:\pcplus\download\execfile." ; name of the file
string request = "~~f;" ; Files
string dlstat ; status from WaitForIt
integer count1 = 0 ; current file count
integer count2 = 0 ; cumulative file count
integer endoffile = 0 ; end of input file = 1
strcat filename filearea ; add file area to file name
isfile filename ; does the file exist?
if not success
goto exitdlproc ; no, exit the procedure
endif
find filearea "zz"
if found
strcat request "z;" ; switch to cd-rom collections
strcat request filearea 1 ; file area designation
strcat request "^M"
else
strcat request filearea 1
strcat request "^M"
endif
dlagain:
if not connected ; if we lost our connection
call execlogon ; dial and log on
endif
transmit ";"
waitfor "Chain->" 90
transmit request ; log into the proper file area
waitfor "?=HELP)" 90 ; wait for top command
call waitforit with &dlstat
strcmp dlstat "OK"
if failure
goto dlagain
endif
morefiles:
fopen 0 filename "rt" ; open the file as read/text
transmit "D" ; (D) is for (D)ownload
waitfor "from the BBS ->"
call waitforit with &dlstat
strcmp dlstat "OK"
if failure
goto dlagain
endif
count1 = 0
if count2 > 0
for count1 upto count2
fgets 0 s0 ; read up to where we left off
endfor
count1 = 0
endif
dl_read:
fgets 0 s0 ; read a record
if eof 0 ; was end-of-file encountered?
endoffile = 1 ; set switch
goto end_dl_file ; yes, quit this loop
endif
inc count1
call pullfilename with s0 &s1 ; pull out the filename
strcat s1 "^M" ; append a CR
transmit s1 ; transmit the filename/CR
waitfor "from the BBS ->" 45
call waitforit with &dlstat
strcmp dlstat "OK"
if failure
goto dlagain
endif
if count1 == MaxDlCount
goto end_dl_file
endif
goto dl_read
end_dl_file:
fclose 0 ; close the file
transmit "^M" ; no more files to download
waitfor "OK? (YNG) ->" 15
call waitforit with &dlstat
strcmp dlstat "OK"
if failure
message "^M^J!! Failure in DownLoad proc !!^M^J"
transmit "Q" ; go to top menu
waitfor "?=HELP)" 90
goto exitdlproc
endif
transmit "Y" ; Yes, do Zmodem transfer
; At this point, ProComm Plus detects the Zmodem signal and begins reception
waitquiet 30 forever ; wait for silence (downloads are complete)
if not connected ; if connection was lost
goto dlagain ; start over again
endif
if endoffile == 0 ; if we're not finished
count2 = count2 + MaxDlCount
goto morefiles
endif
; Now we're going to add the list of downloaded files to the download log.
; It's a handy way to remember what files we've downloaded.
fopen 0 filename "rt" ; open the download file as read/text
isfile DownLog ; does the logfile already exist?
if success
fopen 1 DownLog "at" ; yes, open in append mode
else
fopen 1 DownLog "wt" ; no, open in write mode
endif
add_to_log:
fgets 0 s0 ; read a record from EXECFILE.?
if eof 0 ; if end-of-file,
goto end_log_add ; get out
endif
strlen s0 n0 ; get length of input record
substr s2 s0 1 1 ; pull out the second byte
strcmp s2 " " 1 ; compare to space
if success
n0 = n0 - 2 ; decrease length by two bytes
substr s1 s0 2 n0 ; new EXEC-PC display format
else
substr s1 s0 0 n0 ; old EXEC-PC display format
endif
fputs 1 s1 ; write the record to DOWNLOAD.LOG
goto add_to_log
end_log_add: ; finished adding to download.log
fclose 0 ; close EXECFILE.?
fclose 1 ; close DOWNLOAD.LOG
delete filename ; delete EXECFILE.?
transmit "Q" ; go to top menu
waitfor "?=HELP)" 90
exitdlproc:
return ; exit the procedure
endproc ; end of 'download' procedure
;**********************************************
proc extrainf ; do an 'extra' on each file name in a list
strparm filearea ; file area to access
string filename = "c:\pcplus\download\execextr." ; name of list file
string request = "~~f;" ; Files
string extrstat ; status from WaitForIt
strcat filename filearea ; add file area to file name
isfile filename ; does the file exist?
if not success
goto exit_extra ; no, skip this procedure
endif
find filearea "zz"
if found
strcat request "z;" ; switch to cd-rom collections
strcat request filearea 1 ; file area designation
strcat request "^M"
else
strcat request filearea 1
strcat request "^M"
endif
extragain:
transmit ";"
waitfor "Chain->" 90
transmit request ; log into the proper file area
waitfor "?=HELP)" 90 ; wait for top command
call waitforit with &extrstat
strcmp extrstat "OK"
if failure
goto extragain
endif
transmit "E" ; (E) is for (E)xtra information
waitfor " ->"
call waitforit with &extrstat
strcmp extrstat "OK"
if failure
goto extragain
endif
fopen 0 filename "rt" ; open the file as read/text
extra_read:
fgets 0 s0 ; read a record
if eof 0 ; was end-of-file encountered?
goto end_extra_file ; yes, exit the procedure
endif
call pullfilename with s0 &s1 ; pull out the filename
strcat s1 "^M" ; append a CR
transmit s1 ; transmit the filename/CR
waitquiet 10 forever ; wait forever for 10 seconds of quiet
goto extra_read
end_extra_file:
fclose 0
transmit "^M" ; quit the (E)xtra area
waitfor "?=HELP)" 15 ; wait for top command
if waitfor
delete filename ; delete the access-request file
endif
transmit "^^^" ; go to top menu
waitfor "?=HELP)" 90
exit_extra:
return ; exit the procedure
endproc ; end of 'extra' procedure
;**********************************************
proc accesser ; do an 'access' on each file name in a list
strparm filearea ; file area to access
string filename = "c:\pcplus\download\execaccs." ; name of list file
string request = "~~f;" ; Files
string accstat ; status from WaitForIt
strcat filename filearea ; add file area to file name
isfile filename ; does the file exist?
if not success
goto exit_access ; no, skip this procedure
endif
find filearea "zz"
if found
strcat request "z;" ; switch to cd-rom collections
strcat request filearea 1 ; file area designation
strcat request "^M"
else
strcat request filearea 1
strcat request "^M"
endif
accagain:
transmit ";"
waitfor "Chain->" 90
transmit request ; log into the proper file area
waitfor "?=HELP)" 90 ; wait for top command
call waitforit with &accstat
strcmp accstat "OK"
if failure
goto accagain
endif
fopen 0 filename "rt" ; open the file as read/text
access_read:
fgets 0 s0 ; read a record
if eof 0 ; was end-of-file encountered?
goto end_acc_file ; yes, exit the procedure
endif
call pullfilename with s0 &s1 ; pull out the filename
strcat s1 "^M" ; append a CR
transmit "A" ; (A) is for (A)ccess
waitfor " ->"
call waitforit with &accstat
strcmp accstat "OK"
if failure
goto accagain
endif
transmit s1 ; transmit the filename/CR
when 2 "RETURN to quit) ->" transmit "^M" ; if filename was not found
waitquiet 10 forever ; wait forever for 10 seconds of quiet
cwhen 2 ; clear when/2
goto access_read
end_acc_file:
fclose 0
transmit "Q" ; quit the (A)ccess area
waitfor "?=HELP)" 15 ; wait for top command
if waitfor
delete filename ; delete the access-request file
endif
transmit "^^^" ; go to top menu
waitfor "?=HELP)" 90
exit_access:
return ; exit the procedure
endproc ; end of 'accesser' procedure
;**********************************************
proc waitforit
strparm status ; status of waitfor: OK or NG
status = "OK"
if not waitfor ; if we got lost
status = "NG"
transmit "^^^"
waitfor "?=HELP)" 90 ; wait for top command
if not waitfor ; if we lost our connection
call execlogon ; dial and log on
endif
endif
return
endproc
;**********************************************
proc pullfilename ; extract the filename from the input record
strparm record ; record from input file
strparm filename ; extracted filename
string temp
substr temp record 1 1 ; pull out the second byte
strcmp temp " " 1 ; compare to space
if success
substr filename record 2 12 ; new EXEC-PC display format
else
substr filename record 0 12 ; old EXEC-PC display format
endif
return
endproc
comment
****************************************************************************
If you find this script useful, please let me know. If you make
improvements to it, definitely let me know. I have tried to think of
everything but that is, of course, impossible. Even if you try this
script and don't like it, I would appreciate hearing about it. All
comments are welcome. Over 400 people have downloaded my first two
DOS scripts and I got one response. Oh, well.
Bruce Clawson - Wauwatosa, WI (USA)
****************************************************************************
endcomment