[comp.sys.mac.hypercard] Faster HyperCard Phone stack -- script code enclosed

moriarty@tc.fluke.COM (Jeff Meyer) (06/13/88)

[I'm cross-posting this to comp.sys.mac as I believe there are some out
 there who use HyperCard (with Focal Point and other stacks) without
 scripting in it enough to read .hypercard.]

I use Focal Point in HyperCard to dial the phone (look it up in address
book, then press dial button and let my modem go to work).  With HyperCard
1.1, the Phone stack comes with a field for the user to put local prefixes
in -- 3 number codes so that the phone stack can figure out if the call is
long distance or not.  Rather nice, but in Seattle there are approximately
50 prefixes that are local to me; the Phone stack goes through each one
until it finds the match (no Find command is used).  This is really slow,
especially when you're dialing a number with a "932" or such prefix.

Well, I made a few quick changes to the Phone stack script (located under
the Stack menu option) which speed up the dialing to an almost instantaneous
process.  Used the Find command; imagine you could use some of the new "Find
word" or "Find string" under HyperCard 1.2, but since all the prefixes are 3
numbers long, and seperated by spaces or commas (they should be), there
really isn't any reason to.  

Here's a before/after listing of the script.  I think you'll find this
useful if you use HyperCard to dial your phone for you.

Original script from the Phone Stack:

  else if dialLength = 7 then
    put char 1 to 3 of dialNumber into prefix
    repeat with index = 1 to number of words in field "Local Prefixes"
      if word index of field "Local Prefixes" is prefix then
        doDial field preamble & dialNumber
        exit dial
      end if
    end repeat
    answer "Is this a local (non-toll) call?" with No or Yes

My alterations to said stack:

  else if dialLength = 7 then
    put char 1 to 3 of dialNumber into prefix
    find prefix in field "Local Prefixes"
    if the result is empty then
      doDial field preamble & dialNumber
      exit dial
    end if
    answer "Is this a local (non-toll) call?" with No or Yes

-----
Enjoy!

                        "No, it's 'Blessed are the meek.'  I think that's
                         nice, 'cause really they have a hell of a time."
---
                                        Moriarty, aka Jeff Meyer
INTERNET:     moriarty@tc.fluke.COM
Manual UUCP:  {uw-beaver, sun, microsoft}!fluke!moriarty
CREDO:        You gotta be Cruel to be Kind...
<*> DISCLAIMER: Do what you want with me, but leave my employers alone! <*>