home *** CD-ROM | disk | FTP | other *** search
- /*
- DCDD.rexx 930825.2308
-
-
-
- DIRECT_CONNECT_DEMON DIALER - Version 1.8
-
-
- Use with Arexx Version 1.1 or better, BaudBandit 1.5 or better.
-
- Jerry Smith - Fresno, CA. Contact BBS: F.A.A.X. (209) 226-7162
-
- Not copyrighted, fully in the public domain.
- Various bits and pieces lifted from other PD ARexx programs.
-
- I would like to give special thanks to the following people:
-
- Dave Mullenix for his GREAT series of ARexx programs for dialing PC
- Pursuit. (Many of who's ideas are incorporated here)
-
- Darcy McConnell for the use of his BBS for tests, tests, tests, etc....
-
- Richard Stockton for his help with the Arexx and BaudBandit.
-
- My Wife and Best Friend (Diane) for her help, warmth and understanding.
-
- */
-
-
- OPTIONS RESULTS
-
- address BAUD
-
- parse arg filename
-
- TRUE = (1=1)
- FALSE = ~ TRUE
- EXIT_TIMER = 0
-
- if filename = '' then
- DCDDPhone="DCDD"
- else
- DCDDPhone=filename
-
-
- /* SHIFT F10 will stop this script before the next BBS is dialed
- or break you out of a "stuck BBS" */
-
- FKEY 'S10 \Mzap.continue.rexx'
-
- /* GENERAL BAUDBANDIT SETTINGS BELOW */
-
- mask on /* turns on mask */
-
- set F /* blanks screen w/form feed */
-
- set 8N1 /* set modem to 8N1 */
-
- set A /* set default to Z modem (auto DL) */
-
- Auto OFF
-
- Popup OFF /* You MUST have this in your default config or else have the
- Phone Book screen getting in you way. (see DCDD.doc) */
-
- screen off /* allows CON screen to come to the front */
-
- Data 'RAM:-DL' /* set up default download area for downloaded files */
-
-
- /* * * * * * * * * * * * * * * * * * * *
- * * * Open a full sized window * * *
- * * * * * * * * * * * * * * * * * * * */
-
-
- windev = "CON:1/11/640/189/ Direct Connect Demon Dialer . . . . . . . . . . . . phonebook "DCDDPhone
-
- if ~open('wind',windev) then exit /* Window for all activity */
-
- NoError = 0
- NoTimeout = 0
-
- maxnumbers = 80 /* maximum number of entries in phonebook */
-
- call ReadPhoneBk
- call GetTotTime
-
- temp= 'Hours used in' date(m)':' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
- call wsaych(temp)
- call wsay(' Select BBS(s):')
-
- BBSelections = readln('wind')
-
- screen on /* turns BaudBandit screen on */
- send '\U' /* brings BaudBandit screen to the front - here and now!
- The one in the main loop will bring the screen to the front
- when a BBS is connected. */
-
-
- /* below allows you to enter an "A" as the first character in your BBSelections
- to activate the AUTO function in Do_WHOEVER.rexx scripts.
-
- See Do_FAAX.rexx for an example..... */
-
- parse var BBSelections AUTO 2 .
-
- if upper(AUTO) = 'A' then do
- address command 'makedir RAM:AUTO'
- msg '********** -------------------- **********'
- msg '********** AUTO PROCESS STARTED **********'
- msg '********** -------------------- **********'
- call delay(100)
- end
-
- /* below allows BBS number(s) separated by ,./;:\|+-*# or space(s) */
- y=translate(BBSelections,' ',',Aa./;:\|=+_*#')
-
- bbs2call=0
- do i = 1 to bbsnums
- parse var y first y
- bbs2call=bbs2call+1
- bbs.i = first
- if first == '' then leave /* breaks out of DO FOREVER loop */
- end
-
- bbs2call=bbs2call-1
- msg ' '
- msg bbs2call 'Selected BBSes to be Called'
- msg_x_flag = ' '
-
- do z=1 to bbs2call
- t=bbs.z
- msg_x = ' '
- do /* below tests for AREXX SCRIPT in BBS for AUTO process */
- if UPPER(AUTO) = 'A' then do
- if bbs.t.script = ' ' then do
- msg_x = '****** MISSING AREXX SCRIPT ******'
- msg_x_flag = 'bad'
- end
- end
- end
- msg z':' bbs.t.name ' ' msg_x
- end
-
- if msg_x_flag = 'bad' then do
- bbs2call = 0
- msg ' '
- msg ' '
- msg '****** AUTO PROCESS ERROR - MISSING AREXX SCRIPT ******'
- msg ' '
- msg '10'
- call delay(50)
- msg ' 9'
- call delay(50)
- msg ' 8'
- call delay(50)
- msg ' 7'
- call delay(50)
- msg ' 6'
- call delay(50)
- msg ' 5'
- call delay(50)
- msg ' 4'
- call delay(50)
- msg ' 3'
- call delay(50)
- msg ' 2'
- call delay(50)
- msg ' 1'
- call delay(50)
- end
-
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * Main Loop *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-
- listindex=1 ;
- do while bbs2call ~= 0
-
- indx = bbs.listindex
-
- msg ''
- if upper(AUTO) = 'A' then
- msg 'AUTO >> Dialing:' bbs.indx.name
- else
- msg 'Dialing:' bbs.indx.name
-
- bbsconnect = false
- nresult = ' '
-
- call at_codes /* send AT codes to modem for selected BBS. This is VERY
- useful when using a SupraFAXmodem V32.bis at 14.4 */
-
- if CallBBS(bbs.indx.phone) = NoTimeout then do
- if pos('CARRIER',nresult) = 1 then do
-
- call time(R)
-
- dateYYYYMM=left(date(sorted),6)
- dateYYMMDD=right(date(sorted),6)
- timea=translate(time(n),' ',':')
- parse value timea with timeHH timeMM timeSS .
- timeHHMM=timeHH||timeMM
-
- beep
-
- send '\u' /* (pull screen to front when bbs connected)
- You may or may not want to use this here. */
-
- /* Capt "RAM:-dl below puts all Capture Logs in to this dir */
-
- if bbs.indx.captitle ~= '' then
- Capt 'RAM:-dl/'bbs.indx.captitle'.'dateYYMMDD'.'timeHHMM'.1'
-
- /* above gives you files like OLD_DOC.930719.1718.1 - Had to add time so
- that files opened up on RAM:-dl would not duplicate files in DH1:-dl
- when they are transfered after logging out of a BBS. Really do need to
- download into RAM when doing V32.bis 14.4 with a 68000 native CPU. */
-
- if bbs.indx.script ~= '' then do
- title = bbs.indx.script
- msg 'Starting Arexx Script: ' title
- interpret 'call' title
- end
-
- call DoPairs
-
- call wait4disconnect
-
- Capture OFF
-
- /* items below copy ALL data in RAM:-dl to DH1:-dl
- and then clears RAM:-dl for the next BBS called.
-
- At the end of a days BBSing I create a file called DH1:-dl-YYMMDD
- and copy the contents of DH1:-dl into it and then clear DH1:-dl
- for the next days activity. */
-
- /* BE SURE DH1: has room for the files you DL!!!!!!!!!!!!!!!!! */
-
- address command 'copy RAM:-dl/#? DH1:-dl'
- address command 'delete RAM:-dl/#?'
-
- call removebbs /* remove bbs from selection group */
-
- end
-
- send '\d' /* drop DTR */
- send '\ah' /* hangs up modem */
-
- call selectnextbbs /* select next bbs from selection group */
-
- end
-
- call CONTINUE_TEST /* test for ram:continue as flag to continue or quit*/
-
- if listindex > bbs2call then
- listindex = 1
-
- end
-
- /* next two lines force DCDD.rexx to quit */
-
- address command 'delete RAM:continue'
- call CONTINUE_TEST
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * Functions / Subroutines *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-
- Continue_Test:
-
- /* tests for RAM:continue as flag to continue or quit */
-
- if exists('ram:continue')=0 then do
- call delay(50)
- msg ' '
- msg ' '
- msg '**************************************************'
- msg '***** ******'
- msg '***** EXITING * DIRECT CONNECT DEMON DIALER ******'
- msg '***** ******'
- msg '**************************************************'
- capture OFF
- call close('wind')
- send '\d' /* drop DTR */
- send '\ah' /* hangs up modem */
- send '\aq' /* closes BaudBandit */
- exit /* exits Arexx */
- end
- else do
- call delay(10)
- beep
- call delay(10)
- beep
- end
- return
-
-
- AT_codes:
-
- /* sends special AT codes for currently selected BBS to modem */
-
- send 'AT&F2' /* resets modem to factory settings */
- send '\w\r'
- send 'AT&F2' /* resets modem to factory settings 2nd time */
- send '\w\r' /* don't know why it needs it but it do! */
-
- /* W1 below is necessary to set the CARRIER option so that the
- baud rate at connect is captured. */
-
- if bbs.indx.atcodes ~= '' then do
- send 'AT W1 'bbs.indx.atcodes
- send '\w\r'
- msg 'AT codes sent to modem - ' bbs.indx.atcodes
- end
- else do
- send 'AT M W1' /* M = speaker off, W1 = carrier - etc. */
- send '\w\r'
- end
- return
-
-
- Wsay:
-
- /* put string to window with EOL */
-
- parse arg strx
- call writeln('wind',strx)
- return
-
-
- WsayCH:
-
- /* put string to window without EOL */
-
- parse arg strx
- call writech('wind',strx)
- return
-
-
- DoPairs:
-
- /* Have BaudBandit execute script pairs just like in Phonebook */
-
- /* Some BBS software needs an ESCAPE key (or two) to load and this can be
- taken care of using a Script Pair that starts like:
-
- {Escape twice=\w\x1B\w\x1B\w\r}{....then your remaining stuff....
-
- */
-
- if bbs.indx.pair ~= '' then do /* Do optional pairs after connect */
- address BAUD
- pairs bbs.indx.pair
- end
-
- return
-
-
- wait4disconnect:
-
- if upper(AUTO) ~= 'A' then do
- msg ''
- msg '+--------------------------------------+'
- msg ' WAITING FOR 'bbs.indx.name' DISCONNECT '
- msg '+--------------------------------------+'
- end
-
- call delay(150)
-
- do forever
- ADDRESS BAUD
- dcd
-
- /* note: RTEST holds RC value as RC resets after every Arexx command
- is executed. */
-
- RTEST = RC
- if RTEST = 0 then leave /* breaks out of DO FOREVER loop */
- call delay(250) /* 5 second delay for FOREVER loop */
-
- /* below uses shift F10 to get out of a "STUCK BBS".
- this routine also used for Arexx Script failed WAIT LOOP exiting. */
-
- if exists('ram:continue')=0 then do
- msg '****** FORCED BBS LOGOFF BY USER ******'
- address command 'makedir ram:continue'
- call delay(50)
- leave /* breaks out of DO FOREVER loop */
- end
-
- /* NOTE: process below replaced by NESTED DO FOREVER/WAIT LOOPS
- see Do_FAAX.rexx for an example... */
-
- /* below uses RAM:exit_flag to get out of a "STUCK BBS" when
- you are using Arexx scripts for Auto late nite sessions
- and want to be sure of exiting a BBS if they have changed
- things and your script gets "HUNG UP". The EXIT_TIMER will
- be reset to zero if RAM:exit_flag is abscent. */
-
- if exists('ram:exit_flag')=0 then do
- exit_timer = 0
- end
- else do
- exit_timer = exit_timer + 5
- if exit_timer > 300 then do
- msg '****** FORCED LOGOFF BY EXIT_TIMER ******'
- call delay(50)
- address command 'delete ram:EXIT_TIMER'
- leave /* breaks out of DO FOREVER loop */
- end
- end
-
- end
-
- /* below is old OLD way of holding till logged off BBS.
- it had a "BIG" problem with matching text during DL's.
-
- wait 'NO CARRIER'
-
- */
-
- /* Get connection elapsed time from Arexx timer */
-
- timeE=(time(e))
- chours = timeE % 3600
- choursrem = timeE // 3600
- cmins = choursrem % 60
- csecsx = choursrem // 60
- csecs = csecsx % 1
- cTOTAL = right(chours,2,'0')':'right(cmins,2,'0')':'right(csecs,2,'0')
-
- msg 'Updating Total Time'
- discotitle='DCDDdiscos.'dateYYYYMM
- if open('discos',discotitle,'Append') = 0 then /* string for reference */
- call open('discos',discotitle,'Write') /* Append it to monthly file */
- temp = dateYYMMDD timeHHMM cTOTAL bbs.indx.name SPEED
- call writeln('discos',temp)
- call close('discos')
-
- timetitle='DCDDtime.'dateYYYYMM
-
- if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
- thours = 0
- tmins = 0 /* If file doesn't exist, set to zero */
- tsecs = 0
- end
-
- else do
- thours=readln('TotTime') /* If file does exist, read them */
- tmins=readln('TotTime')
- tsecs=readln('TotTime')
- call close('TotTime')
- end
-
- msg 'Monthly total:' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
- msg ' This call:' cTOTAL
- nhours = chours+thours
-
- if csecs > 0 then do /* the Damn phone company rounds */
- cmins = cmins + 1 /* any seconds into a full minute */
- csecs = 0
- end
-
- nmins = cmins+tmins
- nsecs = csecs+tsecs
-
- nmins=nmins+nsecs%60 ; nsecs = nsecs//60
- nhours=nhours+nmins%60 ; nmins = nmins//60
-
- /* If bbs.indx.local = LOCAL do not update TotTime */
-
- if bbs.indx.local = '' then do
-
- call open('TotTime',timetitle,'W')
- call writeln('TotTime', nhours)
- call writeln('TotTime', nmins)
- call writeln('TotTime', nsecs)
- call close('TotTime')
- msg ' --------'
- msg ' New Total:' right(nhours,2,'0')':'right(nmins,2,'0')':'right(nsecs,2,'0')
- end
- else do
- msg 'Local BBS - TotTime not updated'
- end
-
- return
-
-
- removebbs:
-
- /* Done with that bbs, change ALL occurances to "called" in selection group */
-
- do j = 1 to bbs2call
- if bbs.j = indx then do
- bbs.j = 'called'
- end
- end
-
- return
-
-
- selectnextbbs:
-
- /* Select the next available BBS from selection group */
-
- yet2call = 0
- wascalled = 0
-
- do k = 1 to bbs2call
- if bbs.k = 'called' then do
- wascalled = wascalled + 1
- end
- else do
- yet2call = yet2call + 1
- end
- end
-
- if yet2call = 0 then do
- bbs2call = 0
- end
- else do
-
- loopcount = 0
-
- do forever
-
- listindex=listindex + 1
-
- if listindex > bbs2call then
- listindex = 1
- loopcount = loopcount + 1
-
- if bbs.listindex ~= 'called' then
- leave /* breaks out of DO FOREVER loop */
-
-
- if loopcount > 2 then do
- msg '****** loopcount > 2 ******'
- bbs2call = 0
- leave /* breaks out of DO FOREVER loop */
-
- end
-
- end
-
- livecount = 0
-
- if yet2call ~= 0 or exists('ram:continue')=0 then do
- msg ' '
- msg yet2call ' BBSes yet to be called'
- do z=1 to bbs2call
- t=bbs.z
- if bbs.z ~= 'called' then do
- livecount = livecount + 1
- msg livecount ':' bbs.t.name
- end
- end
- end
- end
-
- return
-
-
- CallBBS:
-
- /* Dial Selected BBS */
-
- arg number
- call delay(25)
- timeout 120 /* wait continues if no connectstring within 2 minutes */
- send 'ATDT'number'\r'
- call shownotes
- connectstring='CARRIER 14400,CARRIER 12000,CARRIER 9600,CARRIER 7200,CARRIER 2400,BUSY,OK,NO CARRIER,NO DIALTONE'
- wait connectstring
- NRC = RC
- NRESULT = RESULT
- parse value NRESULT with AAA SPEED .
-
- /* SPEED above used to capture arbitated carrier connect speed */
-
- /* msg 'CALLBBS: nresult = ' nresult ' NRC = ' NRC */
-
- return NRC
-
-
- shownotes:
-
- /* Show BBS notes if present */
-
- if bbs.indx.notenum > 0 then do
- msg 'Notes for' bbs.indx.name':'
- do notex = 1 to bbs.indx.notenum
- msg bbs.indx.notes.notex
- end
- end
-
- else do
- msg 'No notes for' bbs.indx.name
- end
- msg ' '
- return
-
-
- GetTotTime:
-
- /* gets total time for the month */
-
- timetitle='DCDDtime.'left(date('S'),6) /* DCDDtime.YYYYMM */
- if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
- thours = 0
- tmins = 0 /* If file doesn't exist, set to zero */
- tsecs = 0
- end
-
- else do
- thours=readln('TotTime') /* If file does exist, read them */
- tmins=readln('TotTime')
- tsecs=readln('TotTime')
- call close('TotTime')
- end
- return
-
-
- ReadPhoneBk:
-
- /* Read Phone Book into Arexx array */
-
- call open('PhoDir','Bandit.'DCDDPhone,'r')
-
- bbsnums = 0 /* Read BBS records */
- inline1=readln('PhoDir')
- do j=1 to maxnumbers until eof('PhoDir')
- bbsnums = bbsnums + 1
- bbs.j.name=strip(readln('PhoDir'))
- bbs.j.phone=strip(readln('PhoDir'))
- bbs.j.local=strip(readln('PhoDir'))
- bbs.j.atcodes=strip(readln('PhoDir'))
- bbs.j.captitle=strip(readln('PhoDir'))
- bbs.j.script=strip(readln('PhoDir'))
- bbs.j.pair=strip(readln('PhoDir'))
-
- /* Read optional notes */
- notex=0 ; inline1=''
- do until inline1 = '-----' | EOF('PhoDir')
- inline1=readln('PhoDir')
- if inline1 ~= '-----' then do
- notex = notex + 1
- bbs.j.notes.notex = inline1
- end
- end
- bbs.j.notenum = notex
-
- /* Print BBS name */
-
- if j//4 ~= 0 then /* allows four across on CON window */
-
- /* I use bbs.j.captitle instead of bbs.j.name below because all my files
- use the same name as my discos and capture files and I only have to
- remember one name. The FULL name is used when you connect to a BBS */
-
- call wsaych(right(j,2,' ')': 'left(bbs.j.captitle,15,' '))
- else
- call wsay(right(j,3,' ')': 'left(bbs.j.captitle,15,' '))
- end
- call close('PhoDir')
-
- bbsnums=bbsnums-1
- if bbsnums//2 = 0 then
- call wsay('')
- return
-