brunoc Posted August 23, 2017 Posted August 23, 2017 (edited) https://github.com/brunocbr/dtp-browser-workflow This is a workflow for quickly searching and accessing group records in DEVONthink databases. It also implements a "Move to DEVONthink" file action, copying a link to the clipboard. Use the SHIFT modifier to browse inside groups, and CMD to create a new subgroup. The workflow may be configured according to your needs and the structure of your databases (please take a look at the configuration by clicking the "Configure workflow and variables" icon at the top right of the workspace). Out of the box, it will search top-level groups in all databases. Updated in late 2019 to work with DEVONthink 3. Edited February 13, 2020 by brunoc DT3 Update
Philip Venema Posted December 15, 2017 Posted December 15, 2017 Thanks for sharing! Can anyone assist me on the following? - search Devonthink > all databases > only groups - search Devonthink > [name database] > only groups
brunoc Posted December 16, 2017 Author Posted December 16, 2017 (edited) Hello, @Philip Venema! We can adapt the script to reiterate over groups, but I think it can get rather slow. In my case, I don't find it very useful, as most of my sub-groups get similar names (by using DTP templates for conferences, projects, classes etc.). Anyway, if you really want to try it, see the script below. I filtered Tags and Trash groups in order to make it a little faster. Also notice you can create multiple triggers in your Alfred workflow with the same "dtp" keyword. This is how I manage working with multiple "Active Projects" databases. I don't think you should do it for all your databases (including Archives for instance) as this could get really slow! property pstrDatabaseName : "Projetos Ativos" -- set the name of your database here set lstGroups to {} tell application id "com.devon-technologies.thinkpro2" to set tagsGroupUUID to the uuid of tags group of database pstrDatabaseName tell application id "com.devon-technologies.thinkpro2" to set trashGroupUUID to the uuid of trash group of database pstrDatabaseName on reiterateOnGroup(theRec) tell application id "com.devon-technologies.thinkpro2" repeat with r in every child of theRec if (type of r is group) and uuid of r is not in {my tagsGroupUUID, my trashGroupUUID} then set the end of my lstGroups to {name of r, "x-devonthink-item://" & the uuid of r} my reiterateOnGroup(r) end if end repeat end tell end reiterateOnGroup tell application id "com.devon-technologies.thinkpro2" set rootRec to root of database pstrDatabaseName my reiterateOnGroup(rootRec) end tell set jsonOutput to "{\"items\": [" repeat with i from 1 to length of lstGroups set {strGroupName, strId} to item i of lstGroups if i > 1 then set jsonOutput to jsonOutput & ", " end if set jsonOutput to jsonOutput & "{\"uid\":\"" & strId & "\", \"title\":\"" & strGroupName & "\", \"arg\":\"" & strId & "\"}" end repeat set jsonOutput to jsonOutput & "]}" Edited December 16, 2017 by brunoc
Philip Venema Posted December 16, 2017 Posted December 16, 2017 Brunoc, thanks for your advice and effort to assist me. I am going to try your solution.
nestorito Posted January 19, 2018 Posted January 19, 2018 Thnks Brunoc for your workflow! Do you think it would be possible to 'imitate' the "move to..." Alfred action to directly file finder files in specific group in DT? Such as: file selected in the finder --> keyword --> where in DT by typing the group name --> move to group? brigadinho!
brunoc Posted January 26, 2018 Author Posted January 26, 2018 (edited) Olá, @nestorito ! This is a nice idea. I changed the workflow so now we have a "Move to Active Projects" file action. As an extra, an x-devonthink-item URL for the imported file is copied to the clipboard – which you may use to paste a link on a task manager or whatever. The setup has changed: you must now set the name of your database by clicking the "Configure workflow and variables" icon (located on the top right of the workspace area). If you want to use it with multiple databases, simply duplicate the workflow and change the variable accordingly. Have fun! Edited January 26, 2018 by brunoc
brunoc Posted January 30, 2018 Author Posted January 30, 2018 Two updates: I changed the method for moving the file (it's now actually "moved" into DTP, not imported and deleted), and made to allow for multiple databases without the need to duplicate the workflow,
nestorito Posted January 31, 2018 Posted January 31, 2018 Great changes @brunoc, I was wondering if it's possible to "replicate" the group structure for the database, even if I guess it could turn very slow..now I see the top level group for each database, it would be great if we could select deeper group (as in the "move to.." file action) anyway thanks a lot for this great workflow
brunoc Posted February 3, 2018 Author Posted February 3, 2018 @nestorito thank you for your excellent insights! I've made a big redesign of the workflow. I've learned a lot in the process about Alfred's tricks – and also became acquainted with a few of its bugs ?. Good news: not only we've got a "Move To" file action, with the ability you suggested to browse inside groups (by holding SHIFT), but also a handy capability of creating new groups in the way (with the CMD modifier). Last but not least, there's now great flexibility for configuring (multiple) databases. I think the workflow is now much less idiosyncratic and can do far more than just accessing "Active Projects". That's why a decided to change the name of the project to "DEVONthink Browser".
nestorito Posted February 8, 2018 Posted February 8, 2018 (edited) On 4/2/2018 at 12:34 AM, brunoc said: @nestorito I've made a big redesign of the workflow. @brunoc: works like a charm! Thanks a lot for sharing! Edited February 8, 2018 by nestorito
Cassady Posted February 28, 2018 Posted February 28, 2018 Very useful - thank you for this workflow! brunoc 1
ghostblog Posted July 26, 2018 Posted July 26, 2018 Is there a way to search the tags in DevonThink? Thanks.
brunoc Posted July 26, 2018 Author Posted July 26, 2018 Hello @ghostblog ! I've updated the workflow with a "search_tags" parameter. If set to "true", it will search inside DTP's Tags groups. See if that works as you would expect.
ghostblog Posted July 27, 2018 Posted July 27, 2018 @brunoc Wow, that was fast. Works perfectly. Thanks a lot. Very much appreciated!
jonkaz Posted July 29, 2018 Posted July 29, 2018 Somehow, searching files inside groups stopped working for me. When I type the any characters the search bar stays blank. Searching groups works fine etc works fine though. As I have no idea would could be the problem here, is there a way how I could debug this?
brunoc Posted July 29, 2018 Author Posted July 29, 2018 (edited) Hello, @jonkaz . Try clicking the "toggle debug mode" on the top right of the workflow page (inside Alfred Preferences). It should give some information on the error when you trigger the workflow. Edited July 29, 2018 by brunoc
jonkaz Posted July 29, 2018 Posted July 29, 2018 Thank you for your response and the hint on how to find the Alfred debug mode. I see that it its quite prominent (the bug icon) but I always ignored... I'm sorry for that. Anyhow, if activate the debug mode, I only get debug output only related to other workflows e.g. those that search for groups. When I search for file there's not messages at all with debug mode enabled. I checked this with other published workflows that search DEVONthink databases and it seems that searching files is not working with these as well. Interestingly, using a workflow that defines the DTP database prior to searching files still works fine (this one with the keyword `dknd`). So I know now that this problem is not related to your workflow but do you have any clue what's the problem? I just don't have a clue. Anyways, thanks for sharing this most advanced dt workflow, this is greatly appreciated.
brunoc Posted July 30, 2018 Author Posted July 30, 2018 (edited) Please note that the particular workflow I shared, differently from the one you mentioned (DEVONthink Search), was intended to look only for DEVONthink Groups (not the files inside them). It was actually designed to complement it (I use it a lot too!). One further and important remark, though: any of these workflows will need a DEVONthink "PRO" license to fully operate because AppleScript is required. This is the case with the dknd trigger in the DEVONthink Search workflow (but not with dnk, which simply uses Alfred's internal file search mechanism with Spotlight indexed files). Finally, make sure you have your databases indexed if you want to use this latter workflow (Database properties -> Create Spotlight index). Edited July 30, 2018 by brunoc
lutefish Posted September 10, 2018 Posted September 10, 2018 Just moved from years of being a devout Evernote user to DevonThink, and this workflow made that decision much easier. Cheers! brunoc 1
brunoc Posted September 10, 2018 Author Posted September 10, 2018 19 hours ago, lutefish said: Just moved from years of being a devout Evernote user to DevonThink, and this workflow made that decision much easier. Cheers! Thanks for your feedback!
brunoc Posted February 9, 2019 Author Posted February 9, 2019 A nice update: results are now cached, making the workflow run much faster! The cache expires in 10 minutes by default (you can change it in the configuration variables).
brunoc Posted February 11, 2019 Author Posted February 11, 2019 It's better to periodically update the cache without interaction. I've included a Keyboard Maestro macro for that end and changed default cache expiration to 24 hours.
deanishe Posted February 11, 2019 Posted February 11, 2019 51 minutes ago, brunoc said: It's better to periodically update the cache without interaction. I've included a Keyboard Maestro macro for that end and changed default cache expiration to 24 hours. Can you not use the cached data and update them in the background while the workflow is running? In this case, you get (mostly) the best of both worlds: immediate results replaced by up-to-date results the second the update completes.
MrShap Posted June 2, 2019 Posted June 2, 2019 Anyone have any idea how to update this workflow for DevonThink 3? Thanks! I love the workflow obviously...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now