Send file from Pathfinder to Devothink and delete

Hi KM community,
I use KM to trigger a AppleScript that send my Finder selection to Devonthink and then send the selection to trash. I don't know how to convert the script to do the same in Pathfinder. I saw in the forum some scripts for pathfinder... I hope that someone can help!!

The script for Finder is:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

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
		display alert "Nothing selected in the Finder"
	end if
end tell

tell application id "DNtp"
	set dest to display group selector
	repeat with currentFile in fileList
		set newRecord to import currentFile to dest
		log message (name of newRecord) & " imported to " & (name of dest)
	end repeat
	tell application "Finder" to delete selection
end tell

Thank you.

This is a question about how to change a macro to do something else so I moved out of the Macro Library category.

Anyone can give a help on this?


Here's what I use to get PF items to the the DT inbox. You can easily change the "move to Inbox" step to an AppleScript that puts the PF items in a specific group in a specified database.

11)Add selected files to DevonThink Macro (v10.1.1)

11)Add selected files to DevonThink.kmmacros (28 KB)

Thanks for the precious help. I think I'm almost there...
I just want to open the selector to chose where to archive the file, instead of sending it to Inbox. It get things lot easier for me.

I tried to add that funcionality but I get an error...

Is there any way to add the following to the macro or script?

tell application id "DNtp"
	set theGroup to preferred import destination
	set theGroup to display group selector
	tell application "Path Finder" to delete selection
end tell


Well, KM can run any AppleScript, but I have a different way of picking my groups (from a KM dictionary that I've constructed rather than the group selector), so I can't help you here I'm afraid.

Actually, I think this will do what you want:

11)Add selected PathFinder files to DevonThink via selector.kmmacros (30 KB)

Hi @rolian. Your help was fantastic. I will make further investigations on this.