I wrote a small utility: show a list of sorted documents in the “Reading List”, click on the name and open a document window. The script allows me to see the complete name of items in the reading list and in a sorted manner, and without needing to switch to the “Reading List” sidebar.
There is one catch, the one line of code to change the status of “unread” to false doesn’t work.
Hope this script will be useful to the other forum members.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- ngan 2020.01.22
tell application id "DNtp"
set theReadList to reading list
set l to {}
repeat with each in theReadList
set the end of l to title of each
end repeat
set l to my sortlist(l)
set theDocName to (choose from list l with prompt {"Choose Document"} default items "" with empty selection allowed) as string
if theDocName is not {} then
repeat with each in theReadList
if (each's title) is equal to theDocName then
set theLink to each's |URL|
-- this line of code doesn't work
-- if each's |unread| is true then set each's |unread| to false
end if
end repeat
set theDoc to get record with uuid my lastN(36, theLink)
open tab for record theDoc
end if
end tell
on lastN(n, s)
set l to length of s
return text from character (l - n + 1) to character -1 of s
end lastN
on sortlist(theList)
set theIndexList to {}
set theSortedList to {}
repeat (length of theList) times
set theLowItem to ""
repeat with a from 1 to (length of theList)
if a is not in theIndexList then
set theCurrentItem to item a of theList as text
if theLowItem is "" then
set theLowItem to theCurrentItem
set theLowItemIndex to a
else if theCurrentItem comes before theLowItem then
set theLowItem to theCurrentItem
set theLowItemIndex to a
end if
end if
end repeat
set end of theSortedList to theLowItem
set end of theIndexList to theLowItemIndex
end repeat
return theSortedList
end sortlist