home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbutil.zip / DPHONE.CMD < prev    next >
OS/2 REXX Batch file  |  1987-02-14  |  6KB  |  207 lines

  1. *** dPhone.prg
  2. *
  3. *** Simple phone directory and auto-dialer
  4. *
  5. *   Uses MODE to redirect printer output to serial port.
  6. *   dBase II version 2.4 / Hayes modem
  7. *
  8. *** Tom Poindexter, April 1983
  9. *
  10. *** To create dBase file:
  11. *   A>dbase
  12. *   . create dphone
  13. *   name,c,25
  14. *   number,c,25
  15. *   [blank line]
  16. *   . copy to dphone.str structure extended
  17. *   . quit
  18. *
  19. *** To create batch file:
  20. *   A>copy con: dphone.bat
  21. *   echo off                 ....Stand by, preparing phone directory....
  22. *   mode com1:1200,n,8,1 >nul:
  23. *   mode lpt1:=com1      >nul:
  24. *   dbase dphone.prg
  25. *   mode lpt1:80,6       >nul:
  26. *   [F6]
  27. *
  28. *** Hayes modem must have switch # 6 in the DOWN position
  29. *   (Carrier Detect always true) so that MODE won't time-out.  This
  30. *   maybe incompatible with some communication software (particularly
  31. *   Crosstalk) which requires the actual state of the carrier signal.
  32. *   Anyone have a patch to MODE that ignores the carrier detect???
  33. *
  34. *   This is setup to dial touch-tone.  If you have pulse dialing,
  35. *   change the dialing string in the variable 'dialcode'.
  36. *
  37. clear
  38. set colon off
  39. set talk off
  40. set echo off
  41. set print off
  42. set exact off
  43. if .not. file('dphone.dbf')
  44.   create dphone from dphone.str
  45.   use dphone
  46.   index on name to dphone
  47. endif
  48. if .not. file('dphone.ndx')
  49.   use dphone
  50.   index on name to dphone
  51. endif
  52. use dphone index dphone
  53. store 'ATDT' to dialcode
  54. store 'ATH0' to hangcode
  55. store f to dialed
  56. store f to done
  57. do while .not. done
  58.   erase
  59.   ? '                                     dPhone'
  60.   ? '                               Dialing Directory'
  61.   ?
  62.   ?
  63.   ? '                            1 - Add to directory'
  64.   ?
  65.   ? '                            2 - Edit directory'
  66.   ?
  67.   ? '                            3 - List and/or Dial a number'
  68.   ?
  69.   ? '                            4 - Hang up phone'
  70.   ?
  71.   ? '                            0 - Exit'
  72.   ?
  73.   ?
  74.   ? '                        Please enter your choice....'
  75.   store ' ' to ans
  76.   do while ans = ' '
  77.   set console off
  78.   wait to ans
  79.   set console on
  80.   do case
  81.     case ans = '1'
  82.       append
  83.     case ans = '2'
  84.       erase
  85.       ? '------- Edit Usage -------'
  86.       ?
  87.       ? 'Press   Function'
  88.       ? '------  ------------------'
  89.       ? 'Ctrl-W  Exit edit'
  90.       ? 'Ctrl-Q  Quit edit, no save'
  91.       ? 'Ctrl-U  Delete a record'
  92.       ? 'Ctrl-R  Move up one line'
  93.       ? 'Ctrl-C  Move down one line'
  94.       ?
  95.       ? '   Press any key to begin edit...'
  96.       set console off
  97.       wait
  98.       set console on
  99.       goto top
  100.       browse
  101.     case ans = '3'
  102.       erase
  103.       store ' ' to search
  104.       accept 'Enter full or partial name ' to search
  105.       if search = ' '
  106.         goto top
  107.       else
  108.         find &search
  109.         if # = 0
  110.           goto top
  111.         endif
  112.       endif
  113.       store 0 to recnum
  114.       store t to cont
  115.       do while cont
  116.         erase
  117.         store 1 to i
  118.         ? 'Rec # Name                      Phone Number'
  119.         ? '----- ------------------------- --------------------------'
  120.         do while i < 20 .and. .not. eof
  121.           store # to x
  122.           store str(x,5) to char
  123.           store i+1 to i
  124.           ? char+' '+name+' '+number
  125.           skip 1
  126.         enddo
  127.         ?
  128.         ? 'Enter the record number to dial, 0 to quit scan, or blank for more '
  129.         store ' ' to in
  130.         accept to in
  131.         if in = ' '
  132.           if eof
  133.            goto top
  134.            store f to cont
  135.           endif
  136.         else
  137.           store val(in) to recnum
  138.           if recnum > 0
  139.             goto recnum
  140.             store f to cont
  141.             erase
  142.             ? 'Dialing - '+name
  143.             set console off
  144.             set print on
  145.             ? dialcode+number
  146.             ?
  147.             set print off
  148.             set console on
  149.             ?
  150.             ? '       Pick up your phone!!'
  151.             store t to dialed
  152.             store 0 to i
  153.             do while i < 75
  154.               store i+1 to i
  155.             enddo
  156.           else
  157.             goto top
  158.             store f to cont
  159.           endif
  160.         endif
  161.       enddo
  162.    case ans = '4'
  163.       set console off
  164.       set print on
  165.       ? hangcode
  166.       ?
  167.       set print off
  168.       set console on
  169.    case ans = '0'
  170.       store '*' to ans
  171.       store t to done
  172.       ?
  173.       ?
  174.       ? '  Please wait.....'
  175.    otherwise
  176.       ?? chr(7)+chr(8)
  177.       store ' ' to ans
  178.    endcase
  179.   enddo
  180. enddo
  181. pack
  182. use
  183. erase
  184. if dialed
  185.   set console off
  186.   set print on
  187.   ? hangcode
  188.   ?
  189. endif
  190. set print off
  191. erase
  192. quit
  193. * *********************************************************************
  194. * *********************************************************************
  195. * *********************************************************************
  196. * *********************************************************************
  197. * *********************************************************************
  198. * *********************************************************************
  199. * *********************************************************************
  200. * *********************************************************************
  201. * *********************************************************************
  202. * *********************************************************************
  203. * *********************************************************************
  204. * end of dphone.prg
  205. **********************************************
  206. * end of dphone.prg
  207.