在一个名字中合并First,Middle和Last Name的简单方法

时间:2011-03-26 13:59:11

标签: macos addressbook

示例:

  • 名字:“Sandu”
  • 中间名:“D。”
  • 姓氏:“Serban”

结果如下:"Sandu_D._Serban"

对于我的Mac地址簿中的所有联系人。

由于

1 个答案:

答案 0 :(得分:0)

使用applescript你可以这样做(使用脚本编辑器运行):

    tell application "Address Book"
        set allNames to ""
        set peopleCount to (count every person)
        repeat with i from 1 to peopleCount
            set firstName to (get first name of person i)
            set middleName to (get middle name of person i)
            set lastName to (get last name of person i)
            set oneName to ""
            if firstName is not missing value then
                set oneName to oneName & firstName
            end if
            if middleName is not missing value then
                set initial to first character of middleName
                set oneName to oneName & "_" & initial & "."
            end if
            if lastName is not missing value then
                set oneName to oneName & "_" & lastName & "
    "
            end if
            if firstName is missing value or lastName is missing value then
                set oneName to ""
            end if
            set allNames to allNames & oneName
        end repeat
        set the clipboard to allNames
    end tell

此脚本将名称列表复制到剪贴板。下次粘贴时,您将获得名称列表(如果您的地址簿中有很多名称,请稍等一下。)

BR,

的Juha