move comments field to URL field

When downloading from JSTOR, the URL is placed in the comments field.

Can someone help with a script to move the contents of the Comment field into the URL field? To be useful, it should work on a selection of entries in DT. If this already exists on the forums (couldn’t find it), could someone point it out to me?

I played around with modifying some existing scripts, but was not able to get it to work. Sorry for the troubles, especially if it already exists.

Thanks in advance.

Here’s a modified version of the “Copy URL-to-path” example script:

-- Copy Comment to URL
-- Created by Christian Grunenberg on Mon Oct 02 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
		set this_selection to the selection
		if this_selection is {} then error "Please select some contents."
		show progress indicator "Updating Comments..."
		my copyComment(this_selection)
		hide progress indicator
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

on copyComment(theseRecords)
	local this_record, this_comment, this_type
	tell application "DEVONthink Pro"
		repeat with this_record in theseRecords
			set this_type to type of this_record
			if this_type is group or this_type is sheet then
				step progress indicator (name of this_record as string)
				my copyComment(children of this_record)
				set this_comment to the comment of this_record
				set the URL of this_record to this_comment
				set the comment of this_record to ""
			end if
		end repeat
	end tell
end copyComment

Thanks Christian! Works perfectly. Simple, I suppose, but I guess I’m even simpler-minded. :slight_smile: Thanks once again.