For me, historical structure of documents is an important organizing principle. I would like to maintain smart groups of all the records that I worked on during a particular week or month etc, and a folder that contains replicants of all the records that I worked on on the same day as the current record. The standard smart groups template doesn’t work for me because using last modified or opened date means that if I work on a document today, it will be removed from eg last month’s, or last week’s group.
I would like a script that maintains in the spotlight comments field a log of every date when a record is modified. Then it would be easy to set up the smart folders that I need.
Does anyone have such a script?
As scripts can’t be automatically executed after modifying a record, the script would have to be executed by the user. Anyway, a simple script could look like this:
tell application "DEVONthink Pro"
set theRecord to content record
tell think window 1 to save -- Save pending changes
set theComments to comment of theRecord
set theComments to theComments & (modification date of theRecord as string) & return
set comment of theRecord to theComments
end tell
Thanks so much for your reply!
I note your remark that a script cannot be set up so that it activates every time a record is modified. But it could be set up, could it not, so that it activates every time a record is opened? That would work for me.
(I am an old Hypercard / Hypertalk user, where a card’s script was more closely integrated with the card / record).
That’s doable. Just attach this script via the Info panel to the record(s):
on triggered(theRecord)
tell application "DEVONthink Pro"
set theComments to comment of theRecord
set theModificationString to (modification date of theRecord as string)
if theComments does not contain theModificationString then
set theComments to theComments & theModificationString & return
set comment of theRecord to theComments
end if
end tell
end triggered