home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Utilities / Scripting Aids & Tips / Phone Stack Scripts / Phone Stack 1.0.1 Script next >
Encoding:
Text File  |  1988-04-06  |  3.0 KB  |  102 lines  |  [TEXT/ttxt]

  1. -- This script is meant to replace the stack script for the Phone stack
  2. -- that comes with version 1.0.1 of HyperCard.  It uses an adaptation of a
  3. -- trick by Daniel J. Rosenbaum that is published in the May 1988 issue
  4. -- of MacUser. It will send a message to your modem to disconnect two
  5. -- seconds after it dials a number, giving control of the phone line
  6. -- back to your phone.  All you have to do is pick up the phone within
  7. -- two seconds, and you’ll be able to hold your conversation.  Just open
  8. -- the stack script for the phone stack (make sure its the old one that
  9. -- doesn’t list local exchanges), select the entire script, and paste this one
  10. -- in.  Dave Fell, 70040,674
  11.  
  12. -- Copyright 1987 Apple Computer Inc.
  13.  
  14.  
  15. on idle
  16.   if the short time ≠ field "loc time" then
  17.     put the short time into field "loc time"
  18.   end if
  19.   pass idle
  20. end idle
  21.  
  22. on openStack
  23.   show message box
  24. end openStack
  25.  
  26. on dial string
  27.   global dialNumber, dialArea
  28.   put string into dialNumber
  29.   if string is empty then exit dial
  30.   
  31.   findAreaCode
  32.   -- sets dialNumber and dialArea
  33.   -- we do not handle international phone numbers correctly
  34.   
  35.   if dialNumber is empty then exit dial
  36.   
  37.   if dialArea contains field "area code"
  38.   then put field "preamble" before dialNumber
  39.   else put field "long dist preamble" & dialArea & " " before dialNumber
  40.   
  41.   put "Now dialing: " & dialNumber
  42.   
  43.   if hilite of button "modem (tone dialing)" is true
  44.   then send "dial " & quote & dialNumber & quote & " with modem " & ¬
  45.   quote & "ATS0=0DT" & quote to HyperCard
  46.   
  47.   if hilite of button "modem (pulse dialing)" is true
  48.   then send "dial " & quote & dialNumber & quote & " with modem " & ¬
  49.   quote & "ATS0=0DP" & quote to HyperCard
  50.   
  51.   if hilite of button "speaker (tone dialing)" is true
  52.   then send "dial " & quote & dialNumber & quote to HyperCard
  53.   
  54.   wait 2 seconds
  55.   send "dial" & quote & empty & quote & "with modem" & quote & ¬
  56.   "+++ATH" & quote to HyperCard
  57.   put empty
  58. end dial
  59.  
  60. on findAreaCode
  61.   global dialArea,dialNumber
  62.   stripNonDigits
  63.   if first char of dialNumber is "1" then
  64.     put empty into char 1 of dialNumber  -- remove "1"
  65.     stripNonDigits
  66.   end if
  67.   
  68.   if first char of dialNumber is "9" and "-, " contains char 2 of dialNumber then
  69.     put empty into char 1 of dialNumber  -- remove "9"
  70.     stripNonDigits
  71.   end if
  72.   
  73.   get char 2 of dialNumber
  74.   if it is 0 or it is 1 then
  75.     put " " after char 3 of dialNumber
  76.     put first word of dialNumber into dialArea
  77.     put empty into first word of dialNumber
  78.     stripNonDigits
  79.   else put field "area code" into dialArea
  80.   
  81.   stripTrailer
  82. end findAreaCode
  83.  
  84. on stripNonDigits
  85.   global dialNumber
  86.   repeat for the length of dialNumber
  87.     get first char of dialNumber
  88.     if it is in "0123456789" then exit stripNonDigits
  89.     put empty into first char of dialNumber
  90.   end repeat
  91. end stripNonDigits
  92.  
  93. on stripTrailer
  94.   global dialNumber
  95.   repeat for the length of dialNumber
  96.     get last char of dialNumber
  97.     if it is in "0123456789#*ABCD" then exit stripTrailer
  98.     put empty into last char of dialNumber
  99.   end repeat
  100. end stripTrailer
  101.  
  102.