Is it possible to search other sources with DEVONthink via spotlight?

Besides DEVONthink I am a long term Drafts user who uses the app (iOS and Mac) mainly for capture and intermediate storage. Most stuff I sent eventually to DEVONthink.

However sometimes I forget to do so and stuff remains in Drafts, so it would be good to find a way to search the drafts in Drafts together with the things in DEVONthink.

Somewhere in DEVONthink’s documentation I read about Spotlight indexing – and now I’m thinking: If DEVONthink searches Spotlight as well, it could search drafts, because Drafts is in Spotlight!

So is there a way to do this?

This is DEVONthink’s optional support for Spotlight indexing (see File > Database Properties) so that items stored in databases can be found via Spotlight. But DEVONthink doesn’t use Spotlight for searching. What about indexing the Drafts files/folders?

Or to put it another way, you can use Spotlight to search a DEVONthink database, but you can’t use DEVONthink to search via Spotlight.

It seems like you can use Spotlight to search Drafts, but I have to say I can’t find where Drafts are stored on my system. I’ve looked in the most obvious places in the Library folder, but I haven’t discovered their hiding place yet.

Edit: I suspect that Drafts are held in a database and not as individual files that can be indexed by DEVONthink. Using Spotlight to search for text in Drafts will show the backup file that contains the text, but will not allow you to see the text (there is no QuickLook plugin, as far as I can see).

I see! DEVONthink documents can be a source for Spotlight, but Spotlight can’t be a source for DEVONthink’s search. Thanks for the clarification.

Drafts stores its texts (the “drafts”) in an SQL(lite?) database. So no direct access from DEVONthink possible.

Thanks for chiming in, @mbbntu!

See my other reply for details to Drafts.

Bottom line: I guess the best is to export the drafts regularly to some directory indexed by DEVONthink…

That’s the big negative side about Drafts. Because of that for some time I had been using 1Writer instead of it as a fast note taking app as 1Writer saves its notes open for access in the file system. I had it save the notes in an iCloud Drive folder which I indexed in DEVONthink and had a Smart Rule moving all items into the Global Inbox where a script sorted them based on their tags.

1Writer ist very similar to Drafts, just with—significantly—less options for actions and very little documentation. And not to forget Draft‘s huge action repository and its Apple Watch app.

When was reduced to mobile devices only due to absence from home for some weeks I went back to Drafts and sticked to it, the cumbersome inevitable move actions notwithstanding.

1 Like

There has been some discussion in the Drafts forum about using Alfred to search in the Drafts “documents”. Perhaps you can get something out of this.

Or many other modern apps like Notes or Freeform which don’t use documents/files anymore. You’d better always check the export possibilities first before committing to such an app. And also that the editor is sufficient for your needs as externally editing is impossible.

3 Likes

For quite a number of developers it seems to be business related. They either sell licences per platform and due to the locked-in data the user has to purchase all of them to be able to synchronize. Or they go freemium and syncing is a for-pay feature. If the data was freely accessible from outside the respective app these business models would not work.

Drafts has fine out of the box export actions and since it is scriptable it can be customized to everyone’s needs. Exporting, like every other action, is just a manual step that I’d like to have DEVONthinks Smart Rules handle.

I take Draft’s “Where text starts” quite literally. On mobile devices it is in my opinion unparalleled. I’d love to use it as an external editor for other apps too, but that is too cumbersome because of its locked-in data.

:+1:

Many apps use CoreData with an SQLite backing store which doesn’t generate files. This is a single syncable, e.g., via iCloud, entity to handle versus syncing many small files. However, this is certainly detrimental to the user who wants/needs access to individual files, especially from an automation standpoint. This is why Messages and Notes is particularly awful to deal with nowadays. :roll_eyes:

3 Likes

Great point. Thanks for the details. makes total sense!

Here the discussion in the Drafts forum:

And here the workflow site:

I think it won’t be easy to adapt their approach for exporting all drafts to a folder (to be indexed by DEVONthink). Using a Drafts action (which can be trigger automatically from the outside) might be easier.

Great topic! I am Drafts user myself, and haven’t been able to find an alternative that works for me the same way Drafts does. Capture from my Apple Watch is my main use case, but I still use it for quick entry on the desktop too.

Just a thought, but is there a way to automate exporting new Drafts on the desktop? My thought being to automatically export things into DEVONthink when they are created. Or even just to a text file in a folder.

I’m sure that you can script Drafts so that it exports the court documen to a specific folder. But “automatically … when they are created”? How can the script possibly know that you’re done creating?

The AppleScript support of Drafts seems to be limited or buggy, e.g. a simple script like tell application "Drafts" to return count of drafts fails already but should work according to the definition of the script suite. And therefore an import script like…

tell application "Drafts"
	repeat with theDraft in drafts
		set theName to name of theDraft
		set theContent to content of theDraft
		set theFlag to flagged of theDraft
		set theTags to tags of theDraft
		set theCreation to createdAt of theDraft
		set theModification to modifiedAt of theDraft
		set theURL to permalink of theDraft
		tell application id "DNtp" to create record with {name:theName, content:theContent, type:markdown, creation date:theCreation, modification date:theModification, URL:theURL, tags:theTags} in current group
	end repeat
end tell

…doesn’t work either.

I was thinking more time based, like once a day at midnight (or whenever you know you wouldn’t be using it).

Bummer

I couldn’t get, incidentally, Drafts to index in spotlight despite the efforts of the developer, I still don’t know what the problem was, I dropped the app. I use Houdah spot and it searches both DEVONthink 3 and Ulysses which is everything I have really now. It also does anything else that spotlight can see of course. I can’t though get Houdah spot to look in Bookends, though I work round if I need by importing to DEVONthink 3, which is easy and works well. I wish I could just do it simply though, then I could search everything I have. As it is it is no big deal and stuff is, thanks to DEVONthink 3, easier to find than ever for me.

ah maybe that is part of the problem I had with Drafts then. Thanks as always and Happy holidays Nadolig Llawen.

1 Like