DEVONthink Pro Office has a bug that causes it to spontaneously open databases on startup. While waiting for Devon to fix this, I want to make a KM macro that will work around the bug.
My idea was to close the errant database on both quit and launch, just to be sure.
To do this, I wanted KM to look for menu File>Close Database>[datbaseName] – if it exists, the database is open and needs to be closed.
When I use a KM macro with IF [menu] EXISTS, THEN, KM can’t tell the menu exists.
I also tried adapting this appleScript but it returns false when the menu exists as well.
Suggestions? Is there a faster, more efficient way to go about this?
A small, quick suggestion. Based on advice Peter gave me regarding an issue I was having triggering menus in Lightroom (the program generates the menus dynamically), I stumbled on a work-around that might work for you.
That's actually not strange at all. The database does not exist in DT's context at all until it is opened.
Here's how to go about opening a database:
set myDatabasePath to "~/Documents/DevonThink_Office/XYZ.dtBase2"
tell application "System Events" to set myDatabasePath to POSIX path of disk item myDatabasePath
tell application "DEVONthink Pro"
# Uncomment to Get-Info about your database including the path (the db MUST be open).
# properties of database "XYZ"
open myDatabasePath
end tell
Once a database is opened DT knows how to work with it.
Do not use the absolute POSIX Path if your db file is within your user-folder.
The tilde-path (aka $HOME-path):
~/
Substitutes for this portion of an absolute-path:
/Users/your_user_name/
This notation makes your path string much less likely to break in future.