我尝试选择 Finder 并使用 applescript 和 xattr 为 pdf 文件分配特定的内容创建者值。虽然脚本编译得很好,但它实际上并没有修改元数据项。如果我运行,mdls -n kMDItemCreator test.pdf
我仍然会得到 kMDItemCreator 的旧值。知道我做错了什么吗?
-- Get the finder selection to pass to the repeat below
tell application "Finder"
set finderSelectionList to selection as alias list
end tell
-- Change the content creator of the selected files
repeat with theFile in finderSelectionList
tell application "Finder"
set a to quoted form of POSIX path of theFile
do shell script "xattr -w com.apple.metadata:kMDItemCreator 'some content creator'" & a
end tell
end repeat