home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 4: Phase Four / 17Bit_Phase_Four.iso / files / 3291.dms / 3291.adf / Rexx / DoCall.dfa < prev    next >
Encoding:
Text File  |  1994-08-16  |  4.2 KB  |  157 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Dirk Federlein
  4. **
  5. ** File             : Work:Programming/dfa/rexx/DoCall.rexx
  6. ** Created on       : Monday, 02.08.93 21:13:43
  7. ** Created by       : Dirk Federlein
  8. ** Current revision : V1.1
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **   - Dial script for DFA
  14. **
  15. ** Revision V1.1
  16. ** --------------
  17. ** created on Monday, 02.08.93 21:17:19  by  Dirk Federlein.   LogMessage :
  18. **   - Changed the Script by just deleting some parts.
  19. **     Now you can't use it from outside of DFA but only from
  20. **     within DFA, i.e. you have to assign it to a function key.
  21. **
  22. **     Of course it is no longer possible to search through addresses
  23. **     or quit the script _before_ dialing. If you want to use these
  24. **     extended features, please us the original 'Call.rexx' script
  25. **     by F. Pecher!
  26. **
  27. ** Revision V1.0
  28. ** --------------
  29. ** created on Monday, 02.08.93 21:13:43  by  Dirk Federlein.   LogMessage :
  30. **
  31. ** Revision 1.0 from F. Pecher - thanks Frank!
  32. **
  33. **
  34. **
  35. **
  36. **
  37. ** Call.rexx                                  by Frank Pecher
  38. **
  39. ** Call a person with DFA
  40. **
  41. ** Syntax:
  42. **     Call <First|Name>
  43. **
  44. ** You will be shown the found person and be prompted for dialing, so
  45. ** you can be sure to call the correct number if the same person has
  46. ** more than one phone number.
  47. **     When prompted, you have the following options how to continue:
  48. **     * q(uit)<CR>  don't look for further matches.
  49. **     * n(o)<CR>    find next match.
  50. **     * y(es)<CR>   dial found number
  51. **     This script will take care to dial the numbers as short as
  52. ** possible, so if you call somebody with the same dial prefix, the
  53. ** prefix will not be dialled.
  54. **     See below how to customize this script for your purposes.
  55. **
  56. **  LOCAL DIAL PREFIXES: if these are found in the database, they will
  57. **  be ommited when dialling. EDIT THESE so that they match the codes of
  58. **  your country/region.
  59. **
  60. **  This batch expects phone codes of the form
  61. **
  62. **      +49 (0)7031 278606
  63. **      ^   ^       ^
  64. **      |   |       |
  65. **      |   |       personal phone number
  66. **      |   regional pre-code
  67. **      |   the parentheses around the zero mean that it will be
  68. **      |   omitted when the country precode of the found number
  69. **      |   does not match LOCAL_COUNTRY (see below)
  70. **      |
  71. **      country pre-code; the '+' will be replaced by LOCAL_OUT (see below)
  72. **
  73. **  EXAMPLES:
  74. **      My own settings:    LOCAL_OUT     = "0"
  75. **                          LOCAL_COUNTRY = "+49"
  76. **                          LOCAL_REGION  = "(0)7031"
  77. **                          LOCAL_NUMBER  = "278608"
  78. **
  79. **  *   Found number:       +49 (0)7031 278608
  80. **      Call.rexx dials nothing and displays an error message.
  81. **
  82. **  *   Found number:       +49 (0)7031 12345
  83. **      Call.rexx dials:    12345
  84. **
  85. **  *   Found number:       +49 (0)805  11223
  86. **      Call.rexx dials:    0805 11223
  87. **
  88. **  *   Found number:       +11 (0)321  90807
  89. **      Call.rexx dials:    011 321 90807
  90. **
  91. *********************************************************************************/
  92.  
  93. LOCAL_OUT     = "0"
  94. LOCAL_COUNTRY = "+49"
  95. LOCAL_REGION  = "(0)931"
  96. LOCAL_NUMBER  = "286914"
  97.  
  98.  
  99. parse arg person
  100. person = upper(strip(person))
  101.  
  102. options RESULTS
  103.  
  104. say "Searching..."
  105.  
  106. address "DFA" GetCurrent stem p.
  107.  
  108. do while RC = 0
  109.     Ignore = 0
  110.  
  111.     name = upper(strip(p.address.2))
  112.     first = upper(strip(p.address.1))
  113.     comment = upper(p.address.15)
  114.  
  115.     origphone = p.address.10
  116.     parse var origphone country " " region " " number
  117.     parse var region "(" regopt ")" regcode
  118.  
  119.     if country ~= LOCAL_COUNTRY then
  120.         phone = LOCAL_OUT||strip(country, L, "+")" "regcode" "number
  121.     else
  122.     do
  123.         if region ~= LOCAL_REGION then
  124.             phone = regopt||regcode" "number
  125.         else
  126.         do
  127.             if number ~= LOCAL_NUMBER then
  128.                 phone = number
  129.             else
  130.             do
  131.                 say
  132.                 say "ERROR"
  133.                 say "   Either you were trying to call yourself or"
  134.                 say "   you haven't edited Call.rexx yet."
  135.                 say
  136.  
  137.                 Ignore = 1
  138.             end
  139.         end
  140.     end
  141.  
  142.     if Ignore = 0 then
  143.     do
  144.         /* Set new phone number */
  145.         address "DFA" edit 'phone="'phone'"'
  146.  
  147.         /* Dial new phone number */
  148.         address "DFA" dial
  149.  
  150.         /* Restore original phone number */
  151.         address "DFA" edit 'phone="'origphone'"'
  152.         exit
  153.     end
  154. end
  155.  
  156. exit
  157.