Set comments to location

Often I’ll be looking at a list of records in a smart group, drawn from all over the place – for example, all records labelled red – and wish I knew where they were located. You can open up the info box, of course, or hold the mouse over the name of each item, but this is time-consuming and can only be done one at a time. The simplest solution would be for the folks at DT to include “Location” as one of the columns in list view, but until they do here’s a workaround: a script to put the location of each record in its comments field, which does have a column devoted to it.

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	repeat with theItem in theSelection
		set theLocation to get location of theItem
		set the comment of theItem to theLocation	
	end repeat
end tell

It’s not ideal – you have to actually select the items you want so marked, then run the script, rather than just having DT do it automatically. And if you ever move an item, you have to remember to rerun the script. Still, I think it might prove useful – for example, you can set a smart group to show a list of duplicates, and know right away where each of them is, and which one to delete.

You’re welcome.

PS The script can easily be modified if you want to add the location to the existing comments – as written it will obliterate whatever you had there previously. (Also, if you want to list the UUID address instead, just put “get UUID” in place of “get location” in the fourth line.)

PPS If you want to include the database in the location, the script is as follows:

tell application id "com.devon-technologies.thinkpro2"
	
	set theSelection to the selection
	repeat with theItem in theSelection
		set theDatabase to the name of the database of theItem
		set theLocation to get location of theItem
		set the comment of theItem to theDatabase & theLocation
		
	end repeat
	
end tell
1 Like

The status bar displays the location of the selected item now too.

A slightly modified and “triggered” script could be attached to smart groups.