how do you use comments?

Can people give me an idea how they use the comments section of the info panel? Do you use it like tagging/folksonomy metadata or otherwise? Do the comments help the search and auto/classify system?

Interesting question. Maybe even a topic for the Usage Scenarios subforum?

I’ve rarely used comments, but was recently inspired by a screenshot (on 43folders or some other GTD site) of a List view window with the Comment column enabled and comments used to annotate items.

I’d probably be using comments more if there were a “Show Commented Documents” search criteria. In other words, I’m often as interested in which items are commented as the actual comment text. It’s another way to filter and find what I’m looking for. And I still miss not being able to search for labeled items, but not enough to keep me from using labels… within manageable limits.

Generally, I’ve been reluctant to fully use certain features in DT (e.g. comments) unless their supporting tools (e.g. searches) are sufficient to sustain my coherently usable databases. And product evolution has been in my favor for adding capabilities I do find ways to use effectively (often immediately) so I’m not focusing on what’s lacking, although I certainly have no shortage of opinions and suggestions. :slight_smile:

I find comments useful for attaching descriptions to images in my DT database. I usually attach brief descriptions describing the origin and other useful information about the image. This is the logical place I find to put this information. Also when viewing the group containing the images in Icon view the comments are displayed when mousing over the images which I find is useful.

psmyth, I don’t seem to have the comments displaying when I mouse over my images in Icon view. I’m test-driving DEVONthink Personal Edition 1.9.3 – what version are you using? Is there a setting I need to modify?

Hmmmm! Just checked and this isn’t working in 1.9.3 for me either. This was definitely working previously. Anyone else seen this? I’ll report it as a bug. When viewing a window full of images this was very handly as you could see the information just by mousing over the items. I haven’t done any work on the particular project which uses those images recently which is why I hadn’t noticed the change.

I’m still figuring out my “work style” with DT. I saw an article (probably on 43folders) about maintaining a library of excerpts, quotations, etc. within DT. The author used the document title to house pretty much the entire bibliographical attribution for each snippet, but I found that to be difficult to browse and organize.

Instead, when I clip from a web site or enter passages of interest from books, I put the bibliographical attribution in the DT comment field. This is useful for me because it’s there if I really need it, but I don’t see it all the time. For most of the work I do, these clippings are more brainstorm/idea generation fuel rather than something I’m going to use as support in a paper, etc.

This may change in the future, but that’s what I’m currently using the comments area for.

I’ve decided to go whole hog and use the comments field for much of my metadata. So far I’m Including keywords for file type (NEWS, ARTICLE, BOOKnotes, Notes etc) and topics as well as more freeform data. Most usefully, I’ve adapted the smart group script to search only the Comments field. So if I want to gather all ARTICLES about COGNITION and ARTS but leave out the chaff in my notes and snippets, I can.

I’ve also adapted a script to ask for a Keyword and add the tag to the comment fields of multiple documents in one shot. Ideally I need to figure out how to grab selected text and bypass the ask dialogue alltogether - this would result in a kind of “Set as Comment” command to match “Set As Title”. But my scripting skills are very rusty and I haven’t figured it out yet.

Dumb question, I know, but can some scripter out there explain how to grab selected text into a variable and pass it on?

Oh and one more thing: Christian, since some of us are indeed using comments in novel ways; would it be possible to allow SORTING on the Comments field? That would be very useful for us anal keyword types.

Comment away

Eiron :confused:

I’d be interested in that script, mind sharing it?

Well it’s a bit of a sloppy adaptation of Christian’s “Add Suffix” Script; and I hope he doesn’t mind me posting it here, but it works and here goes:
I’m going to cut and paste “as is” so hopefully you can just cut and paste it back yourself. It might look a bit messy here but should paste OK into a new Applescript editor file. I suspect there’s a better way to do this but this will have to do for now.


using terms from application "DEVONthink Pro"
	tell application "DEVONthink Pro"
		activate
		
		try
			set this_selection to the selection
			if this_selection is {} then error "Please select some contents."
			
			repeat
				display dialog "Enter the comment to use:" default answer "" buttons {"Cancel", "OK"} default button 2
				set suffix to the text returned of the result
				if suffix is not "" then exit repeat
			end repeat
			
			repeat with this_item in this_selection
				set current_comment to the comment of this_item
				set new_item_comment to current_comment & suffix
				set the comment of this_item to new_item_comment
			end repeat
		on error error_message number error_number
			if the error_number is not -128 then
				display dialog error_message buttons {"OK"} default button 1
			end if
		end try
	end tell
end using terms from

I suppose I should have changed the variable names; but I’d rather keep as much of Christian’s clean code as possible. I suggest you add spaces before or after comments in the dialog box.

Good Luck

Eiron

Thanks Eiron, it worked! To use this fully I quickly realized another script would be needed to delete all info in the Comments field too, so I modified it further to do this. This is the first script I have ever “made” or modified (I really don’t know anything about it, just sort of poked around with it) but it seems to work fine, so here it is (use at your own risk):

using terms from application "DEVONthink Pro"
	tell application "DEVONthink Pro"
		activate
		
		try
			set this_selection to the selection
			if this_selection is {} then error "Please select some contents."
			
			display dialog "You are about to delete all contents in the Comments field, this cannot be undone.  Are you sure?" buttons {"Cancel", "OK"} default button 2
			
			repeat with this_item in this_selection
				set the comment of this_item to ""
			end repeat
		on error error_message number error_number
			if the error_number is not -128 then
				display dialog error_message buttons {"OK"} default button 1
			end if
		end try
	end tell
end using terms from

Tiger uses the “Spotlight Comments” field to store custom metadata about any file. This field is indexed by Spotlight, so of course it can be searched, used as the basis for a smart folder, etc. This can be very useful, if the discipline is established to create the comments when a file is either created or downloaded. To that end, there are a number of Automator scripts in the wild that, for example, allow the user to batch update a selection of documents in Finder.

This feature is very relevant to DT. When a file with Spotlight Comments is imported into DT (Pro, anyway), the Spotlight Comments are preserved in DT’s “Comment” field. As noted in the discussion above, these comments can be searched by DT, and with eiron’s adaptation* of Christian’s Smart Folders script, can be used as the basis for a DT smart folder. Also, with eiron’s and moses’ scripts above, the user can batch update a selection of documents in DT. A nice symmetry of function is thus maintained between the Spotlight-enabled Finder/file system and DT, using the same metadata for a given file.

Now, here’s a challenge. For those of us who save the same document in both Finder and in DT, it would be very useful to expand Christian’s “Import to DT (Pro)” folder action script. The expansion would prompt the user to add metadata to any file(s) added to the target folder, before that file is imported to DT. This would allow the following workflow:

1. Download, or create-and-save, a file to the target folder in Tiger's file system.  ("Documents" folder might work well here :wink: )
2. The folder action springs into action, prompting the user to add tags into the file's "Spotlight Comments" field
3. The user adds comments, clicks on "Save" button
4. The file is then both saved in the Finder folder and imported into DT, with tags intact in both instances.

Does something like this exist today? If not…I don’t know if Automator is up to the task, or if that’s something best accomplished in AppleScript.

Any takers?

  • eiron: could you post this script as well?
1 Like

Eiron,

I’ve liberated (i.e., stolen) your script and used it. It works perfectly! Thank you very much. Applescripting is one of those things I’ve meant to learn the past few years but have never managed to find the time to do (there are several other useful but unlearned skills I’ve got in this same “to do” category). Seeing what you’ve done and noting the 75,000,000 scripts (or so it seems) that they’ve put into Pro, maybe I’ll start to learn it little by little. Certainly plenty of go-bys.

Again, thanks.

ChemBob

Very cool scripts!

Eiron, any way you could share this one too? This would be most valuable. It’s been years since I’ve tried my hand at applescripting.

Alexandria

Here you go Alex


-- Smart Group (All Words)
-- Created by Christian Grunenberg on Oct Fri 22 2004.
-- Copyright (c) 2004-2005. All rights reserved.on run
	try
		tell application "DEVONthink Pro"
			repeat
				display dialog "Enter the words to use:" default answer "" buttons {"Cancel", "OK"} default button 2
				set theWords to the text returned of the result
				if theWords is not "" then exit repeat
			end repeat
			set theRecord to create record with {name:theWords, type:group, attached script:"~/Library/Application Support/DEVONthink Pro/Smart Group/All Words In Comments.scpt"}
			my triggered(theRecord)
		end tell
	on error error_message number error_number
		if the error_number is not -128 then
			display dialog error_message buttons {"OK"} default button 1
		end if
	end try
end run

on triggered(theRecord)
	try
		tell application "DEVONthink Pro"
			if type of theRecord is group then
				set theString to (name of theRecord) as string
				search theString comparison no case within comments operator all words replicate to theRecord with removing replicants
			end if
		end tell
	on error error_message number error_number
		if the error_number is not -128 then
			display dialog error_message buttons {"OK"} default button 1
		end if
	end try
end triggered

the changed line is


search theString comparison no case within comments operator all words 

where the search is within “comments” instead of within “all”. With some very minor tweaking of the script you can specify case, all words/any words etc. If I can do it, you can. To see the syntax, just take a glance at the Devonthink dictionary by choosing “DevonthinkPro” under Open Dictionary in Script editor.

Hope this does what you want.

Eiron

That did the trick! Many thanks, Eiron. And thanks too for the explanation. I will take a look at the syntax and play around with the script, and some other scripts as well. It would be well worth spending some time to learn how to do some basic scripting with Applescript.

But until then, this works great!

Alexandria

So I see that these smart folders are kind of pseudo-smart folders. It would make sense, now that I think of it, since it’s an applescript. But when I add a new file with an existing keyword in the comments field, I have to run the script over again and create a whole new folder. The new file is not automatically added to the ‘smart folder.’ This is rather cumbersome. Unless I’m missing something here.

I would like to reiterate the request, made often here, for true keyword functionality–with smart folders that are truly ‘smart’ and the ability to sort according to keywords, etc.

Alexandria

I agree with this. I don’t think they should be called “Smart Folders” but something else (perhaps “Scripted Folders”?)… it is confusing, given that they do not operate exactly like Smart Folders do throughout the rest of the system and the Apple apps. They are also not “set-up” like Smart Folders are in these other apps, but through the script menu. For Mac users who download and try DT expecting the advertised Smart Folders ability this will be confusing and disappointing. As the ability to have scripts attached to folders is very powerful in it’s own right I suggest keeping them, but calling them something else, and then introducing real Smart Folders that operate and are set-up like in the other more familiar apps.

Let me add one other problem I have found with calling them Smart Folders: they contain replicants. Real smart folders don’t even contain replicants, just references. Here’s the problem as I see it: let’s say I create a smart folder to contain all files with the words “olive oil” in it. Now, it contains replicants to my other DT docs. Let’s say File #1 contains the words “olive oil” and is in a Group called “Olive Oil Statistics”. At some point I decide that File #1 is useless for that folder and I will never need it again. I delete it from the Group Olive Oil Statistics hoping to have trashed it from my whole DT file system – but no, it is retained in my “smart folder”. OK, now I know clever DT users will chime in here and say to use the Delete All Instances feature, and that would work… but, let’s say I may not want to use that feature because I fear I may have the file rightfully filed somewhere else where I may want to keep it… you see the confusion? Sure, I can also go to my smart folder and see that a file is no longer red and know it is only in it now and get rid of it, but all this adds further complication. So, again, these are not really “smart folders” in the truest sense of the way Apple uses the term. Now the funcitonality I mention here, which is not akin to the way I would expect a smart folder to act could be extremely useful for other tasks and circumstances, but I believe it is misleading to be thinking of them as Smart Folders.

Alex, have you actually attached the script to the folder (using its get info window) ? This runs the script automatically every time the folder is opened. There is no need to “create a whole new folder” each time. I fail to see how this is inferior to TigerFinder’s new (REALLY pseudo) “Smart Folders” which after all are merely saved searches that run (rather slowly if you have a multiple external drive pbook like mine) each time they are “opened”.

The main drawback to DTpro’s approach is that the displayed number of enclosed items is not updated until you select/open the folder – hardly tragic. :wink:

As for being able to sort on the comments field I’ve repeated this request in here recently but no reply so far.

eiron:

Comment field sorting would be useful, although confusing/ambiguous/not helpful if there’s more than one text string. Having multiple sortable ‘metadata’ fields available that can be accessible to scripts would really open logical possibilities to warp speed.

This will be on my list to note to Christian.

And you are correct about the ‘smart group’ script, as it refreshes replicants of matching content every time the group is ‘opened’.

No, didn’t know you could/should do this. I created the folder with the script and assumed it was then ‘attached.’ I manually set it to the script in the info panel and it now works as you suggested–it updates when I open it.

I’m used to ‘smart folders’ meaning that when a file is created and keywords set, or whatever parameter determines whether it belongs in a smart folder or not, the file is automatically included. That is different than what DT does, though this is a real improvement over what it had before (nothing), and with the script attached, it does work more effectively, so thanks.

Alexandria