Easy one! -- Phone number translator

-- I'm writing a scirpt to translate those pesky alpha-numeric phone numbers into regular numeric phone numbers.
-- I'm still unfamiliar with list manipulation, so I need help with the inner statements.
set thePhoneNumber to "1-800-MY-APPLE"
set thePhoneNumberLIST to the characters of thePhoneNumber
set exceptions to "1234567890()- " -- chars that should be left alone
set phoneDialKeysLIST to {",ABC,DEF,GHI,JKL,MNO,PQRS,TUV,WXYZ"}
set x to 0
repeat with theChar in thePhoneNumberLIST
set x to x + 1
if theChar is not in exceptions then -- Translate every non-exception
-- Here's where I need help
--Pseudo code:
-- replace item x of thePhoneNumberLIST with the number of the item of phoneDialKeysLIST that contains theChar
else
-- do nothing
end if
end repeat
log thePhoneNumberLIST

property number_List : "1234567890()- " -- Valid characters.
property letter_List : {"", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"} -- Invalid characters.
set phone_Number to "1-800-MY-APPLE" -- Phone number to test, and if needed - convert.
set phoneNumberItems to the characters of phone_Number -- Create a list of characters.
set newPhoneNumber to ""
repeat with i in phoneNumberItems -- Cycle through phone number.
if (number_List contains i) then
set newPhoneNumber to (newPhoneNumber & i) -- Add a valid character to 'newPhoneNumber'.
else
repeat with j from 1 to (count letter_List) -- Cycle through invalid character list, to determine character position.
-- Append numerical equivalent to end of 'newPhoneNumber'.
if ((item j of letter_List) contains i) then set newPhoneNumber to (newPhoneNumber & j)
end repeat
end if
end repeat
newPhoneNumber -- Translated phone number.
  Mac OS X (10.4.4)  

Similar Messages

  • Can I use one phone number on two iphones with two apple ids?

    My carrier allows multiple sim cards with the same phone number for usage on different devices. I would like to use a second sim card for my phone number on a second iphone, but with a different apple id.
    Is it possible to use one phone number on two iphones with separate apple ids? How does this affect facetime/imessage?
    I can only find answers to using the same apple id on multiple devices. This works fine, but is not what I want to do here.

    You may be able to change the suspicious account activity message alerts
    in your Gmail settings, and check that side of it, since I can use several
    means of accessing my Gmail and Google Accounts; and in the past had
    shared an account (not google) with another party half a world away when
    her email server went down for a month.
    The Mail software should not know the difference, unless the setup in there
    is not correct; if this is so, then more than what she says would be wrong.
    The Google mail Support help site pages should cover this adequately.
    Gmail Help - Google Help
    https://support.google.com/mail/?hl=en

  • How can i add one phone number to my macbook pro application imessage

    how can i add one phone number to my macbook pro application imessage

    Make sure that the iPad is using the same Apple ID as your iPhone. If the phone number still doesn't appear, log out of iMessage on both devices, log back in on the iPhone, wait until it activates, then log into iMessage on the iPad with the same Apple ID.

  • 13 apple ids connected with one phone number

    I've been bumping into this problem for several years now and it 's just getting worse. When Apple started Voice Pass I had to delete 69 registered products to get down to the 7 I currently own. I have always had only one email address, one password, and since 1997 one phone number. Yet somehow Apple has created multiple ids for me and there seems to be no way to get rid of them. I was in my Voice Pass today and tried to add my home phone number only to have the system kick out my registered number saying it was already registered to different customers. When I spoke to a senior advisor he had no idea where in Apple, Inc. he could find Voice Pass or Apple id's. He did, however, say I was registered 13 times. Needless to say, I have only registered once and the question is, "now what"?
    Thanks,
    Jeffrey

    I forgot to mention. This is 13 of the same account and I can only access one account. The others are in the system and are causing much confusion including now allowing me to use my main number in Voice Pass. They cannot be accessed by tech support and I can't change my phone number just to create a 14th account and what's to say Apple won't give me 13 ids on the new number?

  • Using more than one phone number on single iPhone for iMessage?

    Is it possible to intentionally have more than one phone number listed under Settings > Messages > Send & Receive?  I know I've heard of 'glitches' where more than one phone number is shown accidentally and how that is solved (signing out of iMessage and then back in), but if you want to intentionally have more than one phone number listed there (say, the phone number of your own device and also the phone number of your work-related iPhone), is there a method?  I'm leaning toward the answer of 'no', but I'm wanting to double check.

    robdrage wrote:
    I'm not sure, but if you use the same Apple ID for both iphones and register both with messages, then you may be able to go to device one Settings>Messages>Send&Receive and select device twos number as well.
    I thought about that. For some reason, I think that I've heard it doesn't work. Sadly, however, I don't have two iPhones with which to test it.

  • Block one phone number

    Can I block one phone number on my phone

    Hi and welcome to the forums!
    The native software in the Blackberry doesn't have that function.
    1) If the phone number poses any threat to you. Call your carrier and have them block the number permanently.
    2) If the phone number is just a nuisance i.e.. bill collector, phone sales etc I  would use a call manager app. Look in AppWorld under call manager. Some are free. I haven't test one in about 2 years so I can't recommend one.
    Thanks,
    Bifocals
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • How do I switch of the ring tone to silent on one phone number only

    How do I switch the ringtone to silent on one phone number only

    You have to transfer ringtones from iPhone 4 to computer iTunes using Transfer Purchases.

  • How to add more than one phone number in imessage?

    How to add more than one phone number in imessage?

    If you mean sending to multiple phone numbers, place a comma between the numbers in the "To" box, or select the "+" to use numbers in your Contacts

  • You may only have one phone number of this type.

    I keep getting this message when I try to update my iTunes account.
    There is only one phone number given.
    I tried changing the location (home, business, etc.) to no avail.
    I tried changing to a different phone number. Still no luck.
    I have copy/pasted this message into the Search Forum hoping to find it as an error message, but it returns no results.
    Any ideas for this would be great.
    Thanks.
    PC   Windows XP  
    PC   Windows XP  

    Erica:
    Welcome to the Apple Discussions. Try reentering all of you account data - delete then reenter. You might have to enter a new photo no, say your cell, save and then edit again and put in the original phone number. See if that will let you setup 1-click.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Can i have more than one phone number on my itunes account?

    My son and I use the same apple ID. He has a separate phone number to me and wants to use imessage on his ipad.
    How can I set up my account to use more than one mobile number?

    He would have to use a separate ID for iMessage in order to do this.  You can still share the same ID for iTunes; it doesn't have to be the same as the ID used for iMessage.  To do this, have him go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with a different ID.

  • IPhone 4s will not let me text to one phone number

    My iPhone 4s will not let me text to my brother's phone number.  It keeps giving the message "Error Invalid Number.  Please re-send using a valid 10 digit mobile number or valid short code."  I have rebooted my phone; same problem.  I checked the number; it is correct with area code and 7-digit number.  I have no trouble texting anyone else in my contact list.  The number is not blocked. 

    I'd head to an Apple Retail Store or contact AppleCare at 1-800-275-2273

  • HT3529 How do I send a text message to more than one phone number at the same time?

    How do I send the same text to more than one phone at the same time?

    You'll need to see if there's an app in the App Store that does what you want. Search for "Group SMS" or similar.

  • App for separate text messages with one phone number

    Is there an app for iphone that would enable incoming text messages from specific numbers to be diverted to a separate app than the text message app?
    In other words, like a separate inbox that could be kept "hidden" on one's phone but with one number.
    Or instead of having the text message on the phone, a website where messages could be viewed from the phone on line?

    No app that I know of, however text message is a carrier feature - contact your cell phone provider.

  • Option to call one phone number when iPhone is locked and password protected

    Dear Sir or Madam,
    I have an idea which should be added to your iOS for iPhones. I think that many users would appreciate that and it could help to return a lot of lost iPhones to their owners. Even though I think that it could be used by emergency to contact the relatives in case something happen to the owner. The idea is to allow owner to define one or two numbers which could be called from the iPhone when it is locked and protected by password. Same option as it is for emergency nowadays.
    Please try to consider it.
    Thank you,
    Yours sincerely,
    Kamil Olah

    http://www.apple.com/feedback/

  • Retrieve only one type of phone number

    Hi
    In the following sample query I need to retrieve only one phone number. The preference is if Mobile available - mobile number if not Home number (Type - H1), else Work number (W1).
    I have included the script and sample output what I am getting from the SQL
    Thanks in advance
    Regards
    Sriram
    select pp.ph_id
    ,papf.person_id
    ,pp.ph_type
    ,pp.ph_no
    ,pp.date_from
    ,pp.date_to
    from per_phones                      pp
    ,per_all_people_f                    papf
    ,per_contact_relationships           pcr
    where papf.person_id = pp.parent_id
    and pcr.person_id = papf.person_id
    and trunc(sysdate) between trunc(nvl(pcr.date_start, sysdate-1))
    and trunc(nvl(pcr.date_end, sysdate+1))
    and papf.person_id in (146564, 514)
    and pcr.primary_contact_flag  = 'Y'
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between nvl(pp.date_from, sysdate-1) and nvl(pp.date_to, sysdate+1);output
    PH_ID     PERSON_ID     PH_TYPE     PH_NO     DATE_FROM     DATE_TO
    3261     514          H1          987524879     13-Jun-04     
    117287     514          M          0403672797     11-May-05     
    141997     146564          H1          54789620     15-Feb-06     05-Mar-10
    311028     146564          H2          235469          5-Dec-09     
    311029     146564          W1          8300054          15-Dec-09     
    311108     146564          M          04126872     12-Feb-10

    Not tested, but something like this might do the trick. What you need to do is assign a hierarchy to the phone type codes, then choose the top one for each parent id.
    WITH phone_list
      AS ( SELECT parent_id,
                  MIN( CASE ph_type
                         WHEN 'M'  THEN 1
                         WHEN 'H1' THEN 2
                         WHEN 'W'  THEN 3
                         ELSE 99
                       END )  AS phone_pref
             FROM per_phones
            GROUP
               BY parent_id )
    SELECT pp.ph_id,
           papf.person_id,
           pp.ph_type,
           pp.ph_no,
           pp.date_from,
           pp.date_to
      FROM per_phones                pp,
           per_all_people_f          papf,
           per_contact_relationships pcr,
           phone_list                lst
      WHERE papf.person_id = pp.parent_id
        AND pcr.person_id = papf.person_id
        AND trunc(sysdate) between trunc(nvl(pcr.date_start, sysdate-1))
        AND trunc(nvl(pcr.date_end, sysdate+1))
        AND papf.person_id in (146564, 514)
        AND CASE pp.ph_type
                         WHEN 'M'  THEN 1
                         WHEN 'H1' THEN 2
                         WHEN 'W'  THEN 3
                         ELSE 99
                       END = lst.phone_pref
       AND pp.parent_id = lst.parent_id;

Maybe you are looking for

  • Itunes wont open on my Mac

    My itunes icon in the dock will not open the program???  Help

  • Java SDK j2sdk-1_4_2_13-windows-amd64.exe download

    Hello everyone,    Someone could provide me the version of the SDK SUN 13 for Windows. X86_64 (j2sdk-1_4_2_13-windows-amd64.exe)?.     Version 16 now available for download on note 941595 is a bug with Kerberos. Thank you.

  • Case statement error

    Error:  The below case statement is throwing error when i include in the select statement for B    CASE WHEN (AST_INV_CHF_Y <= 250000)                   THEN 'BELOW 250K'                   WHEN (AST_INV_CHF_Y > 250000  AND AST_INV_CHF_Y <=1000000)   

  • Update clone db to a point-in-time

    Hi guys, I am planning to implement a point in time recovery. I have a production database that I have successfully cloned by using hot backup and applying the necessary archived redo logs. I need to do this automatically daily. How can I do this? My

  • How to reset Safari 8.0.3?

    I want to reset my safari because the homepage was changed by adware (I removed the adware) and I do not know how to get it back to the default. Thanks x