Skip to content

chrillek/DT-Search-JS

Repository files navigation

Alfred Workflow for DEVONthink 3

This workflow re-implements an older one also available on GitHub which depends on Python and other external tools. The new version only uses JavaScript, so that it doesn't depend on certain tools being installed.

It does not yet offer the global variables available in the previous workflow to exclude a group or a list of databases from searches.

Note You must allow Alfred to automate DEVONthink in System Settings/Privacy/Automation.

Show all databases

Keyboard shortcut is DTD. It will populate Alfred's window with the databases currently open (!) in DT. That's different from the result of "show favorites".

Show all databases with DTD

With a database selected,

  • Enter searches in it
  • Opt-Enter shows all its smart groups
  • Cmd-Enter shows all its tags
  • Ctrl-Enter shows all its groups, excluding Tags and Trash
    • Cmd-Enter searches in this group

Opening records

Enter on any record will open it. If it's a group, it will be opened in DEVONthink, otherwise the standard program will be used.

Opt-Enter on any record will reveal it in DEVONthink, i.e. the DEVONthink window will show it highlighted.

Cmd-Enter on any record will open it in DEVONthink, possibly in a new window.

Ctrl-Enter on any record will save a Markdown link to it in the global clipboard. This link is of the form [name](x-devonthink-item://...).

Searching in DEVONthink

You can search for tags with DTT. Separate tags with commas or semicolons.

Search for tags with DTT

List records with certain tags

You can also use DEVONthink's search syntax. However, the scope parameter will not take any effect here. Alternatively, you can search in DEVONthink with DTS. Again, you can use any valid search string like kind:group name:receipts.

When using DTS, all databases will be searched. To limit the search to a single database, use DTD, select the database and start your search with Enter.

List Favorites

DTF lists all favorites. Note that databases can be in the favorites list although they are not currently open. Therefore, this command will implicitly open all databases in the list of favorites.

Limit search to group

To limit the search to a certain group, you must

  • select a database with DTD
  • get its groups with Ctrl-Enter)
  • select one of the groups and open the search with Cmd-Enter

Result order

Results are returned in the following order

  • Databases (DTD) alphabetically by name,
  • Groups by location, i.e. first by database, then by name.
  • Records (DTS, DTTS) first by database, than by ranking,
  • Tags (DTT) alphabetically by name,
  • Workspaces (DTWL) alphabetically by name,
  • Smart groups (DTSG) first by database, than by name,
  • Favorites (DTF) in the order shown in DEVONthink.

Keyboard shortcuts

All shortcuts can of course be modified.

  • DTD select database for subsequent commands,
    • Enter: search in this database
    • Opt-Enter: show all smart groups for this database
    • Cmd-Enter: show all tags for this database
    • Ctrl-Enter: show all groups for this database (excluding Tags and Trash)
  • DTS: search in all databases,
    • Enter: open in default program
    • Cmd+Enter: open in DEVONthink
    • Opt+Enter: reveal in DEVONthink
  • DTSG show all smart groups,
  • DTF list favorites. Databases in favorites currently not open will be opened by this command
  • DTWL Load workspace,
  • DTWS Save workspace,
  • DTTS: Search with query in DT,
  • DTT Search for tags. This is a shortcut for DTS with a query like "tags: t1 tags: t2". Enter the tags separated by commas or semicolons.