I’m wondering if there’s a way to retrieve the last group (folder) an item was in after it has been moved to a new group. My goal is to create a rule or script that logs both the new location and the previous location of an item into a log file each time it is moved.
in order to record the original parent group, you can include the moving action within the script. Here is an example using the display group selector AppleScript command:
property logFileUuid : "x-devonthink-item://example"
property selectorInfo : "Choose destination group"
tell application id "DNtp"
set theRecords to selected records
if (count of theRecords) is 0 then return
set logFile to get record with uuid logFileUuid
set logText to plain text of logFile
set destinationGroup to display group selector selectorInfo
repeat with theRecord in theRecords
set originalGroup to parent 1 of theRecord
set logText to logText & linefeed & linefeed & "name: " & (name of theRecord) & linefeed & "original location: " & (uuid of originalGroup) & linefeed & "new location: " & (uuid of destinationGroup)
move record theRecord to destinationGroup
end repeat
set plain text of logFile to logText
end tell
That’s a great idea. My approach would be to log the object movements that are carried out via drag & drop. Since it is also possible to undo the move with cmd-Z, it stands to reason that it is also possible to read the last group. As a result, an intelligent rule would be necessary that triggers a script after a move. The only problem is how to read the last group before the move using a script.