Hi, I’ve set up a feed for unread articles from my Pocket account in DEVONthink. That’s really nice.
But I have to delete the articles I’ve read from the account. I’ve got this script, which worked, as long as I worked on the script… Now it gives an empty list as result, because I tested it on replicants in a normal group… took me long time to find that out
I know replicating in a group and using “delete” is possible, but I don’t really like it, as I prefer having the record in the trash to get back to it if I missed something (therefor the label).
While writing this, something came to my mind: what about API? I have no clue what can be done with it, but as far as I understand its like a bridge. So maybe there is a way to delete content directly from a Pocket account?
tell application id "DNtp"
set PocketFeed to parent id 419952 of database named "Test"
set ReadList to {}
set ReadListName to {}
set PocketItems to children of PocketFeed whose type is bookmark
repeat with PocketItem in PocketItems
if unread of PocketItem is false then
set end of ReadList to PocketItem
set end of ReadListName to name of PocketItem
end if
end repeat
if ReadListName is not {} then
set deleteItem to item 1 of ReadList
set deleteItemName to item 1 of ReadListName
set the clipboard to deleteItemName
tell application "Safari"
if window "Pocket: Meine Liste" exists then
activate
else
make new document with properties {URL:"https://getpocket.com/a/queue/list/"}
activate
end if
end tell
set label of deleteItem to 4
move record deleteItem to trash group of database of deleteItem
else
display dialog "DEVONthink: Keine weiteren Pocket Artikel gefunden!" with title "Gelesene aus \"Mein Pocket\" löschen"
end if
end tell