如何使用AppleScript将Safari书签添加到macOS Mojave中的对象?

如何使用AppleScript将Safari书签添加到macOS Mojave中的对象?,safari,applescript,macos-mojave,Safari,Applescript,Macos Mojave,由于macOS Mojave,我无法再阅读bookmarks.plist文件了。我认为这是基于莫哈韦新的安全角色 在过去,我是用这个AppleScript片段来完成的: -- -- read the bookmarks to an new object -- tell application "System Events" repeat with i in (property list items of property list item "Children" of property

由于macOS Mojave,我无法再阅读bookmarks.plist文件了。我认为这是基于莫哈韦新的安全角色

在过去,我是用这个AppleScript片段来完成的:

-- 
-- read the bookmarks to an new object
--
tell application "System Events"
    repeat with i in (property list items of property list item "Children" of property list file tfile)
        tell i to try
            if value of property list item "Title" = "BookmarksBar" or "Title" = "BookmarksMenu" or "Title" = "com.apple.ReadingList" then
                repeat with thisDict in (get value of property list item "Children")
                    tell thisDict to set end of myRecord to {tURL:its URLString, tTitle:its |title| of URIDictionary}
                end repeat
                -- exit repeat
            end if
        end try
    end repeat
end tell
它是AppleScript的一部分,AppleScript获取Safari的所有书签并将其写入HTML文件


如何访问我的AppleScript中的Safari书签(现在在Mojave中),以将它们放入一个对象/数组中,就像上面我的旧代码片段一样?

阅读我回答中题为“MacOS Mojave限制”的部分-它解释了授予Terminal.app对
~/Library/Safari/Bookmarks.plist的访问权限的必要条件。大概你需要为AppleScript做一些类似的事情。谢谢你的快速回复。我尝试将“脚本编辑器”和/或脚本本身添加到“允许文件访问”策略中。但仍然不起作用。我认为这是因为“系统事件”试图访问bookmarks.plist。你有其他选择或想法吗?我如何告诉Safari返回每个书签?也许我可以告诉safari也这样做,从而删除plist文件。也许可以尝试授予System Events.app对整个磁盘的访问权限,即将其添加到“允许文件访问”策略中。如果我没记错的话,我想System Events.app位于
/System/Library/CoreServices/