See what groups a publication belongs to.
Posted: Sun Oct 04, 2020 5:11 pm
Hi there,
I am expanding Zach’s (Aliases zvh) “Autolinking Bookends and DEVONthink records” script to create tags in Devonthink that correspond to the Bookends groups that a given publication item belongs to. For that I need a list of all of those groups.
It is possible to see list I need in Bookends as a groups column
I have written a script to do this, by searching through each group for the publication item.
Is there a more efficient way to get this information?
Thanks in advance,
Manny
I am expanding Zach’s (Aliases zvh) “Autolinking Bookends and DEVONthink records” script to create tags in Devonthink that correspond to the Bookends groups that a given publication item belongs to. For that I need a list of all of those groups.
It is possible to see list I need in Bookends as a groups column
I have written a script to do this, by searching through each group for the publication item.
Code: Select all
tell application "Bookends"
tell front library window
set theAllBEGroupIDs to get (id of group items)
set BEGroupList to {"ASTest1"}
repeat with BEGroup in BEGroupList
set theBEIDs to get (id of publication items of group item BEGroup whose date modified comes after lastRunTime)
if theBEIDs is not {} then
repeat with theBEID in theBEIDs
try
set thisReference to first item of (publication items whose id is theBEID)
set {theBEID, theBEPaths, theBEAuthor, theBEEditor, theBETitle, theBEPublicationDate} to {id, path of attachment items, authors, editors, title, publication date string} of thisReference
-- get a list of groups that the reference belongs to
set theGroupsThatReferenceBelongsToList to {}
repeat with theBEGroupID in theAllBEGroupIDs
try
set currentGroup to first item of (group items whose id is theBEGroupID)
--search Bookends Group to see if the current publication item belongs to it
set inCurrentGroup to first item of (publication items of currentGroup whose id is theBEID)
if inCurrentGroup is not {} then
set end of theGroupsThatReferenceBelongsToList to currentGroup
end if
end try
end repeat
end try
end repeat
end if
end repeat
end tell
end tell
Thanks in advance,
Manny