I do not find any term in DEVONthink’s AppleScript dictionary about the history of a database.
Someone can open the history window using the following AppleScript:
set process_name to displayed name of (info for (path to frontmost application))
tell application "DEVONthink Pro"
tell application "System Events"
tell process process_name
keystroke "h" using {command down, shift down}
end tell
end tell
end tell
Is it possible to get programmatically the most recent record using AppleScript?
You could get the Contents of a Database (or all open databases), then create a list of records comprising the Reference URL and Modification Date of each record in Contents. Then sort that list. And use the Reference URL to access the most recently modified record.
An AppleScript which implements Korm’s instructions is the following:
tell application "DEVONthink Pro"
set allRecords to contents of current database
set myData to {}
repeat with i from 1 to count of allRecords
set end of myData to {modificationDate:modification date of item i of allRecords, DEVONthinkUuid:uuid of item i of allRecords}
end repeat
tell application "ASObjC Runner"
set sortedRecords to rearrange records myData by keys {"modificationDate"} ascending orders {false}
set uuidLastModifiedItem to DEVONthinkUuid of item 1 of sortedRecords
end tell
set lastModifiedRecord to get record with uuid uuidLastModifiedItem
end tell
You might consider eliminating items in the Tags group - a tag in that group could be the most recently modified record, but what the user probably wants to find is the document that was tagged, not the tag.
I could see using your technique with the “log values” command in ASObjC to keep a work record (with time stamps and duration between modification date-time) to support time billing for advisors who are working out of a DEVONthink database. (You can see where my mind’s at, today. )