Title: Re: OneClick script for Automatic phone dialing
If I may make a suggestion: why not use the international standard for complete numbers, that is, if the number starts with a plus, the number is the complete telephone number including country code.  Your script could then easily handle the deletion of country code and area code for the current location, and add the necessary prefixes for long distance or international. Numbers not formatted as complete numbers could be assumed to be in area code/number format. Note that the complete number does NOT include any toll (typically 1 in the US) or access digits, it is the actual phone number only. Including the toll or access digits greatly complicates the processing of a telephone number, as noted below.

The length of the telephone number is not a good indication as to its type. If I remember correctly, the current maximum length of a valid telephone number is 12-16 digits, not including any international or long distance access codes, and not including sub-address or calling card information.  Thus the script below will fail with most telephone numbers in my address book.

To make the script more robust, I would add variables for international, long distance, and local access codes, as well as provision for deleting the country code in addition to the area code.

Some example numbers for you to consider(+country-area/city-CO-DN):

+1-408-555-1212
+81-3-5226-0000
+886-2-2313-6700
+81-90-3456-9875

Eric Hildum

From: Paul Berkowitz <[EMAIL PROTECTED]>
Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Date: Tue, 14 Nov 2000 12:31:13 -0800
To: Oneclick-Talk <[EMAIL PROTECTED]>
Subject: Re: OneClick script for Automatic phone dialing
Resent-From: Paul Berkowitz <[EMAIL PROTECTED]>
Resent-To: Entourage mac Talk <[EMAIL PROTECTED]>
Resent-Date: Tue, 14 Nov 2000 12:33:57 -0800


On 11/14/00 12:10 PM, "Allen Watson" <[EMAIL PROTECTED]> wrote:

If (Length temp) = 10     // Long distance
       AC = SubString temp, 1, 3
       If ((AC = local1) OR (AC = local2))     // Local area codes
           // Don't add a "1" prefix
       Else If  (AC = omitLD1)
           theNum = Replace AC, theNum, ""     // Delete area code only
       Else
           theNum = "1," & theNum
       End If
   End If

I think it might need a bit extra for non-North American calls?

This can get a bit complicated if you have to remove zeros or 9’s from European area codes. E.g. in the UK, people’s numbers will begin something like 0171-794-5555. But when you dial from the US beginning with the UK code of 44, you dial 44-181-794-5555. However, if you make sure store their phone numbers in the Address Book exactly how they should be dialed from home rather than copying how the numbers  may appear on someone's stationery., then there will always be more than 10 digits, including the country code. So you could replace that last End If with

   Else If (Length temp) > 10
       theNum = "011," & theNum
   End If

That’s for North American dialing. Other countries should substitute the code for international dialing instead of 011, and change the length from 10 to whatever is the longest national number possible. Similarly, higher up, substitute any national code for national long distance instead of Allen’s "1," & theNum. Most other countries don’t have such a code, so you can just leave that part out. Also many other countries don’t have the US type of area code but just incorporate the code in the number. So you’ll have to adapt Allen’s script for your own country as appropriate.

   
--
Paul Berkowitz


Reply via email to