viewtopic.php?p=28699#p28699
However, it should be possible via AppleEvents. I've written an AppleScipt that finds references with attached PDFs that were modified in the last 2 weeks. The results are placed in a new group called "PDFs modified in Last Two Weeks".
The time interval (e.g. last week, last 2 days, etc.) and folder name can be changed in the script to suit your needs.
I'm certainly no AppleScript maven, and I'm sure it can be improved in many, many ways. There is only rudimentary error checking, and because it has to interact with the Finder and System Events, it will be relatively slow. But since it works asynchronously, you can use Bookends while it's running.
Code: Select all
use AppleScript version "2.5" -- macOS 10.11 or later
use scripting additions
tell application "Bookends"
try -- check for open library window
set w to first library window
on error errmsg -- you can display the actual error message if you prefer
display dialog "No Bookends library window is open."
return
end try
tell front library window
set attGroup to group attachments
set pubsWithFiles to publication items of group attachments -- get all refs with attachments
set allPathNames to {}
set allRefsWithValidAttachments to {}
repeat with i from 1 to count of pubsWithFiles
set aPub to item i of pubsWithFiles
set theattachments to attachment items of aPub
repeat with p from 1 to count of theattachments
set attachment to item p of theattachments
set mypPath to path of attachment
if mypPath contains ".pdf" then -- only search for modified PDFs.
copy path of attachment to end of allPathNames
copy aPub to end of allRefsWithValidAttachments
end if
end repeat
end repeat
-------------------------
-- Use System Events get modification dates of each attached PDF
set nowDateTime to (current date)
set cutOffDate to nowDateTime - 14 * days -- looking for PDFs modified in the last 2 weeks. You can modify this and folder name.
set refsWithModifiedPDFs to {}
repeat with i from 1 to count of allPathNames
set thePath to item i of allPathNames
tell application "System Events" to set modDate to modification date of file thePath
if modDate > cutOffDate then
copy item i of allRefsWithValidAttachments to end of refsWithModifiedPDFs
end if
end repeat
---------------
-- create a new group (if necessary) and populate with references where attached PDFs were annotated in the last X days.
set groupName to "PDFs Modified in Last Two Weeks"
set myGroups to group items
set groupExists to false
repeat with i from 1 to count myGroups
if groupName = id of item i of myGroups then
set groupExists to true
set theGroup to item i of myGroups
set pubs to publication items in theGroup
remove pubs from theGroup
exit repeat
end if
end repeat
if groupExists is false then
make new group item with properties {name:groupName}
end if
add refsWithModifiedPDFs to group item groupName
end tell
end tell
Jon
Sonny Software