[script] URL > Comment

The purpose of this script (just a slightly modified copy of the bundled Creation > Modification Date.scpt) is to copy “DT-internal” URL metadata to the Comment field, preserving the URL in Spotlight Comments when the latter is copied to them when exporting documents.

-- URL > Comment.

tell application id "com.devon-technologies.thinkpro2"
	try
		set this_selection to the selection
		if this_selection is {} then error "Please select some contents."
		
		repeat with this_record in this_selection
			set this_url to the URL of this_record
			set the comment of this_record to this_url
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

Btw, it’s not clear from the description of this subforum - Learn how to automate DEVONthink Pro - if it’s the intended place to post scripts.

Of course it is :slight_smile:

If learning to automate DTP clearly implies also sharing scripts to do it… though the DT Scripting subforum title implies that purpose. :slight_smile:

Thanks for posting the script! It’s great that it will work with several docs selected.

Mark

Christian deserves most of the credit; I barely changed anything. :slight_smile:

And it’s easy enough to modify for a Comment > URL script to go the other direction, which I’d use less often but did happen to find a case for yesterday.