AppleScript: How long is my reading list?


If you are using Safari it's easy and powerful to interact with your browser via AppleScript. For example, trying to figure out how many items there are in that reading list can be done as follows:

set tfile to (path to library folder from user domain as text) & "Safari:bookmarks.plist"
set counter to 0
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" = "" then
                repeat with thisDict in (get value of property list item "Children")
                    set counter to counter + 1
                end repeat
                exit repeat
            end if
        end try
    end repeat
end tell
return counter

If you want to do more, such as extract the URL from that list or something similar, check out this thread from which I started.