2009-12-27 6 views
0

Facebook 동기화 앱이 자신의 도시와 내 Mac 주소록 연락처의 주소 필드를 채 웁니다. 수많은 사람들이 쓸모없는 주소를 갖고있어 사람들이 Google지도 앱에서 검색하는 것을 어렵게 만듭니다 (많은 사람들이 스크롤을 끝내고 적절한 주소가있는 사람들 만보고 싶을뿐입니다).AppleScript를 사용하여 Mac 주소록에서 주소 필드 제거

내 주소록의 모든 집 주소 입력란을 AppleScript로 지우고 싶습니다. 내가 작은 뭔가를 쓴하지만이 일을 가져올 수 없습니다, 아마 내가 여러 주소/다른 스크립트에서 휴대폰의 논리를 공제하려고 AppleScript로 :)

tell application "Address Book" 
repeat with this_person in every person 
     repeat with this_address in every address of this_person 
      if label of this_address is "home" then 
       remove this_address from addresses of this_person 
      end if 
     end repeat 
    end repeat 
end tell 

알고 있지만 추가 찾을 수있는 누군가의 도움을 필요로 그들을 제거하지 말라.

감사합니다. :)

답변

0

논리가 소리이며 removedelete으로 바꾼 경우 작동 할 수 있지만 더 이상 줄일 수는 있습니다. 나는 특정 전자 메일 주소를 제거하는 그는 delete를 사용 Trevor's AppleScript Scripts,에서 "라벨에 대한 이메일을 제거"스크립트를보고이 알아 낸

tell application "Address Book" to ¬ 
    delete (addresses of people whose label is "home") 

(: 당신이 실제로 필요로하는 모두는 다음과 같은 간단한 1.5 라이너 remove은 조각이 아닌 전체 주소 카드를 지우는 것입니다.) 그리고 약간의 실험으로 축소했습니다 (AppleScript 프로그래밍이 항상 진행된다는 것을 알 수 있습니다).

+0

고마워요! 이것은 어떤 오류도 줄지 않았지만 변경 사항을 생성하지 못했습니다. (AB를 다시 시작한 후에도 주소가 계속 표시됩니다.) 하지만이 문제를 바탕으로 조금 더 고마워 할 것입니다. :) – cemregr

+0

그건 이상한 일입니다. - 내 시스템에서 작동합니다 (사실, 주소록을 백업 해 두었 기 때문에 잘 작동합니다 :)). 실행중인 OS X의 버전은 무엇입니까? 나는 10.5.8을 달리고있다. 어쩌면 거기에 문제가 있습니까? –

+1

나는 문제를 알아 냈을지도 모른다. 30 년 후 : 아마도'tell' 블록 안에'save addressbook'을 넣어서 변경 사항을 적용해야 할 것이다. –

1
/* 

This program will remove the fb://profile links from your 
contact cards. I would suggest creating an addressbook archive 
first before running this against your actual contacts. The easiest 
way to use this is to search your contact cards for "profile" select 
all and export as a single vCard. Then compile and run this program with 
that vCard as input and specify an output file, say fbRemoved.vcf 

I found that AddressBook behaves oddly when I try to do a mass import 
selecting use new for all cards. To get around this I just deleted all 
cards I had selected in the "profile" search then imported fbRemoved.vcf 

Written by: Alexander Millar 
Date: 30 Feb 2010 

*/ 

#include <iostream> 
#include <iomanip> 
#include <stdio.h> 
#include <fstream> 
#include <string> 

using namespace std; 

bool contains_fb_link(string str) { 
    size_t found; 
    found = str.find("fb\\://profile/"); 
    if(found!=string::npos) 
    { 
     return true; 
    } 
    return false; 
} 

int main(int argc, char *argv[]) { 
    istream *infile; 
    ostream *outfile = &cout; 
    string str; 

    switch (argc) { 
    case 3: 
    outfile = new ofstream(argv[2]); 
    if (outfile->fail()) { 
     cerr << "Error! Could not open output file \"" << argv[2] << "\"" << endl; 
     exit(-1); 
    } 
    case 2: 
    infile = new ifstream(argv[1]); 
    if (infile->fail()) { 
     cerr << "Error! Could not open input filee\"" << argv[1] << "\"" << endl; 
     exit(-1); 
    } 
    break; 
    default: 
    cerr << "Usage: " << argv[0] << " input-file [output-file]" << endl; 
    } 

    for (;;) { 
    getline(*infile,str); 
    if(infile->eof()) break ; 

    if(contains_fb_link(str)) 
    { 
     getline(*infile,str); 
     if(infile->eof()) break ; 
    } 
    else 
    { 
     *outfile << str << endl; 
    } 
    } 
} 
+1

StackOverfow에 오신 것을 환영합니다! 나는 당신의 프로그램을 테스트하지 않았지만 노력을 위해 +1했다. 또한 2 월 30 일은 없습니다. – Potatoswatter