Dig Deeper

So far, I’ve only scratched the surface of DEVONthink’s vast array of capabilities. Although I can’t cover every last feature, I want to wrap up this book with a brief discussion of a few key features that are a bit more obscure or advanced than what the average user may need on a daily basis. I hope you’ll use this information as a starting point to explore and experiment with the app on your own.

Maintain Your Databases

In certain situations, your DEVONthink databases can become corrupted. For example, if a system process DEVONthink depends on crashes while data is being written, the files may not be stored correctly or completely. Disk errors and other random events having nothing to do specifically with DEVONthink can also cause problems with your databases. If you begin noticing problems—weird error messages, missing documents, groups, or tags, or anything else that’s out of whack—you can use any of several techniques to fix them. (And, it doesn’t hurt to use these from time to time as a preventive measure, even if you haven’t noticed any problems.)

Verify & Repair

The Tools > Verify & Repair command checks the selected database for errors, and if it finds any, it fixes those it can. So choosing this command is a quick and easy way to solve many common problems.

During the repair process, if DEVONthink finds any files in its package on disk that don’t have corresponding entries in your database, it (re)imports them and puts them in a new group, at the top level of your database, called Orphaned Files. You can then move these newly adopted documents to the group(s) of your choice.

Backup & Optimize

You can configure DEVONthink to automatically back up and optimize its database periodically in DEVONthink > Preferences > Backup. (When it does so, it backs up only the files containing metadata and indexes, not the documents themselves, which are more usefully backed up using Time Machine or your favorite backup utility.) However, regardless of that setting, you can manually perform the procedure at any time by choosing Tools > Backup & Optimize.

Restore from Backup

If the Verify & Repair command was unable to fix all your database problems, you might be best served by going back to your most recent backup (assuming you either had automatic backups turned on or manually used the Backup & Optimize command relatively recently). To do this, choose Tools > Restore Backup, select a backup (usually the most recent one is the logical choice), and click Open. DEVONthink reverts to the version of the metadata and index stored in that database. It doesn’t hurt, after doing this, to choose Tools > Verify & Repair again, just in case your backup was also damaged.

Rebuild Database

If all else fails (namely, you still see error messages or weird behavior even after Verify & Repair and Restore from Backup), your best course of action may be to ditch your index and rebuild it from the raw documents. Doing so generally preserves your group and tag structure, although some metadata may be lost.

To rebuild your database, choose Tools > Rebuild Database and click OK. DEVONthink exports all your documents and then re-imports them.

Use AppleScript and Automator with DEVONthink

Despite DEVONthink’s incredibly long list of features, it may not do everything you want it to do. Fortunately, it also includes extensive support for the Mac’s two main automation technologies, AppleScript and Automator. Using either or both of these mechanisms, you can add new capabilities to the program, automate complex sequences of tasks, and integrate DEVONthink in novel ways with other applications running on your Mac.

Many books have been written about AppleScript and Automator, and I couldn’t begin to offer a proper guide to using them here. (I can, however, put in a quick plug for my book Take Control of Automating Your Mac!) Instead, what I provide here is simply a quick overview of DEVONthink’s automation support, a few examples of included scripts and workflows, and pointers on where to learn more.

AppleScript

AppleScript is an English-like scripting language that was designed to be reasonably easy for non-programmers to learn. (Whether that turned out to be true or not is open to debate!) Apple provides a tool called Script Editor (in /Applications/Utilities) that facilitates writing, running, and debugging scripts (although other, more advanced scripting environments also exist).

An app that can be controlled by AppleScript is said to be scriptable, and DEVONthink is scriptable in the extreme, exposing more than 80 verbs (actions) and more than a dozen nouns (objects that can be acted on), each with various properties (parameters).

However, you needn’t know any AppleScript to start using these capabilities! DEVONthink includes over 100 preinstalled AppleScripts, which can perform an astonishing range of useful activities as they stand—and can also be used as models when creating your own scripts. These scripts can be used without any special knowledge, simply by choosing them from a menu—so it’s like having 100 extra features to play with!

I encourage you to try them out, and then if you’re interested, open a few of them in AppleScript Editor to see how they work.

Included Scripts

DEVONthink’s preinstalled scripts fall into four broad categories:

  • DEVONthink scripts: These appear on the Script menu (on the menu bar) only when DEVONthink is running, and thus are intended to be used from within DEVONthink. This is the largest category, with more than 70 scripts. The script files themselves are stored in ~/Library/Application Support/DEVONthink Pro 2/Scripts (and its subfolders). A few noteworthy examples:
    • Images: Among the scripts on this submenu are ones that can scale an image to various sizes—handy since DEVONthink itself can’t resize graphics, only zoom in or out when viewing them.
    • Reminders: These scripts create an event or to do in Calendar (or various third-party programs, such as OmniFocus and Things) based on the selected item in DEVONthink—including a link to the item.
    • Sheets: Although I said earlier that DEVONthink’s sheets can’t do calculations, as spreadsheets can, these scripts add a couple of rudimentary spreadsheet features, such as summing and averaging rows or columns.
  • Application-specific scripts: DEVONthink includes numerous scripts that appear on the Script menu in other applications (such as DEVONagent, Endo, Firefox, Google Chrome, Mail, Entourage, NetNewsWire, OmniWeb, Outlook, and Safari), enabling you to import content of various kinds and formats into DEVONthink. These scripts are stored in ~/Library/Scripts/Applications/Application Name. A few examples:
    • Add Linked Images to DEVONthink: This script, available for several browsers, looks for thumbnails on a Web page that link to larger images, and downloads the full-size image files into DEVONthink.
    • Add Links to DEVONthink: Similar to the last script, this one looks for links on the current Web page and adds each one to DEVONthink as a bookmark.
    • Add Tabs to DEVONthink: In Safari, adds bookmarks for all open tabs to DEVONthink.
  • Folder Action Scripts: These scripts (located in ~/Library/Scripts/Folder Action Scripts) are designed to be attached to folders such that when anything new appears in the folder, DEVONthink automatically imports it (with or without OCR) or indexes it.
  • System-wide scripts: DEVONthink also includes two scripts that appear on a DEVONthink Pro submenu of the system-wide Script menu, which is available from any app (including the Finder). These scripts are stored in ~/Library/Scripts/DEVONthink Pro. The scripts are:
    • Copy Selection: Adds a new plain text document to DEVONthink with the contents of the current selection
    • Link to Current Document: Tells DEVONthink to index just the current (frontmost) document (from any application)
Extra Scripts

Besides the automatically installed AppleScripts, DEVONthink includes 29 optional AppleScripts in the Support Assistant—choose Help > Support Assistant and click the Install Extras link at the bottom of the window to see and install them.

Writing Your Own Scripts

The best way to figure out how to automate something in DEVONthink using AppleScript is to open a related example script in Script Editor and see how it’s constructed. To view the complete list of AppleScript commands available in DEVONthink, in Script Editor, choose File > Open Dictionary, select DEVONthink Professional (or DEVONthink Pro Office) and click Choose. The most interesting terms are in the DEVONthink Pro Suite.

To learn more about using AppleScript, including tutorials and example scripts, visit MacOSXAutomation’s AppleScript page.

Automator

Automator provides an easy way to construct sequences of tasks. Instead of having to write a script, you can drag and drop components to build a workflow, adjust a few options, and you’re done. (Of course, you can get much fancier, too—for example, including full-blown programs written in AppleScript or another language inside an Automator workflow—if you have the need and sufficient scripting skills.)

DEVONthink adds 23 separate actions to Automator; by using these in your own workflows, you can integrate DEVONthink’s capabilities with those of other apps in interesting ways.

To locate DEVONthink actions to use in your workflows while working in Automator, you can either choose View > Arrange Actions by > Application and then select DEVONthink in the Library portion of the sidebar, or type devonthink in Automator’s search field (Figure 67). Select an action, and then look in the description view (in the lower left corner of the window) for details about what the action does and how to use it.

**Figure 67:** Search for `devonthink` to find all the Automator actions DEVONthink provides.
Figure 67: Search for devonthink to find all the Automator actions DEVONthink provides.

To learn more about using Automator, including tutorials and example workflows, visit MacOSXAutomation’s Automator page.

Link DEVONthink Documents to Other Applications

You can also access particular documents in your database from another application on your Mac. Select any item and choose Edit > Copy Item Link (Command-Control-Option-C). This puts a specially formatted URL on your Clipboard. Go to that URL from anywhere else on your computer and it opens the selected item in DEVONthink.

Why would you want to do this? I’ll give you a quick example. Calendar has a URL field for each event. If you put the link to a DEVONthink item in one of these fields, you can jump to that item—say, a report related to a meeting, or a research document you need to present at a conference—directly from Calendar. (DEVONthink’s included Reminders scripts do just this; see Included Scripts.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.222.205