applescript脚本创建一个批量储存ID联系人文件
时间: 2023-10-31 12:04:10 浏览: 52
我了解您所说的是一种批量创建ID联系人文件的方法,Applescript脚本可以帮助您完成这个任务。以下是一些简单的代码示例:
tell application "Contacts"
set allPeople to every person
set allIDs to {}
repeat with aPerson in allPeople
set end of allIDs to id of aPerson
end repeat
set theFile to choose file name with prompt "Save ID contacts to file:" default name "ID Contacts.txt"
try
set fileDescriptor to open for access theFile with write permission
repeat with anID in allIDs
write anID & return to fileDescriptor
end repeat
close access fileDescriptor
display dialog "IDs saved to file:" & return & theFile buttons {"OK"} default button 1 with icon note
on error theError number theNumber
display dialog "Error: " & theError & return & "Number: " & theNumber buttons {"OK"} default button 1 with icon warning
end try
end tell
上面的代码将会把所有的联系人 ID 存储到一个文本文件中,可以根据您的需要做出适当的修改。不过请注意,这是一个简单的示例代码,我们无法保证它一定适用于所有情况。如果您有任何问题,请随时与我联系。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)