Ordneraktion anpassen

Hallo,

ich möchte gerne eine Ordneraktion am Mac so anpassen, dass ein PDF in DT importiert wird, dann in eine spezielle Gruppe (Ordner) in DT gelegt wird und danach das Original gelöscht wird.
Wichtig wäre mir auch, dass ich nicht immer gefragt werde, in welche Gruppe importiert werden soll, sondern dass ich direkt den Weg zur Gruppe angeben kann, der Import also im Hintergrund passiert.

Leider wird diese Ordneraktion von DT nicht angeboten und ich bekomme es einfach nicht hin, aus den vorhandenen diese spezielle Aktion zu erstellen.

Kann mir jemand helfen, damit ich das hinbekomme?
Ich muss das dann für mehrere Ordner anpassen, wie gebe ich den richtigen Pfad zur Gruppe an, mit dem Verweis (diese ewig lange Nummer)?

Danke,
doescher

Am leserlichsten ist sicherlich die Verwendung des “get record at … in …”-Befehls, also z.B.


	set theGroup to get record at "/path/to/myGroup" in theDatabase

Hallo Herr Grunenberg,
danke für die Antwort, aber leider kann ich das auch nicht so richtig umsetzten.
Ich würde also die Aktion »Import to selected Group« nehmen und dort Ihre Zeile einsetzen:


on adding folder items to this_folder after receiving added_items
	try
		if (count of added_items) is greater than 0 then
			tell application id "DNtp"
				launch
				set theGroup to get record at "/path/to/myGroup" in theDatabase
			end tell
			repeat with theItem in added_items
				try
					set thePath to theItem as text
					if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
						tell application id "DNtp" to import thePath to theGroup
					end if
				end try
			end repeat
		end if
	end try
end adding folder items to

Stimmt das so?
Wie gebe ich den Pfad zu meiner Gruppe an, mit dem Verweis (der langen Nummer) geht das nicht?

Dann fehlt ja auch noch das Löschen der Originaldatei.
Wo kopiere ich diesen Code hin? Oder ist das so falsch (weil der Ordner nicht auf dem Schreibtisch liegt)?


if exists theRecord then tell application "Finder" to delete theItem

Sorry für die Fragen, ich habe keine Ahnung von Apple Script …
doescher

Sie könnten auch folgende Zeile verwenden:


	set theGroup to get record with uuid "<Insert UUID here>"

Falls Sie einen kopierten Verweis verwenden, so ist die UUID alles nach “x-devonthink-item://”

Komplett sähe das ungefähr so aus:


on adding folder items to this_folder after receiving added_items
	try
		if (count of added_items) is greater than 0 then
			tell application id "DNtp"
				launch
				set theGroup to get record with uuid "<Insert UUID here>"
			end tell
			repeat with theItem in added_items
				try
					set thePath to theItem as text
					if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
						tell application id "DNtp"
							set theRecord to import thePath to theGroup
							if exists theRecord then tell application "Finder" to delete theItem
						end tell
					end if
				end try
			end repeat
		end if
	end try
end adding folder items to

Nicht nur ungefähr, mit dem Verweis eingefügt funktioniert es wunderbar. :smiley: :smiley:
Vielen Dank für die schnelle Hilfe
doescher