Opening Databases

While I’m using DevonThink Pro very successfully for the most part, I continue to have a minor annoyance with opening databases. I wan’t able to find the answer elsewhere in the manual, forums, or FAQ, but perhaps my search terms were too general or I wan’t using the right terminology. Feel free to point me to an answer if it exists elsewhere.

I have multiple databases that I use for different things, and often like to close the window when not actively using them (Use a Command-W rather than minimizing it and having it further clutter up my dock).

When I want to return to DT, I can do one of the following:

  1. Use QuickSilver to select the database and open it (fastest)
  2. Click a shortcut on the dock to my DB file (requires mouse)
  3. Navigate to the database in the Finder and double click it

My problem is that these steps won’t open the database if it was the last DB viewed. They will cause DevonThink to be activated, but the database is not displayed. In fact, if I close the window with a Command-W it will no longer open with the “open database” or “open recent” commands. At this point I need to manually select the “close database” command in order for future opens to work (somehow it is kept open but not visible?). I can get around this, however, by using the “New Window” command but need to remember which database was previously open.

I can easily reproduce this problem with only a single database. The behavior between the “database closed” state and the “database open but no window” state is inconsistent when opening via the Finder.

Do I have something configured incorrectly or am I taking a step somewhere that is obviously wrong? Why won’t the database files open reliably like every other document with every other application on my Mac?

The difference is, that when you close the window, the database itself is actually still open. So, when you activate DEVONthink again, nothing happens because it simply returns to the state in which it was before. When you actually close the database (File > Close Database) and reopen it, a new window will appear as expected.

Eric.

I appreciate the response, but I don’t think it really answered my question. After your explanation, I think I can clarify what I"m looking for but it doesn’t appear that DevonThink can do this.

When the database file is “opened” via the finder, dock, or other method I’d like to ensure that it is both open and visible.

I wrote a pretty simple Applescript to handle this. Though this is probably more appropriate for the scripts forum, I’ll share it so that others can benefit. While not perfect (I should compare the current database to the one that I’m opening, but my DBs are currently small enough that open time is not an issue–I’ll deal with this when necessary), it seems to solve my problem:


--	Droplet OpenDTDB
--	Description: This droplet closes the current DT database and opens a new one.  This way, double clicking in the finder or any other method of "opening", such as Quicksilver, will have my desired behavior.
--	Usage:  Save as Application Bundle and set "Open With" in Finder to this application.

on open filepath
	
	if (count of filepath) is not 1 then
		error "Only one DB may be open in DevonThink"
	end if
	
	set file_info to info for filepath
	if name of file_info does not end with ".dtBase" then
		error "It doesn't look like this is a DT DB"
	end if
	
	set dbpath to POSIX path of filepath	
	
	tell application "DEVONthink Pro"
		activate
		tell application "System Events"
			tell process "DEVONthink Pro"
				tell menu bar 1
					click menu item "Close Database" of menu "File"
				end tell
			end tell
		end tell
		open database dbpath
	end tell
end open

ryans, unlike Windows, closing the last open window of most Mac applications doesn’t close the application.

You and I operate differently. I’ve used File > Database Properties to designate one of my databases as default, so that when DT Pro is launched (e.g., by a script if it’s not open already) it will open with a database that can receive data.

I’ve set preferences to send most incoming information to my “Incoming” group. If the default database receives documents that I would rather place into a different database, I select them and export them using File > Files & Folders to a target folder in the Finder. Then I import them into the appropriate database next time I open it.

And I’ve set preferences to remember the state of open windows and open those windows again next time the database is opened.

My practice is to have several windows open as a familiar workspace, which may differ from project to project.

I use Apple’s Expose to quickly switch between open windows.

And I usually use File > Open Recent to switch databases. On my Macs even rather large databases typically take only seconds to switch.

Bill, I appreciate the input. I’m still having some difficulties understanding the apparent inconsistency with this otherwise excellent application. I think that we’re talking past each other. My issue isn’t with basic Mac behavior (“unlike Windows, closing the last open window…”) nor personal preferences regarding how to switch between open windows (“I use Apple’s Expose…”). I understand the points that you have made, though my personal preferences differ.

I’ve managed to resolve my problem with a workaround and my interest is waning, but I think that the behavioral inconsistency within DT and the difference in behavior between DT and other applications deserves some sort of resolution.

I may be missing something, so please consider this example. Take a random application of your choice that acts upon documents. In the Finder (or place that document in your dock), double click on it to open. The document will open in the intended application. Now close the window with the red button or Command-W. Reopen the document again with the Finder or Dock. The document opens and becomes visible again!

DT doesn’t work this way after a window/document has been closed. After DevonThink has exited, this works properly. Opening a database with the Finder works properly (Strangely enough, regardless of the “Default Database” property). I understand that multiple windows for a database complicates this somewhat, but this doesn’t prevent DT from closing down all windows of an open database when another DB is opened via the Finder.

In my opinion, I see a major inconsistency in the way that open and closed databases are handled. This may not be a major issue for most users–While I like Expose and don’t mind using it when my hand it on the mouse, I prefer to use the mouse as little as possible (keyboard shortcuts are faster for me and my wrist hurts less at the end of the day the less I use it) and also like to close windows when they are not being used (I can focus better and am less distracted with a single task on my screen). Because of this, the ability to close the window and reopen it by opening the database file is important to me.

ryans, I don’t think there’s an inconsistency.

Yes, if I have Word open and close the window for a document, that document (which is a separate file) is closed. But the Word application remains open. Double-click on the same or another Word document and it’s window opens. A Word document is a file that opens under MS Word. A DT Pro database is a file that opens under DT Pro. If while viewing a Word document I press Command-W, I close that document file. But if I’m in DT Pro and press Command-W, I don’t want to close the database, I just want to close one of many possible views into that database.

DT Pro can open without opening a database, just as Word can be open without opening a document. (But I don’t recommend that, as a database has to be open in order to receive content transmitted, e.g. from a script or DEVONagent. We do recommend that you designate a database as default, so that each time DT Pro is launched it does so with an open database.)

Now open a database in DT Pro. If you have set preferences to open the windows that were open when the database was last closed, those windows will open.

Now close all the windows. Note that the database is still open. There’s nothing wrong with that behavior. That’s because the windows are views into the database. If you select File > New Window the top-level view of your database will open. Or, it you select Tools > Show Groups you can double-click on any group you wish, even one far down in the hierarchy, and open it as a view.

I’ve got 1,047 groups in my database and over 20,000 documents. So, unlike Word, there are many possible windows that might be of interest.

Even when you don’t have a view open, the database is active. It can receive new content via scripts or from DEVONagent, for example. That’s important. We don’t want a database to be closed just because there are no open views into it.

Note that you can configure DT Pro preferences so that when a database opens nothing happens; or a window (the top-most view) is opened; or the windows that were last open when it was closed are opened.

Mail is another database application. You can close all the windows in Mail, but it remains active and capable of receiving new mail. But if for some reason you’ve closed all the windows, you will have to go to the menu bar and choose an appropriate command to open a window so that you can check your mail. Likewise, iTunes is a database that remains active even if you have closed all the view windows, so a download of a movie, for example, can continue.

Are there some apparent inconsistencies in Mac programs? Yes. For example, iPhoto will quit if you close all the windows. That probably doesn’t cause the user of iPhoto problems. But similar behavior in DT Pro could cause problems for the user.

Got it. I understand the benefit of having a database open.

Rather than opening or closing the database, a default view when an open database is reselected would be nice. In iTunes, if I open a music file in Finder that is already part of my open iTunes database it has a default action (it plays the file). Mail has a corresponding default action with any file opened with it (it attaches the file to a new message). DT’s behavior varies. if the DB is already open it does nothing. If no database or a different database is open it closes it and opens the new one, including new windows.

This may be an issue with the way that I’m using the DT application. Some applications work on documents–I don’t open Preview or Word and then use the “open” command within the application to open a document. I think in terms of documents and the application is a means to view and/or edit that file. Other applications are run directly and stand alone–iTunes, Finder, and the-terminal-of-your-choice are good examples.

I think I need to consider DT one of these standalone application with a single database rather than thinking in terms of individual documents (“notes”, “project a”, “personal”). I’ll probably see more interesting and unexpected classifications and see also results as a nice side effect. I should be able to merge my databases easily enough and give this a shot.

We’ll agree to disagree on the consistency factor, but your replies have given me some good ideas on how to use this program more effectively that I’ll try. Thanks for your help.