"Container" Documents? Bastard Children of Groups and Docum

I believe this idea has been alluded to in other posts, but I might have a solution that hasn’t been suggested yet.

I use DTP, the whole DTP, and nothing but the DTP as the environment for planning and executing stuff I write. I use the 3-pane view exclusively, although it has some shortcomings. One of these is that if I make the document pane (lower right) larger, the group contents pane (upper right) becomes smaller. Since I often have a hundred or more documents in each group, that little pane gets very irritating to scroll through.

I could add subgroups, but I really don’t want to. If I have a top-level group for each volume in a ten-volume series of books and within each twenty or so groups for chapters, I don’t really want to make a group on the same level for characters, one for settings, and so forth. At the same time, I don’t want to create a different hierarchy at the top level of the database, since that violates the first Common Sense Rule of Organization: Keep things you use together in the same place or as close to the same place as possible.

The easiest solution would be to have something in between a group and a document – something that shares some features of each but lacks others. Essentially, I am thinking of a group that is shown in the same places that documents are shown and invisible in the places that only groups are shown. With the 3-pane view, such a “Groukument” would be invisible in the left pane but visible in the upper-right pane.

Since the Groukument is visible in the document list pane, it should behave in some ways like a document. I can think of three different behaviors when “viewed”:

  1. The document view pane shows a list of the Groukument’s contents, much like the Search window (or a second document list pane, or whatever – anything would work).
  2. The document view pane shows a default document associated with the Groukument, much like the Apache web server’s default behavior of returning an “index.html” or “index.php” or whatever when a surfer requests a directory with no specified page. This default document could be specified much the way we currently specify script attachments for documents and groups, or even be generated through the use of an attached script. This would be my preferred behavior, since my note below would make #1 redundant and #3 is just plain lame.
  3. The document view pane shows nothing. Hey, it’s easy to code.

There would be no benefit to having Groukuments if all they did was sit in the document list view. I would assume it would be most useful if it could be “expanded” or “collapsed” to show the contents, indented a tad perhaps for readability, in the document list pane. I figure that it could use much the same, ah, arrangement that the current “state” checkboxes use. Check it to show the contents or uncheck it to hide the contents.

So, in conclusion, I could see this doing a lot of good things – fighting clutter in the document list pane, fighting clutter in the group list pane, increased accuracy for the DEVON AI (I assume more groups and tighter classifications are better for it), less screen real estate required for the document list pane, and so forth.

As it is basically just a group that’s invisible in the group list pane and visible in the document list pane, I would expect that it would be somewhat less daunting of a task than other ideas that might accomplish similar things. Even if this is all that is done, and “Groukuments” essentially act only as replicants of invisible groups, I think all of the benefits listed above still work. If nifty enhancements are provided like displaying a default document in the document view pane, the ability to view its contents in the document list pane, and so forth it takes a clever hack and turns it into a killer feature.

Since I’m on the topic of different ways this could be implemented, I think that (in DTP 1.X, at least) it can be viewed as a combination of a couple comparatively minor alterations to DEVONthink:

  1. Allow invisible groups (shown or hidden with a preference, naturally).
  2. Allowing a new type of document that, when viewed, redirects to an invisible group. This might be possible already through attaching an AppleScript to a document. (I’ll see if I can hack this out later)

Also, if there were a way through AppleScript to allow the document list pane and document view pane to be set independently, that would probably take care of the “default document” feature. Something like

tell application "DEVONthink Pro"
view record 243 in document list pane with independence
view record 387 in document view pane with independence

Just an idea. I understand that functionality would still have to be added to DEVONthink Pro, that it’s non-trivial and probably impossible (or impractical, requiring rewriting of some basic frameworks or something), but I thought I’d suggest it anyway.

I’m not sure how many people would find these features useful, but I’ve seen questions about similar things in the past (one recently, although I can’t seem to find the thread). I figure I’m not the only person who’s anal-retentive about his group hierarchies.

If you select a group in DEVONthink Pro and run the following script, you will get a “sort of” alias to a group. When triggered, it will open a new window on the aliased group. I attempted to find a way to set the current record of the DTP window to the aliased group, but apparently DTP’s applescript dictionary is at least 10% smarter than me (or it’s just not possible). It gets the location of the group from the alias’s comment, not its title, so it can be renamed at will. It can also serve as the default document, I guess.

Anyway, this sort of does what I was looking for – decluttering the folder hierarchy and making a group sort of visible in the document list pane. The referenced group still has to exist somewhere else in the database, and it’s a pretty ugly kludge. But oh well. DEVONtechnologies helps those that help themselves, perhaps.

on run
		set theScriptPath to POSIX path of (path to me)
		tell application "DEVONthink Pro"
			set theSelection to the selection
			if theSelection is {} or ((count (items of theSelection)) is greater than 1) then error "Please select one and only one group."
			set theLinkedGroup to item 1 of theSelection
			set theTitle to the location of theLinkedGroup & the name of theLinkedGroup
			set theRecord to create record with {name:theTitle, comment:theTitle, type:rtf, rich text:theTitle, attached script:theScriptPath}
			my triggered(theRecord)
		end tell
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end run

on triggered(theRecord)
		tell application "DEVONthink Pro"
			set thisResult to get record at (the comment of theRecord as string)
			open window for record thisResult
		end tell
	end try
end triggered