A Moderately Useful DevonThink Import Macro

I've had to clean up huge swathes of files by importing them in various DevonThink Pro Office databases and groups. Because I didn't want to import first in the Inbox and then refile, I've made a macro to import directly into a given group.
Because I have too many groups to remember, I've added a "spotlight" style search that allows me to whittle down the groups as I type.

  1. Importing to the global inbox:
    • type the keybinding ⌃⌥⌘I
    • your file disappears into DevonThink's Global Inbox
    • NOTE: you need to put the UUID of your own Global Inbox in the macro, of course (thx @rolian !)
  2. Importing to a specific database:
    • type ⌃⌥⌘D
    • a window appears with a list of your open databases. Start typing in the text field to narrow it down, select with arrow keys / return or the mouse.
  3. Importing to a specific group in a database:
    • type ⌃⌥⌘G
    • a window appears with a list of the groups in your open databases. Start typing in the text field to narrow it down, select with arrow keys / return or the mouse.
    • The nifty thing is that it will allow you to start typing the database name and only show you the relevant groups for arrow / mouse selection.

This macro relies on the Spotlight Search Prompt macro, which you'll need to install in your KM library. It's a great plug-and-play way to give a large number of options to the user.

As for my macro, it's crude, but hey, it works! Pointers and constructive criticism welcome!

Apps DevonThink Import files from Finder Macros.kmmacros (20.1 KB)

5 Likes

Hi @seishonagon, many thanks for sharing the macro :+1: I will try it out later.

So far I have always sorted my Finder file in DEVONthink this way:

2019_04_12_Support_

4 Likes

This is terrific. Thanks for sharing. Only thing I'd add is that you should insert a comment into the Global Inbox macro telling people to change the UUID to the one specific to their Global Inbox. Otherwise, while it still puts the file there, it doesn't delete it from the Finder.

Hi, please could you explain or share how you do that? Thank you in advance. Jeando

Hi @profjeandoKeybordM, You have 2 possibilities to call the DEVONthink selection window.

You can either work with a shortcut, like here:

2019_04_14_Support_1

But you can also use the action "Select or show a Menu item":

2019_04_14_Support_2

1 Like

Hi Appleianer,

So simple! Thank you!

All the best,

Jeando Masoero

initial Alexander technique teacher

Logo_iat_130px.png

1 Like

Thank you @profjeandoKeybordM :+1:
I also found this rather accidentally, because it is hidden in Services - Settings - Shortcuts under "Pictures" and not under the menu for "Files And Folders".

This macro is now definitely more than moderately useful. If you take the json output from the Groups macro and run it through a json->csv converter e.g. http://convertcsv.com/json-to-csv.htm ), you get a nicely formatted Excel spreadsheet) with the UUID of every group in your databases. This is enormously helpful for Applescripting and Hazel rules on a Mac and for creating scripts in the Shortcuts app on iOS- there's no need to go into DEVONthink and get the UUIDs one by one. What a timesaver!! Thanks again. for this great macro set.

2 Likes

Happy you like it !

totally awesome!
Whats the easiest way to deduce the uuid of the global inboxw/o scripting?

TIA
r.

more than mildly interested: how do you exactly capture the output from the groups macro?

TIA
r.

In the "Import to DT Groups" macro, after the second action (or first action after the initial comment) if you want to be precise), which runs the AppleScript and saves the json info to the variable "jsonListGroups", just insert another action to display that variable in a window. (Or, just duplicate the Execute AppleScript action, but change the dupe to "display results in a window" instead of "save results to variable").
Copy the text from the window and run it through a json-->csv converter.

Either way, you'll get the UUIDs nicely formatted for all the top level groups in your open databases,

file:///.file/id=6571367.7750419

1 Like

If you use the converter I linked to above, the output will look like this:

Bingo!

Worked like a charm :wink:

Thanks and happy weekend!
r.

I have the KMFAM and Spotlight Search Prompt installed and installed the Apps DevonThink Import... macros. The interface works, somewhat. The search results seem imprecise: only top level groups seem to populate the list as I type. As far as I can tell, lower level groups are not found.

Yes, as noted in post 12 above "Either way, you'll get the UUIDs nicely formatted for all the top level groups in your open databases".
I too would love to get the lower level groups, but don't know enough AppleScript to rewrite the macro

Although you describe your macro as "crude", I think it is quite sophisticated. BUT, it seems to generate only the top-level groups in a database. In looking at the AppleScript, I'm not sure why that is the case, nor can I tell how to change it so that, for example, if I have a group called "Hardware" in my Computer database, and "AppleWatch" and "iMac" as groups/folders contained in the Hardware group, I would like "AppleWatch" and "iMac" to show up when searching. Any ideas on how to make that happen?

1 Like

One point corroborating @rolian previous post

Examining the jsonListGroups variable, the variable only contains information for the top level groups.

wow! Can you share the script which show the groups in DEVONthink ? thank you ! it 's perfect.

未命名

@appleianer can clarify whatever wizardry is in use, but from the name of the dialog (DEVONthink Pro Office) and some of the icons, it looks like the v.2 dialog brought up by right-clicking a file in the Finder and invoking Services>Add to DEVONthink

Try it on your system. v3 has even more fun, with tags and search box!