Another reading list popup

I am doing some intensive literature review these days and have added more than 80 topical papers in the reading list. I find the standard function of reading list pane is less convenient than expected due to (1) the list can’t display long file name (only display one line for each item) (2) I always click on those unread documents accidentally, the bold/unbold feature is becoming useless for me.

I now switch to a different method:

(1) I create a Boolean-type cmd field = “readinglist” to mark those to-be-reviewed papers. In my case, I have marked 80+ papers to be reviewed in the next few weeks.

(2) I run the script to filter out the more relevant papers within the list of those papers. If no filter is needed, just hit ok with the empty field.

(3) A popup window that shows all the relevant papers. Double-click on the item and open the document.

(4) I use TextExpander app to speed up the typing of those predicates. Such as “nn” for “name:~” and “cc” for “content:”. This makes the entry of predicates much faster.

I hope that the script may be useful for some forum members.
Cheers

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

-- ngan 2020.02.05
-- V1.3 search documents with CMD==readlinglist

property withSearch : true
property cmdName : "mdreadinglist"

tell application id "DNtp"
	set theTitle to "Search In Reading List"
	set theScope to " scope:database "
	
	if withSearch is false then
		set thePredicates to theScope & cmdName & "==1"
		set theReadList to search thePredicates
	else
		repeat
			set thePredicates to display name editor info theTitle default answer " "
			if thePredicates is not "" then exit repeat
		end repeat
		set thePredicates to thePredicates & theScope & cmdName & "==1"
		set theReadList to search thePredicates
	end if
	
	set l to {}
	repeat with each in theReadList
		set the end of l to name 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
	-- display dialog theDocName
	
	if theDocName is not "false" then
		repeat with each in theReadList
			if theDocName = (each's name as string) then
				set theLink to each's uuid
			end if
		end repeat
		set theDoc to get record with uuid 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

Thanks again.

This scripts just searches the databases not the reading list.

I don’t use readinglist pane anymore. I check on a Boolean-type cmd field for making a document to be read.