Answers:
Applescript可以批量创建OS X通讯簿条目,然后可以将其导入到iPhone。我为您准备了一个基本的:
-- Change these to your desired data
set firstName to "Test"
set lastName to "User"
set numberOfEntries to "5" as integer
set counter to "1" as integer
tell application "Address Book"
repeat numberOfEntries times
set thePerson to make new person with properties {first name:firstName, last name:lastName & " " & counter}
make new email at end of emails of thePerson with properties {label:"Work", value:"test" & counter & "@example.com"}
make new address at end of addresses of thePerson with properties {label:"Home", city:"Fakeville", street:(counter as string) & " Some St."}
set counter to counter + 1
end repeat
save
end tell
打开AppleScript编辑器(在您的Applications/Utilities/
文件夹中)并将其粘贴到新脚本中。照原样,它将为您提供5个编号如下的联系人:
您可以将行中的数字更改为所需的数量set numberOfEntries to "5" as integer
,并根据需要更改数据。如果您需要其他字段(例如电话号码),请询问,我可以告诉您如何。
我有些落伍,做了一个带有更好名字的版本。我选择了20个最受欢迎的男性和女性名字,40个最受欢迎的姓氏,并添加了一个中间的名字首字母,因此重复的几率很小(按我的数学,在2000年一组中,5%以下)高飞的编号联系人。
它还会将所有联系人添加到一个组(“测试组”)中,因此,如果要添加到现有地址簿中并希望稍后进行清理,则可以轻松挑选出所有虚拟联系人。
编辑:我也将其更改为提示要创建多少个项目,因此无需编辑代码。
-- name lists: 20 most popular (US) male and female first names, 40 most popular last names
set firstNameList to {"Mary", "Patricia", "Linda", "Barbara", "Elizabeth", "Jennifer", "Maria", "Susan", "Margaret", "Dorothy", "Lisa", "Nancy", "Karen", "Betty", "Helen", "Sandra", "Donna", "Carol", "Ruth", "Sharon", "James", "John", "Robert", "Michael", "William", "David", "Richard", "Charles", "Joseph", "Thomas", "Christopher", "Daniel", "Paul", "Mark", "Donald", "George", "Kenneth", "Steven", "Edward", "Brian"}
set lastNameList to {"Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson", "Clark", "Rodriguez", "Lewis", "Lee", "Walker", "Hall", "Allen", "Young", "Hernandez", "King", "Wright", "Lopez", "Hill", "Scott", "Green", "Adams", "Baker", "Gonzalez", "Nelson", "Carter"}
set initialList to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set counter to "1" as integer
-- prompt for how many contacts to create
set dialogText to "Number of contacts to create?"
repeat
display dialog dialogText default answer ""
set numberOfEntries to text returned of result
try
if numberOfEntries = "" then error
set numberOfEntries to numberOfEntries as number
exit repeat
on error
end try
end repeat
-- populate the address book
tell application "Address Book"
set theGroup to make new group with properties {name:"Test Group"}
repeat numberOfEntries times
set firstName to some item of firstNameList
set lastName to some item of lastNameList
set middleInitial to some item of initialList & "."
set thePerson to make new person with properties {first name:firstName, middle name:middleInitial, last name:lastName}
make new email at end of emails of thePerson with properties {label:"Work", value:firstName & middleInitial & lastName & "@example.com"}
make new address at end of addresses of thePerson with properties {label:"Home", city:"Fakeville", street:(counter as string) & " Some St."}
add thePerson to theGroup
set counter to counter + 1
end repeat
save
end tell
这是生成的内容: