Rule to Property to Detect Item in "Reading List"

I’m looking to do some Rules about my ever-growing “Reading List”. As a starter I cannot spot–probably there but escapes me–a property which defines (yes or no or whatever) that an item is in the Reading list?

Then what I want to do is do something with those items in the action list …

Actually there is no way to target the Reading List with a smart rule as it’s not considered a location.

OK. Pity. Thanks. I’ll think of something else. Maybe just read the things!

1 Like

Haha! I’m thinking that’s what the Reading List is for :wink:

Yea, but with multiple reading lists and too many things to read … (was hoping to get the stuff onto my phone easily and read/scan while watching boring TV with family).

What about using an AppleScript? Is there a property of the item that I can check if it is in Reading List?

Did you check the scripting dictionary? That’s the most reliable source for this kind of information

What do you want to achieve? Now that you can manually set the “mark read/unread” status of a document you could use that instead.

E.g. I file items in their correct folders but leave them unread. It’s then just a couple of clicks to filter a folder to unread. You can set up the same unread filter view with tags. That way, I can have a “reading list” that is grouped by topic.

I am new to AppleScript. So, my knowledge will be very limited. I took a look at the dictionary. Checked Item, Record. Didn’t find Reading List as item/record property. In fact, Reading List is a property of the application. So, no way to check if an item/record is in Reading List? Hope I didn’t overlook any thing in the dictionary.

I have limited space in my MacBook Air and Dropbox/iCloud (for sync). So, I store audio and video files in external hdd attached to the MacBook Air.

I have YouTube, podcast auto download using one of the provided scripts.

Whenever I want to read/watch/listen something, I add to the Reading List. I want to move the audio and video files (since they are large, especially video files) from external hdd to internal hdd and sync to the Dropbox/iCloud, when I add some audio/video files to the Reading List. When I finished listening/watching, I remove from Reading List. They should them be moved back to external hdd.

I currently use Flag to achieve that. But I have other purpose for Flag. I want to keep Reading List more for reading/learning. And keep Flag for other purpose, if I can achieve using Reading List.

Personally, I simply wouldn’t try to get old to it. Therefore, I won’t talk about AppleScript here, but about JavaScript.

Back to the task at hand. The dictionary tells you that
readingList is a property of the Application object, which is of type list. So, this code (again: JavaScript, not AppleScript) gives you all reading list items:

(() => {
  const app = Application("DEVONthink 3")
  const readingList = app.readingList();
 })()

What the dictionary calls a list is an Array in JavaScript. Therefore, you can inquire its length property with readingList.length and loop over all elements in the Array with (for example) forEach:

readingList.forEach(item => {
  // do something with item
})

Unfortunately, the scripting dictionary is terse (rather: dead silent) about the elements of the list. But if you run the first sample in script editor and inspect the Apple Events, you’ll get a fairly good idea what these items look like. One of the items’ properties is ‘URL’, and it is in reality a DT item link. The next lines will identify the corresponding record:

readingList.forEach(item => {
  const UUID = item["URL"].replace(/^x-devonthink-item:\/\//,'');
  const record = app.getRecordWithUuid(UUID);
  console.log(record.name());
}) 

The original question by @rmschne (and your question as well) was the inverse to this piece of code. To not spoil the joy of coding, I won’t post the solution here but just describe it

  • get the UUID(s) of the record(s) you want to check
  • get the reading list
  • use the filter method to find those records that are in the reading list

Disclaimer: I only test the first sample of the code posted here. The goal can certainly be achieved with AppleScript. Coding it in that language will be even more fun because it’s lacking a filter method. Maybe whose can come to the rescue, but I don’t know

1 Like

As correctly determined by @chrillek, you’d have to parse the reading list itself to do anything with those items.

Many thanks. Will explore it with AppleScript, or even JavaScript.