# Devonthink Tips for Beginner

## After purchase DTP

Read Handbooks and Extras to learn how to integreate with web browsers, extensions (include Alfred, PopClip) and plugins (quick look plugins).

### Usage of Alfred workflow

• Type dnt + keywords to search in all opened databases in Alfred. Search results are sorted by relevance score, consistent with DEVONthink.
• Type dnts + keywords to search in DEVONthink window.
• Press Enter to search in existing window.
• Press ⌘Command + Enter to search in a new window.
• Type dnd to choose which datebase to search
• Press Enter, then type in keywords to search in the chosen database.
• Press ⌘Command + Enter to list all tags in the database, then choose a tag and press Enter to list all documents which have the tag.
• Press ⌥Option + Enter to list smart groups in the chosen database.
• Type dnm + tag1, tag2, ... to list all documents which have these tags in all database. Tags inputed must be exact. For example, Tag aBcD can’t be inputed as aBc or abcd
• Actions for Workspace:
• Type dnw to list all workspaces, press Enter to load the selected workspace.
• Type dnwa + WorkspaceName to save current workspace named WorkspaceName.
• Type dnf to list favorites.
• Type dnsg to list all smart groups in all opened databases.

After documents were listed,

• Press Enter to open the selected file with external editor.
• Press ⌘Command + Enter to open with DEVONthink.
• Press ⌥Option + Enter to reveal result in DEVONthink.
• Press →, fn, etc. to show file actions of Alfred. The keys are set in Features → File Search → Actions of Alfred Preferences.
• Press Shift or ⌘Command + Y to QuickLook the selected file.
• Press ⌘Command + C to copy DEVONthink link (x-devonthink-item://xxxx) of the selected file.
• Drag & Drop file in the result list to wherever you want.

## Abbreviations

• DTP: DEVONthink Pro
• DTS: DEVONthink Server, see editions
• DTPO: DEVONthink Pro Office, renamed to DTS, only available in version 2, see comparison
• DT3: DT version 3

## Formats

DTP有很多种不同的保存格式。1

A bookmark only holds the page’s URL and name. It has no other content.

An HTML capture of a page contains the text and hyperlinks of the page, but doesn’t download the images, which can only be viewed if online.

A WebArchive capture of a page contains the text, links and images of the page and the images can be viewed when the computer is not online. But if online when a WebArchive is displayed, it will go to the source page, especially to download dynamic graphics such as many ads.

If you use the Safari or DEVONagent browser, or the browser built into DEVONthink and your primary interest is the information content of Web pages and not their layout, you might consider using one of two Services that capture selected content from a Web page. To do this, select the portion of the HTML page that contains the important material and press the keyboard shortcut ‘Command-)’ to capture it as rich text, or ‘Command-%’ to capture as WebArchive.

The advantages of capturing only a selected area of a Web page are two-fold. Because extraneous page content such as ads are not captured, the focus of searching and See Also on the document in your database is improved. And the file size for storing the captured content is significantly lower, especially for rich text captures.

It’s well-known that DEVONthink offers four types of notes, namely plain text, rich text, formatted note and markdown (in fact, there’s a fifth format “web archive”, but it’s not pretty intended for note taking). I wonder which note type do you actually use, and what’s your opinions about them?

I prefer RTF (not RTFD) - editing is user-friendly and WYSIWYG and it’s fully supported by macOS. I don’t share my personal notes anyway but it’s nonetheless important that the format is not app- or platform-specific. And simple RTF documents can be also edited on iOS.

### RTF vs RTFD

RTFD == Rich Text Format Directory. An RTFD is a directory that contains an RTF text file and one or many EPS and TIFF image files. Like Application packages in OS X, RTFD can hold all sorts of goodies that appear as a single file to the user.

RTFD stands for “Read The F***ing Documentation!”

There other historical reasons for Apple using RTFD, but as for RTF: it is not as easy to include graphics in RTF as one might think. RTF requires specific image formats to be used in the file, all of them Microsoft Windows specific (i.e. bmp, wmf.) One can include other formats such as PDF, TIFF, etc. but it may or may not show up in other readers, especially word.

## Shortcuts

I see older documents indicating that control+command+F is one option, but that doesn’t appear to work with DT3. There was once a search item in the tools menu, but I don’t see it currently.

The shorcut is Cmd-Alt-F, see Edit > Find > In Database… The extended search syntax supports now all advanced options too. And you can navigate the results either by pressing Ctrl-Tab first and then use up/down arrows or use Cmd-Page Up/Down (these shortcuts work independent of the current keyboard focus)

## Automation

### Example: New simpler automatic workflow

1. I have a Scansnap profile called ScantoActionFolder which uses None(ScantoFile) for the Application so there is no input past pressing the blue button on the scanner. The scan is OCRed by the ScanSnap and then goes straight to a folder called ActionFolder.

2. Hazel is watching the ActionFolder. So far I have just done my annual rates notice for the farm. When Hazel sees that the document contains all the words ‘Waratah-Wynyard’ and ‘Rates Notice’ it:

• Renames the file with yyyy-mm Farm Rates.pdf
• Adds a Comment ‘Farm Expenses’ - I can then convert this to a tag inside DT
• Runs an Automator Workflow - this automator workflow just has 2 commands Set Current Group and Add Items to Current Group
• Moves the file to the Trash

And that’s it - no scripting, no hard stuff and the document goes straight from the Scanner to the correct group in the correct database without me manually tagging, renaming, sorting, dragging or dropping. Obviously I have to create the Hazel/Automator rule set for each document type but once its done, then its done.

### Storage detail: How does DT store entiries, groups, tags, and replicants

For all practical purposes, groups and tags behave the same in DEVONthink.

Tags and groups are the same except that tags dont actually store the file

Although, in a technical sense, groups and tags may be the same kind of entity treated in different ways, from the user’s point of view groups and tags are very different (because DevonThink treats groups and tags in different ways, groups and tags behave differently)!

However, groups don’t store files.

DevonThink is very different from what you might think initially: the entries in a DevonThink database aren’t files, groups aren’t folders and replicants aren’t aliases.

The entries in DevonThink are references to files. The files themselves are (by default) stored in the .filesnoindex folder in the database (you can move them outside the database if you put their references in an indexed group but this is rather tricky – try it only when you know what you are doing).

It is the references that are organized into groups, not the files themselves! For that reason, it is important to make a clear distinction between what happens to the file and what happens to the reference.

• When you move an entry you move the reference, not the file.

• When you replicate an entry (that is a reference to a file) you create another reference to that file (not a reference to the original entry as when aliasing!).

• When you delete an entry you delete the reference; when you delete the last reference to a file in the group hierarchy (that is: when you delete an entry that has no replicants), the file is deleted too.

• When you duplicate an entry you duplicate the file to which it refers and create a reference to that duplicate in the group hierarchy of the database.

From the user’s view point, groups are collections of references: if you delete a group those references will be removed from your database (and if an entry in that group has no replicants the corresponding file will be removed too!).

Tags, on the other hand, are, from the user’s point of view, properties of documents: if you delete a tag, this tag will be removed from all the documents but nothing happens to their entries (references) in the hierarchy.

Replicants provide a way to refer to a file at more than one place in your group hierarchy.

Tags provide a way to characterize files in a manner that does not fit with your group hierarchy.

For example, my group hierarchy sorts my journal articles according to their topic. When I design a course (a course typically covers different topics, but does not use all the literature I have about each topic), I tag the literature I want to use with the tag for that course. In this way, I can use my group hierarchy and the see also function to decide which articles to use and quickly access the articles I selected by means of the tag without making any changes in my group hierarchy.

### AppleScript or JXA

I too would argue that AppleScript is better supported by Apple than JavaScript.

However, the main reason to choose AppleScript is Late Night Software’s Script Debugger 18, an amazing tool that lets you single-step through your code and inspect the variables. You can also use it to browse the objects of every currently running app in its current state. This is invaluable for any non-trivial scripting project. There is no such thing for Apple’s JavaScript engine, as far as I know.

### Deploy blog written in DEVONthink

osascript -l JavaScript script.js


## Using on mobile

Using iPhone (DEVONthink To Go) and Sync is a separate feature, and Server is not necessary for this.