batch "set title"

Just spent some time trying to learn applescript, but its going to take a while. Until then, could somebody help out with a script for batch “set name”? The process would be as follows: one would manually select a group of files to be renamed. The script would then rename the file, as does the “set name” script already posted on this forum, and move on to the next file, etc., until all of the selected files have been renamed. The renaming would be according to the first line/paragraph in the file.

Any help would be appreciated.

Also: any recommendations to good (and free) sites/books on leearning applescript, or on how to create automator actions (i.e. beyond those that are preconfigured with in the applications window of automator)? Thanks.

The next release of DEVONthink Pro will include an action that helps you to rename records. But not based on the contents of the record however.

Our online help has a lot of references for learning AppleScript (search for “Learning AppleScript” in the Help application).

As for learning to write Automator actions, you’ll need to use the Apple documentation and examples that come with Xcode 2.2.

This should do the trick

tell application "DEVONthink Pro"
	tell front think window
		set curr to selection
		repeat with r in curr
			set atxt to plain text of r
			set aname to first paragraph of atxt
			set name of r to aname
		end repeat
	end tell
end tell