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.1 Script < prev   
Encoding:
Text File  |  1988-04-06  |  3.2 KB  |  103 lines  |  [TEXT/ttxt]

  1. -- This script is meant to replace the stack script for the Phone stack
  2. -- that comes with version 1.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 new one that
  9. -- lists local exchanges), select the entire script, and paste this one
  10. -- in.  Dave Fell, 70040,674
  11.  
  12.  
  13. -- Copyright 1987 Apple Computer, Inc.
  14.  
  15. on idle
  16.   if the short time ≠ field "loc time"
  17.   then put the short time into field "loc time"
  18.   pass idle
  19. end idle
  20.  
  21. on openStack
  22.   show message box
  23. end openStack
  24.  
  25. on dial string
  26.   global dialNumber
  27.   put string into dialNumber
  28.   stripNonDials
  29.   if dialNumber is empty then exit dial
  30.   put the length of dialNumber into dialLength
  31.   
  32.   if dialLength < 7 then
  33.     doDial bkgnd field preamble & dialNumber
  34.     
  35.   else if dialLength = 7 then
  36.     put char 1 to 3 of dialNumber into prefix
  37.     repeat with index = 1 to number of words in field "Local Prefixes"
  38.       if word index of field "Local Prefixes" is prefix then
  39.         doDial field preamble & dialNumber
  40.         exit dial
  41.       end if
  42.     end repeat
  43.     answer "Is this a local (non-toll) call?" with No or Yes
  44.     if it is "Yes" then
  45.       put prefix & space after field "Local Prefixes"
  46.       doDial field preamble & dialNumber
  47.     else doDial field preamble & field "toll prefix" & dialNumber
  48.     
  49.   else if dialLength = 8 then
  50.     if offset(field "toll prefix", dialNumber) is 1 then
  51.       doDial field preamble & dialNumber
  52.     else put "This doesn't look like a valid number."
  53.     
  54.   else if dialLength ≥ 9 then dialLD
  55. end dial
  56.  
  57. on dialLD
  58.   global dialNumber
  59.   if offset(field "long dist preamble", dialNumber) is 1 then
  60.     repeat for the length of field "long dist preamble"
  61.       delete char 1 of dialNumber
  62.     end repeat
  63.   end if
  64.   if offset(field "area code", dialNumber) is 1 then
  65.     repeat for the length of field "area code"
  66.       delete char 1 of dialNumber
  67.     end repeat
  68.     dial dialNumber
  69.     exit dialLD
  70.   end if
  71.   Dodial field preamble & field "long dist preamble" & dialNumber
  72. end dialLD
  73.  
  74. on doDial dialNumber
  75.   put "Now dialing: " & dialNumber
  76.   
  77.   if hilite of bkgnd button "modem (tone dialing)"
  78.   then send "dial" && quote & dialNumber & quote && "with modem" && ¬
  79.   quote & "ATS0=0DT" & quote to HyperCard
  80.   
  81.   if hilite of bkgnd button "modem (pulse dialing)"
  82.   then send "dial" && quote & dialNumber & quote && "with modem" && ¬
  83.   quote & "ATS0=0DP" & quote to HyperCard
  84.   
  85.   if hilite of bkgnd button "speaker (tone dialing)"
  86.   then send "dial" && quote & dialNumber & quote to HyperCard
  87.   
  88.   wait 2 seconds
  89.   send "dial" & quote & empty & quote & "with modem" & quote & ¬
  90.   "+++ATH" & quote to HyperCard
  91.   
  92.   put empty
  93.   
  94. end doDial
  95.  
  96. on stripNonDials
  97.   global dialNumber
  98.   repeat with index = the length of dialNumber down to 1
  99.     if char index of dialNumber is not in "0123456789ABCD#*"
  100.     then delete char index of dialNumber
  101.   end repeat
  102. end stripNonDials
  103.