Skip to content

Instantly share code, notes, and snippets.

Created July 14, 2015 07:18
Show Gist options
  • Save anonymous/b9a8795897171ceaaf2c to your computer and use it in GitHub Desktop.
Save anonymous/b9a8795897171ceaaf2c to your computer and use it in GitHub Desktop.
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
set theBookmarks to current application's class "NSDictionary"'s dictionaryWithContentsOfFile:(POSIX path of (path to home folder) & "Library/Safari/Bookmarks.plist")
set bookmarksBar to missing value
repeat with theItem in (theBookmarks's objectForKey:"Children")
if (theItem's objectForKey:"Title") as string is "BookmarksBar" then
set bookmarksBar to theItem
exit repeat
end if
end repeat
if bookmarksBar is missing value then return
set folderInBookmarksBar to missing value
repeat with theItem in (bookmarksBar's objectForKey:"Children")
if (theItem's objectForKey:"Title") as string is "Folder Item" then
set folderInBookmarksBar to theItem
exit repeat
end if
end repeat
if folderInBookmarksBar is missing value then return
set theURLs to {}
repeat with theItem in (folderInBookmarksBar's objectForKey:"Children")
set theURLs to theURLs & {(theItem's objectForKey:"URLString") as string}
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment