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
