Ruined my contacts with Apple Script, need someone to help me modify the script to undo what I did!

Hi all, so all my contacts started with "+1". The goal was to erase the "+" and just have all of them start with "1". However, I messed up royally. I ran the following script, which made all my contacts start with "1+1". :
tell application "Contacts"
          repeat with eachPerson in people
                    repeat with eachNumber in phones of eachPerson
                              set theNum to (get value of eachNumber)
                              if (theNum starts with "1+") then
                                        set value of eachNumber to "1" & theNum
                              end if
                    end repeat
          end repeat
save
end tell
This is messed up in 2 ways. Firstly, I meant to write "+1" in the script, but instead I wrote "1+". Secondly, even if I had written "1+", it still wouldn't make sense, because I'd effectively be telling the program to just add "1" in front of what's already there, including the "+1".
Could someone please tell me how to modify this script to say:
If the contact starts with "1+1", then erase the "1+1". Then I would need another script to take all my numbers and add "1" in front of them.

What you want to do is simply delete the first few characters from the phone number, yes?
How about something like this:
                         repeat with eachNumber in phones of eachPerson
                                        set theNum to (get value of eachNumber) as string
                                        if (theNum starts with "1+1") then
                 set myFixedNum to (characters 3 thru -1) of theNum
                                        else if (theNum starts with "+1") then
                                                       set myFixedNum to (characters 2 thru -1) of theNum
                                        end if
                                        set value of eachNumber to (myFixedNum as string)
                          end repeat
That will take you from 1+1 or +1 to 1 in one easy step.

Similar Messages

  • Hi, I need someone to help me change the login screen. The computer I have is a macbook, its second hand and probably around 3-4 years old. The previous owner had the login screen has a lego or something. Could someone please help me change this??

    Hi, I need someone to help me change the login screen. The computer I have is a macbook, its second hand and probably around 3-4 years old. The previous owner had the login screen has a lego or something. Could someone please help me change this??

    computerilliterate52 wrote:
    hi all, i hope someone is very computer litterate about java that is i have a dell 2400 pc windows xp 2, well since msn isnt downloading anymore java updates we all have to download a compatible one to our computer i use explorer and i can play www.iwin.com online games, yet when i go on to the msn browswer it wont load the games all i see is it just trying to load and load nothing said and nothing done. what could be wrong it works on ie and not msn browser? i have zone alarm, i have avg spyware tester and spyblaster, but i thought it may of kept me from downloading all this yet it worked on IE please help and i dont have flash player either it wont seem to work any and i mean any help is welcome.i tried to change the browser settings and did all that stuff i am on broadband DSL and they dont seem to know they say that isnt there job its msn's so i asked them and they said no it is quest broadband since i am with them i just get the run around i have IE 6.0 ihave java plug in 1.4.2. o3 yet it says not verified, i have java 1.6.o o1 i have java plugin 1.6.0 01 i have that twice ? dont know why. and java envirinmemet i have the right stuff cuz like i said it plays or works on explorer not msn browserer bar. i see no picture's in center of the page as it tries to load it is a blank page any help thank you i have been trying going on 3 weeks now thanksI agree with the other posters; try Firefox. It sounds like a bit of a mess and what you may need is an onsite PC tech to do some maintenance on your PC.
    Also, learning to properly use punctuation (particularly periods) might not be a bad idea. As it is, your post was very hard to read.
    Good luck!

  • TS4006 I need someone to help me download the new software for the iPad and iPhone ios5

    Need help with the download of the late stet software

    Welcome to the Apple Community.
    Connect each device to your computer and use the update option in iTunes.

  • I tried to launch iCloud on iMac.  I Changed my e-mail address recently, and iMac  doesn't  seem to know it.  Even worse, it doesn't know any password I've used with Apple ID.  Can anyone help me?

    I tried to launch iCloud on iMac.  I Changed my e-mail address recently, and iMac  doesn't  seem to know it.  Even worse, it doesn't know any password I've used with Apple ID.  Can anyone help me?

    No, i don't. if i did i would have tried it. do you have to sign up an appled ID for iCloud? If the answer is yes then they should mention that in the set-up instructions.

  • Which email or which phone no. i can contact with apple after-sale service center? I need to send back to amend or replace!

    my new iphone 4S was bought from las vegas only for 1 month.And it is with serious quality problem, battery did not work and has liquid came out,Now i am in china, what phone no. or which mail i can contact with apple after-sale service center? I need to send back to US to amend or replace.
    All of the guys in apple now told me that it is not worldwide guarantee,which is different from the promise when i bought,i am disappointed!!!
    I need your help to tell me how i can contact with them and where i can send back the iphone to amend.

    The only email I have ever comes across for complaints would be [email protected] (it is not mis-spelled).  I don't know if it is still of use.
    Chat is going to be your only option for getting help, and you shouldn't be surprised if they don't offer help due to your product no longer being supported (sad but true).
    If you had not mentioned that you have an email confirming you registered (double-check that) I would have told you that you probably did not purchase thru Adobe and never registered it so they have no record of you owning it.  They do not email serial numbers for disc purchases - they are provided with the discs as you were told in chat.

  • HT201269 I am trying to sync contacts from Apple Iphone to Android phone, I was trying to locate the sync contacts with google option but counld not find it in the itunes. Pls advise how do I do the sync, I need to sync the contacts and calendar too. Than

    Hi, I am trying to sync my Iphone contacts and calendar to my Samsung note 3 phone, saw in the U-tube that I can do it in itunes under the sync contacts with googles process. But I could not fine the sync contacts with process in the itunes. Can you pls advise me how I can sync my iphones contacts and calendar to my note 3 phone. Thanks

    http://support.apple.com/kb/HT1296

  • I recently purchased FaceTime from the Application Store. After approx. ±10 meg, the application resets and starts downloading again. I have tried to download it at different times of the day but with the same results. I have been in contact with Apple su

    I recently purchased FaceTime from the Application Store. After approx. ±10 meg, the application resets and starts downloading again. I have tried to download it at different times of the day but with the same results. I have been in contact with Apple support and have tried different options with the same result. I cannot download a new Version because in my Purchased List the applicaiton (FaceTime) is still there, and because I have halted it it tells me to resume. I can’t, because the same thing is going to happen. I have tried all the various troubleshooting tips supplied by my ISP and also Apple Support with no luck. I am currently working on a IMac OS 10.6.7. Has anybody got any ideas? Any suggestion would help. Thanks

    Amol Soni wrote:
    As I said, I tried everything what the manual says, but hard luck. I have taken an appointment for today, lets see what happens.
    Also there is no activity on unit when I use the remote. The unit is stuck on the first page itself where we have to choose the language. The unit seems to be fine to me but the real problem is remote does'nt have activity. The IR is not responding while pressing any of the button.
    Good luck with your appointment.
    Not much consolation but even new products can have issues and might need a trip to a store to return/replace.
    The reason i asked about the LED on the AppleTV is that occasionally it thinks it's paired with a specific remote and ignores others - the unpair keypress I described is quick and free.
    AC

  • Contact with Apple iTV

    Mine iPad 3 cannot manufacture a contact with Apple iTV. I would like to have a series film run of iPad on the TV. Only the tone, a picture does not come! All updates are installed!
    Where is the Problem?
    Klaus

    The serial number is in your phone. This is a user to user support forum, not Apple. If you have a question, describe it in detail and someone here might be able to help you.

  • I'm from Perú. My iPad doesn't work. I'm trying to contact with apple support but I can't. What can I do? How can I contact them?

    I am Eileen. I'm from Perú.
    I'm really concerned.
    My iPad doesn't work since 2 months ago. And I can't do anything. In the Istore (where I bought my iPad, 1 year and 5 months ago) said that  they couldn't repair it, and I must to go to USA to fix it.
    So I'm trying to contact with apple support but it's impossible.
    I hope you can contact me, and it would be better if someone who speaks spanish contact me.
    Thanks.

    You may have to try and contact the authorized Apple support in Mexico or Brazil:
    Latin America and the Caribbean
    Brazil
    0800-761-0880
    Mexico
    001-866-676-5682
    iPhone:
    001-800-692-7753
    The 800-numbers to contact Apple (US) we see at the main Apple Store (US) are not
    able to be used out-of-country; some listed in the Contact Apple are main numbers
    though and one could pay the toll-charges to try ones luck...
    •Apple - How to Contact Us:
    http://www.apple.com/contact/
    https://locate.apple.com/country
    Find an Apple Authorized Service Provider?
    Contact Apple for support and service
    Sadly, most responding people here are just product owners and users; we do not represent
    Apple, its policies, or other aspects of the business. As volunteers of our time, we, from our
    places of residence or other locations convenient to our free time, we donate time and some
    ideas on common to not-so-common technical or other issues; with no expressed or implied
    warranty that our advice has any binding effect on anyone, and Apple is their own boss.
    Often advice here cites Apple support articles that are published; some times persons with
    experience unique that worked for them in certain circumstances, is shared. Other times
    one may see a few wild guesses in attempts to help people with product issues. And most
    times, suggestions to 'visit some Authorized Apple Service Provider' are all one can say.
    Hopefully you can find someone at the Mexico or Brazil location that can give you some help
    in regard to repairs or other alternatives; or perhaps a US independent authorized service
    provider could look into your product & repair it; after you contact one to see what they'd do.
    PS: did you find anything using these?
    https://locate.apple.com/pe/es/
    http://consultants.apple.com/locator-latin.php
    Good luck & happy computing!
    edited 2x

  • There's any way to contact with apple by email and not over the phone ?

    Hi
    I need to contact with apple by email instead over the phone, that's possible ?
    I'm trying a week to find email address to send them my problem details but can't find nothing,
    every time I'm getting to the same place the tell me my only option is to contact with apple over the phone or contact with my domestic apple retailer
    Thanks
    Dekel

    To contact support for your MacBook, use this link. Since a MacBook can be serviced worldwide, you should have no problems finding an Authorized Apple Service Provider that  an check the battery of your computer. If this was an original Apple battery, tell Apple Support about it. The battery in my MacBook also go bigger, but I noticed that before the case got damaged. I took it to an Authorized Apple Service Provider and Apple replaced the battery for free. Take your battery out of the computer, just to be sure.
    MacBook Pro - Apple Support
    Did you buy the phone second hand? If the Activation Lock had been activated using a different Apple ID, the phone can't be used anymore, unless you remove the lock in iCloud, using the correct Apple ID to log into that previous owner account.
    iCloud: Remove your device from Find My iPhone

  • I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    Click here and ask the iTunes Store staff for assistance.
    (102938)

  • In my Iphone 5, Nothing on my App Store is working its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component but still it doen't fix. Not sure if its problem with apple servers. Someone help please!

    In my Iphone 5, Nothing on my App Store is working,  its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component in my desktop but still it doesn't fix the app store issue. Not sure if its problem with apple servers. Someone help please!

    settigns>itunes and app store to make sure you are signed in.. If  you are, you will see your account name..... anyhow, click your account name, sign out and sign back in
    also go to to settings>general>reset and reset network settings... if that doesnt work settings>general>reset and reset all settings!
    one of those shall work. The last step would be to restore your device (apple.com/support) HT1414

  • How do i set up my facebook account with apple iphone need direction

    I TRIED SEVERE TO SET MY FB ACCOUNT,AFTER SIGN IN IT WONT OPEN UP AND KEEP ASKING FOR APPLE ID,NOW I HAVE TO CREATE A NEW ACCOUNT WITH APPLE,I NEED DIRECTION SO I CAN HAVE ACCESS TO FB.

    http://support.apple.com/kb/ht4810

  • Is there any way to reset security questions without a vocal contact with Apple?

    Yesterday I've tried to buy a song from iTunes, and it's surprised me that I've been ask to answer some security questions I have made long time ago and unfortunately I can't recall the answers of these security questions, I've tried to reset the security question by this site applied.apple.com and the reset link is not appearing under the answer box!!
    Is there any way to reset security questions without making a vocal contact with Apple ?
    Best Regards,

    Click here and ask. If they say that there isn’t, and they probably will, accept that.
    (122113)

  • TS1292 Hey, im facing a problem while im using the purchesing , its showing me that: contact with apple support itunes???? Please help

    Hey, im facing a problem while im using the purchesing , its showing me that: contact with apple support itunes???? Please help

    Use the link below to contact iTunes support.
    http://www.apple.com/emea/support/itunes/contact.html

Maybe you are looking for