I’m trying to create a set of KM Macros to help filing stuff into DT. For now, I’m figuring out how to import from the Finder to DT and I’ve come across a weird behavior:
I have the following applescript set to a hotkey trigger in KM:
tell application "Finder"
if selection ≠ {} then
set fileList to {}
set sel to (selection as alias list)
repeat with thisFile in sel
copy POSIX path of thisFile to end of fileList
end repeat
else
display alert "Nothing selected in the Finder"
return
end if
end tell
tell application id "DNtp"
set dest to get record with uuid "82999D49-4644-438D-854B-4C1BA9D42AC7"
repeat with currentFile in fileList
set newRecord to import currentFile to dest
log message (name of newRecord) & " imported to " & (name of dest)
end repeat
end tell
This is set to work on a selected file in the finder. The UUID is the UUID of the target database’s INBOX.
If the file I select is not tagged in any way, everything works as expected. But if the file is tagged (with one or more tags) then i will get an untagged duplicate in the inbox, and a tagged duplicate in each of the tag groups.
Is this expected behavior? I’d have liked to have a single - tagged - copy of the file in my DT database …