0

Since macOS Mojave I cannot read bookmarks.plist file anymore. I think it's based on the new security roles in Mojave.

In the past, I did it with this AppleScript snippet:

-- 
-- 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

It's a part of an AppleScript which gets all bookmarks of Safari and writes it to an HTML File.

How can I access the Safari Bookmarks inside my AppleScript now in Mojave, to get them into an Object/Array like my old snippet above?

user3439894
  • 7,266
  • 3
  • 17
  • 28
HR123
  • 688
  • 1
  • 6
  • 15
  • Read the section in my answer [here](https://stackoverflow.com/questions/56517403/how-to-create-and-manage-macos-safari-bookmarks-programmatically/56663577#56663577) titled _"MacOS Mojave Restrictions"_ - It explains what's necessary to grant the _Terminal.app_ access to `~/Library/Safari/Bookmarks.plist`. Presumably you'll need to do something similar for AppleScript. – RobC Aug 30 '19 at 07:57
  • Thanks for your quick response. I'd tried it to add the "script-editor" and/or the script itself to the "File Access allowed" policy. But still not working. I think it's because the "system events" tries to access the bookmarks.plist. Do you have an alternative or an idea how could i tell Safari to return each bookmark? Maybe i could get rid of plist file by telling safari to do the same. – HR123 Aug 30 '19 at 13:27
  • Maybe try to grant the _System Events.app_ access to your whole disk, i.e. add it to the "File Access allowed" policy. I think the _System Events.app_ is located at `/System/Library/CoreServices/` if I remember correctly. – RobC Aug 30 '19 at 13:53

0 Answers0