Rename using Custom Data for human being

This script renames based on Custom Meta Data.

Please try it with duplicates.

Setup

  • Open Script Editor.app
  • Paste the script
  • Replace mdextags in line set thisRecord_CustomMetaData_Value to mdextags of thisRecord_CustomMetaData with md plus your Custom Meta Data identifier
  • Save script to DEVONthink’s script menu folder
    ~/Library/Application Scripts/com.devon-technologies.think3/Menu/

Usage

  • Select some records in the item list (or one of the other views).
  • Run script via DEVONthink’s script menu.
-- Rename records based on Custom Meta Data

tell application id "DNtp"
	try
		set theRecords to selected records
		if theRecords = {} then error "Please select some records"
		
		repeat with thisRecord in theRecords
			set thisRecord_CustomMetaData to custom meta data of thisRecord
			try
				set thisRecord_CustomMetaData_Value to mdextags of thisRecord_CustomMetaData -- replace mdextags with "md" plus your identifier
				set name of thisRecord to thisRecord_CustomMetaData_Value
			end try
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell

1 Like