Skip to content

Instantly share code, notes, and snippets.

@mikker
Created May 13, 2020 20:59
Show Gist options
  • Save mikker/9304b2c2f14e500c4cc9063e6d8bc9af to your computer and use it in GitHub Desktop.
Save mikker/9304b2c2f14e500c4cc9063e6d8bc9af to your computer and use it in GitHub Desktop.
Open Reading List in Tabs.app

Open Reading List in tabs

  1. Make a new Automator document of type "App"
  2. Add these three steps in order
  3. Remember to replace mikker with your own username in the AppleScript scripts
-- Copy the file to $HOME because of some permissions issue
tell application "Finder"
copy file "Macintosh HD:Users:mikker:Library:Safari:Bookmarks.plist" to folder "Macintosh HD:Users:mikker"
end tell
#!/usr/bin/env ruby
# Note! Set Shell to "/usr/bin/ruby" and install a gem:
# $ gem install CFPropertyList
require 'cfpropertylist'
require 'fileutils'
path = File.expand_path '~/Bookmarks.plist'
plist = CFPropertyList::List.new file: path
list = plist.value.value["Children"].value.select do |item|
if title = item.value["Title"]
title.value == 'com.apple.ReadingList'
end
end.first.value["Children"].value
bookmarks = list.map do |item|
item.value["URLString"].value
end.reverse
puts "Opening #{bookmarks.count} tabs "
bookmarks.each do |url|
`open "#{url}"`
end
-- Cleanup
tell application "Finder"
move file "Macintosh HD:Users:mikker:Bookmarks.plist" to trash
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment