home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / telecomm / misc / dcdd_23.lha / DCDD.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-10-01  |  25.0 KB  |  936 lines

  1.  
  2. /*
  3.   DCDD.rexx                                                      941001.1442
  4.  
  5.  
  6.  
  7.                  DIRECT_CONNECT_DEMON DIALER  -  Version 2.3 
  8.  
  9.  
  10.   Use with Arexx Version 1.1 or better, BaudBandit 1.5 or better.
  11.   
  12.   Jerry Smith - Fresno, CA.             Contact BBS: F.A.A.X. (209) 226-7162
  13.  
  14.                   Internet address: jws@cris.com
  15.  
  16.               Not copyrighted, fully in the public domain.
  17.       Various bits and pieces lifted from other PD ARexx programs.
  18.  
  19.   I would like to give special thanks to the following people:
  20.  
  21.     Dave Mullenix for his GREAT series of ARexx programs for dialing PC 
  22.     Pursuit. (Many of who's ideas are incorporated here)
  23.  
  24.     Darcy McConnell for the use of his BBS for tests, tests, tests, etc....
  25.  
  26.     Richard Stockton for his help with Arexx and BaudBandit.
  27.  
  28.     My Wife and Best Friend (Diane) for her help, warmth and understanding.
  29.  
  30. */
  31.  
  32. OPTIONS RESULTS
  33.  
  34. address BAUD 
  35.  
  36. parse arg filename
  37.  
  38. TRUE = (1=1)
  39. FALSE = ~ TRUE
  40. EXIT_TIMER = 0
  41. SPACER = ' '
  42.  
  43. if filename = '' then
  44.   DCDDPhone="DCDD"
  45. else
  46.   DCDDPhone=filename
  47.  
  48.  
  49. /* SHIFT F10 will stop this script before the next BBS is dialed
  50.              or break you out of a "stuck BBS"                    */
  51.  
  52. FKEY 'S10 \Mzap.continue.rexx' 
  53.  
  54. /* SHIFT F9 will keep any AUTO.rexx from doing an AUTO logout so 
  55.             that other work can be done before you logoff a BBS.  */
  56.  
  57. FKEY 'S9 \Msit_stay.rexx' 
  58.  
  59. /*  GENERAL BAUDBANDIT SETTINGS BELOW                             */
  60.  
  61. mask on     /* turns on mask */
  62.  
  63. /*             mask off */
  64.  
  65. /*             ansi on */ 
  66.  
  67. /*             ansi off */ 
  68.  
  69. set F       /* blanks screen w/form feed                            */  
  70.  
  71. set 8N1     /* set modem to 8N1                                     */  
  72.  
  73. set A       /* set default to Z modem (auto DL)                     */
  74.  
  75. Auto OFF    /* turn Auto_PhoneBook OFF                              */
  76.  
  77. Popup OFF   /* You MUST have this in your default config or else have the
  78.                Phone Book screen getting in you way. (see DCDD.doc) */
  79.  
  80. screen off  /* allows CON screen to come to the front */
  81.  
  82.  
  83. Data 'RAM:-DL'  /* set up default download area for downloaded files */
  84.  
  85.  
  86.                     /* * * * * * * * * * * * * * * * * * * * 
  87.                       * * *  Open a full sized window * * *
  88.                      * * * * * * * * * * * * * * * * * * * */
  89.  
  90.  
  91. windev = "CON:1/11/640/189/ Direct Connect Demon Dialer . . . . . . . . . . . . phonebook "DCDDPhone
  92.  
  93. if ~open('wind',windev) then exit      /* Window for all activity */
  94.  
  95. NoError = 0
  96. NoTimeout = 0
  97.  
  98. maxnumbers = 80  /* maximum number of entries in phonebook */
  99.  
  100. call J_Date /* creates JDATE for testing against julian date computed 
  101.                from YYYYMMDD in the phonebook for display on 80 BBS
  102.                selection screen */
  103.   
  104. call ReadPhoneBk
  105.  
  106. call GetTotTime
  107.  
  108. temp= 'Time Codes used above:  . 30 - 60 = 90 x 365 *'
  109. call wsaych(temp)
  110. call wsay('           Select BBS(s):')
  111.  
  112. BBSelections = readln('wind')
  113.  
  114. screen on  /* turns BaudBandit screen on */
  115. send '\U'  /* brings BaudBandit screen to the front - here and now! 
  116.               The one in the main loop will bring the screen to the front
  117.               when a BBS is connected. */
  118.  
  119.  
  120. /* below allows you to enter an "A" as the first character in your BBS
  121.    selections to activate the AUTO function in Do_WHOEVER.rexx scripts. 
  122.  
  123.    Please note that you can not mix AUTO and MANUAL selections in the same 
  124.    session. I may change this if enough people ask for it. 
  125.  
  126.    See Do_FAAX.rexx for an example..... */
  127.  
  128. parse var BBSelections AUTO 2 .     
  129.  
  130. if upper(AUTO) = 'A' then do
  131.    address command 'makedir RAM:AUTO'
  132.    msg '********** -------------------- **********'
  133.    msg '********** AUTO PROCESS STARTED **********'
  134.    msg '********** -------------------- **********'
  135.    call delay(100)
  136.    end
  137.  
  138. /* below allows BBS number(s) separated by ,./;:\|+-*# or space(s) */
  139. y=translate(BBSelections,' ',',Aa./;:\|=+_*#') 
  140.  
  141. bbs2call=0
  142. do i = 1 to bbsnums
  143.   parse var y first y
  144.   bbs2call=bbs2call+1
  145.   bbs.i = first
  146.   if first == '' then leave  /* breaks out of DO FOREVER loop */
  147. end
  148.  
  149. bbs2call=bbs2call-1
  150. msg ' '
  151. msg bbs2call 'Selected BBSes to be Called'
  152. msg_x_flag = ' '
  153.  
  154. do z=1 to bbs2call
  155.   t=bbs.z
  156.   msg_x = ' ' /* two tests below done only on selected BBSes */
  157.   do    /* below tests for AREXX SCRIPT in BBS for AUTO process */
  158.      if UPPER(AUTO) = 'A' then do 
  159.         if bbs.t.script = ' ' then do
  160.            msg_x = '****** MISSING AREXX SCRIPT ******'
  161.            msg_x_flag = 'bad'
  162.         end
  163.      end
  164.   end 
  165.   do    /* below tests for CAPTURE TITLE in BBS for MANY processes */
  166.      parse var bbs.t.captitle CT_TEST . 
  167.      if CT_TEST = ' ' then do
  168.         msg_x = '****** MISSING CAPTURE TITLE ******'
  169.         msg_x_flag = 'bad'
  170.      end
  171.   end 
  172.  
  173.   msg z':' bbs.t.name '  ' msg_x
  174. end 
  175.  
  176. if msg_x_flag = 'bad' then do
  177.    bbs2call = 0
  178.    msg ' '
  179.    msg ' '
  180.    msg '****** PHONEBOOK ERROR(S) - SEE LIST ABOVE ******'
  181.    msg ' '
  182.    msg '10'
  183.    call delay(50)
  184.    msg '  9'
  185.    call delay(50)
  186.    msg '    8'
  187.    call delay(50)
  188.    msg '       7'
  189.    call delay(50)
  190.    msg '           6'
  191.    call delay(50)
  192.    msg '                5'
  193.    call delay(50)
  194.    msg '                       4'
  195.    call delay(50)
  196.    msg '                                3'
  197.    call delay(50)
  198.    msg '                                           2'
  199.    call delay(50)
  200.    msg '                                                          1'
  201.    call delay(50)
  202. end 
  203.  
  204.  
  205. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  206.  *                                                               *
  207.  *                          Main Loop                            *
  208.  *                                                               *
  209.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  210.  
  211.  
  212. listindex=1 ;
  213. do while bbs2call ~= 0                                        
  214.  
  215.   indx = bbs.listindex
  216.  
  217.   call CONTINUE_TEST
  218.   
  219.   msg ''
  220.   if upper(AUTO) = 'A' then 
  221.      msg 'AUTO >> Dialing:' bbs.indx.name  
  222.   else
  223.      msg 'Dialing:' bbs.indx.name 
  224.  
  225.   bbsconnect = false
  226.   nresult = ' '
  227.  
  228.   call at_codes  /* send AT codes to modem for selected BBS. This is VERY
  229.                     useful when using a SupraFAXmodem V32.bis at 14.4 */ 
  230.  
  231.      Data 'RAM:-DL'  /* set up default download area for downloaded files */
  232.  
  233.      if CallBBS(bbs.indx.phone) = NoTimeout then do      
  234.        if pos('CARRIER',nresult) = 1 then do
  235.                  
  236.          /* next line resets elapsed timer */
  237.  
  238.          call time(R)
  239.    
  240.          timea=translate(time(n),' ',':')              
  241.          parse value timea with timeHH timeMM timeSS .  
  242.          timeHHMM=timeHH||timeMM 
  243.  
  244.          call GetToday
  245.  
  246.          beep 
  247.  
  248.   send '\u' /* (pull screen to front when bbs connected) 
  249.                You may or may not want to use this here. */
  250.  
  251.   parse var bbs.indx.captitle CT PW1 PW2 LD TM MN SPD .
  252.  
  253. /* Capt "RAM:-dl below puts all Capture Logs in to this dir */
  254.  
  255.           if CT ~= '' then                
  256.             Capt 'RAM:-dl/'CT'.'dateYYMMDD'.'timeHHMM'.1'    
  257.  
  258.  /* above gives you files like OLD_DOC.930719.1718.1 - Had to add time so
  259.     that files opened up on RAM:-dl would not duplicate files in DH1:-dl 
  260.     when they are transfered after logging out of a BBS. Really do need to
  261.     download into RAM when doing V32.bis 14.4 with a 68000 native CPU. */
  262.  
  263.           if bbs.indx.script ~= '' then do                    
  264.             parse var bbs.indx.script title Xargs
  265.             msg 'Starting Arexx Script: ' title
  266.  
  267.             if PW1 = ' ' then PW1 = 'NO_PW_1'
  268.             if PW2 = ' ' then PW2 = 'NO_PW_2'
  269.  
  270.             if Xargs = ' ' then Xargs = ' NO_Xargs'
  271.             OUTargs = title||"("PW1||spacer||PW2||Xargs||")"
  272.  
  273.             interpret 'call' OUTargs
  274.           end                                                 
  275.  
  276.           call DoPairs
  277.  
  278.           call wait4disconnect
  279.  
  280.           Capture OFF  
  281.           
  282. /* items below copy ALL data in RAM:-dl to DH1:-dl 
  283.          and then clears RAM:-dl for the next BBS called.
  284.  
  285.    At the end of a days BBSing I create a file called DH1:-dl-YYMMDD
  286.       and copy the contents of DH1:-dl into it and then clear DH1:-dl
  287.       for the next days activity. */
  288.  
  289. /* BE SURE DH1: has room for the files you DL!!!!!!!!!!!!!!!!! */
  290.  
  291.           address command 'copy RAM:-dl/#? DH1:-dl'
  292.           address command 'delete RAM:-dl/#?'
  293.  
  294.           call removebbs /* remove bbs from selection group */
  295.  
  296.         end
  297.  
  298.         send '\d'   /* drop DTR */
  299.         send '\ah'  /* hangs up modem */
  300.  
  301.         call selectnextbbs /* select next bbs from selection group */
  302.  
  303.         end                                                       
  304.  
  305.   call CONTINUE_TEST  /* test for ram:continue as flag to continue or quit*/
  306.  
  307.   if listindex > bbs2call then 
  308.      listindex = 1
  309.  
  310. end
  311.  
  312. /* next two lines force DCDD.rexx to quit */
  313.  
  314. address command 'delete RAM:continue'    
  315. call CONTINUE_TEST    
  316.  
  317. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  318.  *                                                             *
  319.  *                   Functions / Subroutines                   *
  320.  *                                                             *
  321.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  322.  
  323.  
  324. Continue_Test:
  325.  
  326. /* tests for RAM:continue as flag to continue or quit */
  327.  
  328. if exists('ram:continue')=0 then do
  329.    call delay(50)
  330.    msg ' '
  331.    msg ' '        
  332.    msg '**************************************************'
  333.    msg '*****                                       ******'
  334.    msg '***** EXITING * DIRECT CONNECT DEMON DIALER ******'
  335.    msg '*****                                       ******'
  336.    msg '**************************************************'
  337.    capture OFF  
  338.    call close('wind')
  339.    send '\d'   /* drop DTR */
  340.    send '\ah'  /* hangs up modem */
  341.    send '\aq'  /* closes BaudBandit  */
  342.    exit        /* exits Arexx        */
  343.    end
  344. else do
  345.    call delay(10)
  346.    beep
  347.    call delay(10)
  348.    beep
  349.    end
  350. return
  351.  
  352.  
  353. AT_codes:
  354.  
  355. /* sends special AT codes for currently selected BBS to modem */
  356.  
  357.    send 'AT&F2'  /* resets modem to factory settings          */
  358.    send '\w\r' 
  359.    send 'AT&F2'  /* resets modem to factory settings 2nd time */
  360.    send '\w\r'   /* don't know why it needs it but it do!     */ 
  361.  
  362. /* W1 below is necessary to set the CARRIER option so that the
  363.       baud rate at connect is captured.  */
  364.  
  365.   if bbs.indx.atcodes ~= '' then do 
  366.     send 'AT W1 'bbs.indx.atcodes
  367.     send '\w\r'
  368.     msg 'AT codes sent to modem - ' bbs.indx.atcodes
  369.     end
  370.   else do
  371.     send 'AT M W1'   /* M = speaker off, W1 = carrier - etc. */
  372.     send '\w\r' 
  373.     end
  374. return
  375.  
  376.  
  377. Wsay:
  378.  
  379. /* put string to window with EOL */
  380.  
  381.   parse arg strx   
  382.   call writeln('wind',strx)
  383. return
  384.  
  385.          
  386. WsayCH:
  387.   
  388. /* put string to window without EOL */
  389.  
  390.   parse arg strx   
  391.   call writech('wind',strx)
  392. return
  393.  
  394.          
  395. DoPairs:
  396.  
  397. /* Have BaudBandit execute script pairs just like in Phonebook */
  398.  
  399. /* Some BBS software needs an ESCAPE key (or two) to load and this can be
  400.    taken care of using a Script Pair that starts like:
  401.  
  402.    {Escape twice=\w\x1B\w\x1B\w\r}{....then your remaining stuff....
  403.  
  404. */
  405.  
  406.  if bbs.indx.pair ~= '' then do /* Do optional pairs after connect */
  407.     address BAUD 
  408.     pairs bbs.indx.pair
  409.  end 
  410.  
  411. return
  412.  
  413.  
  414. wait4disconnect:
  415.  
  416. if bbs.indx.script = '' then do                    
  417.   msg ''
  418.   msg '+--------------------------------------+'
  419.   msg '  WAITING FOR 'bbs.indx.name' DISCONNECT '
  420.   msg '+--------------------------------------+'
  421. end
  422.  
  423.   call delay(150) 
  424.  
  425.   do forever
  426.      ADDRESS BAUD
  427.      dcd
  428.  
  429. /*   note: RTEST holds RC value as RC resets after every Arexx command
  430.            is executed. */
  431.  
  432.      RTEST = RC
  433.      if RTEST = 0 then do
  434.         msg '... Dropped Carrier ...'
  435.         leave  /* breaks out of DO FOREVER loop */
  436.      end
  437.      call delay(250)  /* 5 second delay for FOREVER loop */
  438.  
  439. /* below uses shift F10 to get out of a "STUCK BBS". 
  440.    this routine also used for Arexx Script failed WAIT LOOP exiting.
  441.    Please note that this does NOT end the session just current BBS. */
  442.  
  443.       if exists('ram:continue')=0 then do
  444.          msg '****** FORCED BBS LOGOFF BY USER ******'
  445.          address command 'makedir ram:continue'
  446.          call delay(50) 
  447.          leave    /* breaks out of DO FOREVER loop */
  448.       end
  449.  
  450. /* NOTE: process below replaced by NESTED DO FOREVER/WAIT LOOPS 
  451.          see Do_FAAX.rexx for an example... */
  452.  
  453. /* below uses RAM:exit_flag to get out of a "STUCK BBS" when 
  454.    you are using Arexx scripts for Auto late nite sessions
  455.    and want to be sure of exiting a BBS if they have changed
  456.    things and your script gets "HUNG UP". The EXIT_TIMER will
  457.    be reset to zero if RAM:exit_flag is absent.  */
  458.  
  459.  
  460.  
  461.      if exists('ram:exit_flag')=0 then do 
  462.         exit_timer = 0
  463.         end
  464.      else do  
  465.         exit_timer = exit_timer + 5
  466.         if exit_timer > 300 then do 
  467.            msg '****** FORCED LOGOFF BY EXIT_TIMER ******'
  468.            call delay(50) 
  469.            address command 'delete ram:EXIT_TIMER'
  470.            leave     /* breaks out of DO FOREVER loop */
  471.            end
  472.         end
  473.  
  474.   end
  475.  
  476. /*
  477.     below is old OLD way of holding till logged off BBS.
  478.     it had a "BIG" problem with matching text during DL's.
  479.  
  480.     wait 'NO CARRIER'
  481. */
  482.  
  483. /* Get connection elapsed time from Arexx timer */
  484.  
  485.   timeE=(time(e)) 
  486.   chours = timeE % 3600
  487.   choursrem = timeE // 3600
  488.   cmins = choursrem % 60
  489.   csecsx = choursrem // 60
  490.   csecs = csecsx % 1
  491.   cTOTAL = right(chours,2,'0')':'right(cmins,2,'0')':'right(csecs,2,'0')
  492.  
  493.   msg 'Updating Total Time'
  494.  
  495. /* 
  496.    DCDDdiscos file contains information about the BBS Session that just
  497.    ended along with all the previous sessions you want to keep. 
  498.  
  499.    the dateYYMMDD timeHHMM phone connect-time info can be compared to
  500.    your phone bill to make sure you get all the service you pay for.
  501.    this file will grow and grow unless you prune it back.    
  502. */
  503.  
  504.   discotitle='DCDDdiscos'   
  505.   if open('discos',discotitle,'Append') = 0 then  /* append if exists */
  506.      call open('discos',discotitle,'Write')       /* else create file */
  507.  
  508.   temp = dateYYMMDD timeHHMM bbs.indx.phone cTOTAL CT SPEED bbs.indx.name  
  509.   call writeln('discos',temp)
  510.   call close('discos')
  511.  
  512. /* 
  513.    History file added so that this file will (when sorted) give you a
  514.    complete log of sessions on a BBS by BBS basis. this file will 
  515.    grow and grow unless you prune it back.    
  516. */
  517.  
  518.   htitle='DCDDhistory'   
  519.   if open('hist',htitle,'Append') = 0 then  /* append if exists */
  520.      call open('hist',htitle,'Write')       /* else create file */
  521.  
  522.   htemp = CT dateYYMMDD timeHHMM cTOTAL SPEED bbs.indx.name 
  523.   call writeln('hist',htemp)
  524.   call close('hist')
  525.    
  526. /* 
  527.    below reads in the Bandit.'DCDDPhone' file and writes it out to 
  528.    ram:Bandit.'DCDDPhone'. During this process the bbs.j.captitle record
  529.    is updated for the BBS just visited for BBS activity tracking. This
  530.    will be used at the next session to display information on the BBS
  531.    selection screen so that you know how long ago you visited that BBS.
  532.  
  533.    this process also updates the other Bandit.'DCDDPhone' bbs.j.captitle
  534.    records and reformats them as necessary.
  535. */
  536.  
  537.   call open('in1A','Bandit.'DCDDPhone,'r')
  538.   call open('out1A','ram:Bandit.'DCDDPhone,'W')
  539.  
  540.   call J_DATE  /* used to get JDATE at logoff point in BBS session */
  541.  
  542. /* Read BBS PhoneBook records */
  543.   do until EOF('in1A')
  544.     inline1A=readln('in1A')
  545.     if ~ EOF('in1A') then do
  546.       parse var inline1A DASHES 6 .
  547.       if DASHES = '-----' then
  548.         line_cnt = 0
  549.       line_cnt = line_cnt + 1
  550.       if line_cnt = 6 then do
  551.         parse var inline1A CTN PW1N PW2N LDN TMN MNN SPDN .
  552.         if PW1N   = ' ' then PW1N   = 'NO_PW_1'
  553.         if PW2N   = ' ' then PW2N   = 'NO_PW_2'
  554.         if LDN    = ' ' then LDN    = 19780101   /* 19780101 was the first */
  555.         if LDN    = 0   then LDN    = 19780101  /* day of the AMIGA age.  */
  556.         if TMN    = ' ' then TMN    = 0        /* see Arexx "date" docs  */       
  557.         if MNN    = ' ' then MNN    = 0        
  558.         if SPDN   = ' ' then SPDN   = 0
  559.         if CTN = CT then do 
  560.           inline1A = CTN PW1N PW2N dateYYYYMMDD timeHHMM cTOTAL SPEED 
  561.           end
  562.         else do
  563.           inline1A = CTN PW1N PW2N LDN TMN MNN SPDN 
  564.           end
  565.       end /* end for (if line_cnt = 6) */  
  566.       call writeln('out1A', inline1A)
  567.     end /* end for (if ~ EOF) */
  568.   end /* end for (do until EOF) */  
  569.   call close('in1A')
  570.   call close('out1A')
  571.  
  572. /* below copies temporary file from ram back over Bandit.'DCDDPhone' file
  573.    and then deletes it in ram. */
  574.  
  575.   address command 'copy ram:Bandit.#? dh0:DemonDialer'
  576.   address command 'delete ram:Bandit.#?'
  577.  
  578.   call GetTimeTitle
  579.  
  580.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  581.      thours = 0
  582.      tmins = 0                     /* If file doesn't exist, set to zero */
  583.      tsecs = 0
  584.      end
  585.   else do
  586.      thours=readln('TotTime')      /* If file does exist, read them */
  587.      tmins=readln('TotTime')
  588.      tsecs=readln('TotTime')
  589.      call close('TotTime')
  590.      end
  591.  
  592.   msg 'Monthly total:' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
  593.   msg '    This call:' cTOTAL
  594.   nhours = chours+thours
  595.  
  596.   if csecs > 0 then do  /* the Damn phone company rounds  */ 
  597.      cmins = cmins + 1  /* any seconds into a full minute */
  598.      csecs = 0        
  599.   end
  600.     
  601.   nmins = cmins+tmins
  602.   nsecs = csecs+tsecs
  603.  
  604.   nmins=nmins+nsecs%60 ; nsecs = nsecs//60
  605.   nhours=nhours+nmins%60 ; nmins = nmins//60
  606.  
  607.   call open('TotTime',timetitle,'W')
  608.   call writeln('TotTime', nhours)
  609.   call writeln('TotTime', nmins)
  610.   call writeln('TotTime', nsecs)
  611.   call close('TotTime')
  612.   msg '               --------'
  613.  
  614.   msg '    New Total:' right(nhours,2,'0')':'right(nmins,2,'0')':'right(nsecs,2,'0')' by 'TotalBy' for month/year: 'dateMMx'/'dateYYYYx
  615.   msg ' '
  616.  
  617. return
  618.  
  619.  
  620. removebbs:    
  621.  
  622. /* Done with that bbs, change ALL occurances to "called" in selection group */
  623.  
  624.   do j = 1 to bbs2call                  
  625.      if bbs.j = indx then do
  626.         bbs.j = 'called'
  627.      end                     
  628.   end                                   
  629.  
  630. return
  631.  
  632.  
  633. selectnextbbs:    
  634.  
  635. /* Select the next available BBS from selection group */
  636.  
  637.   yet2call = 0
  638.   wascalled = 0
  639.  
  640.   do k = 1 to bbs2call                         
  641.      if bbs.k = 'called' then do        
  642.         wascalled = wascalled + 1
  643.      end                                
  644.      else do                     
  645.         yet2call = yet2call + 1
  646.      end                         
  647.   end                                          
  648.  
  649.   if yet2call = 0 then do              
  650.      bbs2call = 0  
  651.      end                                  
  652.   else do                       
  653.  
  654.      loopcount = 0 
  655.  
  656.         do forever                           
  657.  
  658.         listindex=listindex + 1
  659.  
  660.         if listindex > bbs2call then        
  661.            listindex = 1
  662.            loopcount = loopcount + 1
  663.  
  664.         if bbs.listindex ~= 'called' then
  665.            leave   /* breaks out of DO FOREVER loop */
  666.  
  667.  
  668.         if loopcount > 2 then do  
  669.            msg '****** loopcount > 2 ******'
  670.            bbs2call = 0
  671.            leave   /* breaks out of DO FOREVER loop */
  672.  
  673.         end                       
  674.  
  675.      end                                          
  676.  
  677.      livecount = 0
  678.  
  679.      if yet2call ~= 0 or exists('ram:continue')=0 then do              
  680.         msg ' ' 
  681.         msg yet2call ' BBSes yet to be called'
  682.         do z=1 to bbs2call                            
  683.            t=bbs.z
  684.            if bbs.z ~= 'called' then do       
  685.               livecount = livecount + 1
  686.               msg livecount ':' bbs.t.name
  687.            end                                
  688.         end
  689.       end                                           
  690.   end                           
  691.  
  692. return
  693.  
  694.  
  695. CallBBS:
  696.  
  697. /* Dial Selected BBS */
  698.  
  699.   arg number
  700.   call delay(25)
  701.   timeout 120     /* wait continues if no connectstring within 2 minutes */
  702.   send 'ATDT'number'\r'
  703.   call shownotes
  704.   connectstring='CARRIER 14400,CARRIER 12000,CARRIER 9600,CARRIER 7200,CARRIER 2400,BUSY,OK,NO CARRIER,NO DIALTONE'
  705.   wait connectstring
  706.   NRC = RC
  707.   NRESULT = RESULT
  708.   call delay(50)
  709.   parse value NRESULT with AAA SPEED .
  710.  
  711. /* SPEED above used to capture arbitated carrier connect speed */
  712.  
  713. return NRC
  714.  
  715.  
  716. shownotes:
  717.  
  718. /* Show BBS notes if present */
  719.  
  720.   if bbs.indx.notenum > 0 then do     
  721.     msg 'Notes for' bbs.indx.name':'
  722.     do notex = 1 to bbs.indx.notenum
  723.       msg bbs.indx.notes.notex
  724.     end
  725.   end
  726.  
  727.   else do
  728.      msg 'No notes for' bbs.indx.name
  729.   end
  730.   msg ' '
  731. return
  732.  
  733.  
  734. GetToday:
  735.  
  736.   dateYYYY=left(date(sorted),4)               
  737.   dateYYYYMM=left(date(sorted),6)               
  738.   dateMM=right(dateYYYYMM,2)              
  739.   dateYYMMDD=right(date(sorted),6)              
  740.   dateDD=right(dateYYMMDD,2)              
  741. return
  742.  
  743.  
  744. GetTotTime:
  745.  
  746. /* gets total time for the month */
  747.  
  748.   call GetTimeTitle
  749.  
  750.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  751.     thours = 0
  752.     tmins = 0                     /* If file doesn't exist, set to zero */
  753.     tsecs = 0
  754.   end
  755.  
  756.   else do
  757.     thours=readln('TotTime')      /* If file does exist, read them */
  758.     tmins=readln('TotTime')
  759.     tsecs=readln('TotTime')
  760.     call close('TotTime')
  761.   end
  762. return
  763.  
  764.  
  765. GetTimeTitle:
  766.  
  767.   call GetToday
  768.  
  769. /*
  770.  
  771.    Internet access has been added to DCDD and this has forced me to keep
  772.    monthly time totals for different SERVICES. I am using CRIS for my
  773.    Internet connection, LONGD for my long distance direct dialing, and
  774.    LOCAL for my local BBSes. The totals are controled the same as befor
  775.    by using NewBillDay and NewBillAdj. 
  776.  
  777.    If for instance NewBillDay = 8, and NewBillAdj = MINUS then the monthly
  778.    hours/minutes/seconds total will run from the 8th of one month till the
  779.    7th of the next month to match the way your phone company bills you.
  780.  
  781.    NewBillAdj is used to either put the first few days of this month into
  782.    last months totals (MINUS) or the last few days of this month into next
  783.    month (PLUS). (sort of crazy but it works!) 
  784.  
  785. */
  786.  
  787.  
  788.   parse var bbs.indx.service TotalBy .     
  789.  
  790. /* * * * * *  ************************************************  * * * * * */
  791. /* *********  BE SURE TO PUT THE DATA BELOW INTO DCDDtime.rexx  ********* */
  792. /* * * * * *  ************************************************  * * * * * */
  793.  
  794.   if TotalBy = ' ' then do
  795.      TotalBy = 'LONGD'
  796.      NewBillDay = 08
  797.      NewBillAdj = 'MINUS'
  798.   end 
  799.  
  800.   if TotalBy = 'LONGD' then do
  801.      NewBillDay = 08
  802.      NewBillAdj = 'MINUS'
  803.   end 
  804.  
  805.   if TotalBy = 'CRIS' then do
  806.      NewBillDay = 13
  807.      NewBillAdj = 'MINUS'
  808.   end 
  809.  
  810.   if TotalBy = 'LOCAL' then do
  811.      NewBillDay = 00
  812.      NewBillAdj = 'NONE'
  813.   end 
  814.  
  815. /* * * * * *  ************************************************  * * * * * */
  816. /* *********  BE SURE TO PUT THE DATA ABOVE INTO DCDDtime.rexx  ********* */
  817. /* * * * * *  ************************************************  * * * * * */
  818.  
  819.   dateMMx = dateMM
  820.   dateYYYYx = dateYYYY
  821.  
  822.   if NewBillAdj = "MINUS" then do
  823.      if dateDD < NewBillDay then do
  824.         if dateMM = 01 then do
  825.            dateMMx = 12
  826.            dateYYYYx = dateYYYY - 1
  827.            end
  828.         else do
  829.            dateMMx = dateMM - 1
  830.            if dateMMx < 10 then
  831.               dateMMx = 0||dateMMx
  832.         end
  833.      end
  834.   end
  835.  
  836.   if NewBillAdj = "PLUS" then do
  837.      if dateDD ~ < NewBillDay then do
  838.         if dateMM = 12 then do
  839.            dateMMx = 01
  840.            dateYYYYx = dateYYYY + 1
  841.            end
  842.         else do
  843.            dateMMx = dateMM + 1
  844.            if dateMMx < 10 then
  845.               dateMMx = 0||dateMMx
  846.         end
  847.      end
  848.   end
  849.   timetitle='DCDDtime_'totalby||'_'||dateYYYYx||dateMMx
  850.   dateYYYYMMDDx = dateYYYYx||dateMMx||dateDD 
  851.  
  852.   if NewBillAdj = "NONE" then do
  853.      timetitle='DCDDtime_'totalby||'_'||dateYYYYMM
  854.      dateYYYYMMDDx = dateYYYY||dateMM||dateDD 
  855.      end
  856.   
  857.   return
  858.  
  859.  
  860. J_DATE:
  861.  
  862. dateYYYYMMDD = left(date(sorted),8)
  863. JDATE = date('i',dateYYYYMMDD,'s')
  864.  
  865. return
  866.  
  867. ReadPhoneBk:
  868.  
  869. /* Read Phone Book into Arexx array */
  870.  
  871. call open('PhoDir','Bandit.'DCDDPhone,'r')
  872.  
  873. bbsnums = 0                            /* Read BBS records */
  874. inline1=readln('PhoDir')
  875. do j=1 to maxnumbers until eof('PhoDir')
  876.   bbsnums = bbsnums + 1
  877.   bbs.j.name=strip(readln('PhoDir'))
  878.   bbs.j.phone=strip(readln('PhoDir'))
  879.   bbs.j.service=strip(readln('PhoDir'))
  880.   bbs.j.atcodes=strip(readln('PhoDir'))
  881.   bbs.j.captitle=strip(readln('PhoDir'))
  882.   bbs.j.script=strip(readln('PhoDir'))
  883.   bbs.j.pair=strip(readln('PhoDir'))
  884.  
  885.   /* Read optional notes */
  886.   notex=0 ; inline1=''
  887.   do until inline1 = '-----' | EOF('PhoDir')
  888.     inline1=readln('PhoDir')
  889.     if inline1 ~= '-----' then do
  890.       notex = notex + 1
  891.       bbs.j.notes.notex = inline1
  892.     end
  893.   end
  894.   bbs.j.notenum = notex
  895.  
  896.   /* Print BBS name */
  897.  
  898.   parse var bbs.j.captitle CTN PW1N PW2N LDN TMN MNN SPDN .
  899.  
  900. /* JDATE (below) is from initilization point at start of this session */
  901.  
  902.   if LDN    = ' ' then LDN    = 19780101   /*  19780101 was the first  */
  903.   if LDN    = 0   then LDN    = 19780101  /*  day of the AMIGA era.   */
  904.                                          /*  see Arexx "date" docs   */
  905.  
  906.   JDATEN = date('i',LDN,'s')
  907.  
  908.   JDIFF = JDATE - JDATEN
  909.   JX = '.'
  910.   if jdiff > 030 then JX = '-'
  911.   if jdiff > 060 then JX = '='
  912.   if jdiff > 090 then JX = 'x'
  913.   if jdiff > 365 then JX = '*'
  914.  
  915.   if j//4 ~= 0 then do /* allows four across on CON window */
  916.  
  917. /*
  918.    I use bbs.j.captitle instead of bbs.j.name below because all my files 
  919.    use the same name as my discos and capture files and I only have to 
  920.    remember one name. The FULL name is used when you connect to a BBS
  921. */
  922.  
  923.  
  924.     call wsaych(right(j,2,' ') JX left(CTN,14,' '))
  925.     end
  926.   else
  927.     call wsay(right(j,3,' ') JX left(CTN,14,' '))
  928. end  
  929. call close('PhoDir')
  930.  
  931. bbsnums=bbsnums-1
  932. if bbsnums//2 = 0 then 
  933.   call wsay('')
  934. return
  935.  
  936.