Applescript dapat secara massal membuat entri buku alamat OS X, yang kemudian dapat Anda impor ke iPhone Anda. Saya membuat dasar untuk Anda:
-- 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
Buka AppleScript Editor (di Applications/Utilities/
folder Anda ) dan rekatkan ke skrip baru. Seperti, itu akan membuat Anda 5 kontak bernomor seperti:
Anda dapat mengubah nomor di set numberOfEntries to "5" as integer
baris menjadi sebanyak yang Anda butuhkan, dan mengubah data jika Anda mau. Jika Anda membutuhkan bidang lain (seperti nomor telepon), tanyakan dan saya bisa menunjukkan caranya.
Versi yang ditingkatkan
Saya sedikit berlebihan dan membuat versi yang muncul dengan nama yang lebih bagus. Saya mengambil 20 nama pria dan wanita paling populer, 40 nama belakang paling populer, dan menambahkan inisial tengah, sehingga Anda mendapatkan peluang duplikat yang cukup rendah (sedikit di bawah 5% dalam satu set 2000, menurut matematika saya) tanpa kontak bernomor konyol mencari.
Itu juga menambahkan semua kontak ke grup ("Grup Uji") sehingga Anda dapat memilih semua yang dummy dengan mudah jika Anda menambahkan ke buku alamat yang ada dan ingin membersihkannya nanti.
Sunting: Saya juga mengubahnya untuk meminta berapa banyak item untuk dibuat, jadi tidak perlu mengedit kode.
-- 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
Inilah yang ia hasilkan:
Saya telah menggunakan kode Rob dalam bentuk yang lebih pendek untuk membuat Layanan Automator yang memungkinkan Anda mengklik kanan pada email dan membuat kontak:
Terima kasih banyak, Rob - Anda telah menyelamatkan saya berjam-jam :-)
sumber