Mpco Posted November 27, 2018 Share Posted November 27, 2018 (edited) Usage Type dnt + keywords to search in all opened databases. 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. 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 After documents were listed, Press Enter to open the selected result with DEVONthink. Press ⌘Command + Enter to open with external editor. Press ⌥Option + Enter to reveal result in DEVONthink. You can download it from Github Edited December 4, 2018 by QqzgpCAo add screenshot Link to comment
lutefish Posted December 3, 2018 Share Posted December 3, 2018 Many thanks for sharing. I'm having an issue where the general dnt search (of DT Pro) isn't responding or returning any results, whereas a dnd search of a particular database works fine. Link to comment
Mpco Posted December 4, 2018 Author Share Posted December 4, 2018 7 hours ago, lutefish said: Many thanks for sharing. I'm having an issue where the general dnt search (of DT Pro) isn't responding or returning any results, whereas a dnd search of a particular database works fine. You can open alfred workflow debugger (follow https://www.alfredapp.com/help/workflows/advanced/debugger/) , run dnt, then copy and paste the debug log here. Link to comment
lutefish Posted December 4, 2018 Share Posted December 4, 2018 It freezes - dnt logs this: Starting debug for 'DEVONthink Pro Search' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 's' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'so' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sot' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'soth' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sothe' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sotheo' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothe' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothew' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewo' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewor' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewort' [2018-12-04 09:12:52][input.scriptfilter] Queuing argument 'sotheworth' I have some large databases (>3 gigs) containing indexed folders themselves pointing to gigabytes of files, and I think that's where the script is failing, as a dnd search of that particular database also times out. Link to comment
Mpco Posted December 6, 2018 Author Share Posted December 6, 2018 On 12/5/2018 at 1:16 AM, lutefish said: It freezes - dnt logs this: Starting debug for 'DEVONthink Pro Search' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 's' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'so' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sot' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'soth' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sothe' [2018-12-04 09:12:50][input.scriptfilter] Queuing argument 'sotheo' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothe' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothew' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewo' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewor' [2018-12-04 09:12:51][input.scriptfilter] Queuing argument 'sothewort' [2018-12-04 09:12:52][input.scriptfilter] Queuing argument 'sotheworth' I have some large databases (>3 gigs) containing indexed folders themselves pointing to gigabytes of files, and I think that's where the script is failing, as a dnd search of that particular database also times out. Sorry, I don't have the large databases and can't test. But I attach a script file to search in all opened devonthink databases which is the core of dnt. You can download it, uncompress, open, and then press ⌘Cmd-R to run. You can also change the search keyword theKeywords in second line of the script and test how long the searching in large databases. Then paste the result here. Download: https://github.com/mpco/AlfredWorkflow-DEVONthink-Search/files/2651576/coreSearchScript.zip Link to comment
lutefish Posted December 6, 2018 Share Posted December 6, 2018 Mpco - many thanks. When I run the script you posted directly, it works fine, and takes only a few seconds for results to appear in the Script Editor window. But, running dnt directly still just fails silently with a time-out. Running dnd and choosing a database and searching works fine. Is it connected somehow to dnt coming after dnd, rather than being a toplevel option somehow? Link to comment
Mpco Posted December 7, 2018 Author Share Posted December 7, 2018 16 hours ago, lutefish said: Mpco - many thanks. When I run the script you posted directly, it works fine, and takes only a few seconds for results to appear in the Script Editor window. But, running dnt directly still just fails silently with a time-out. Running dnd and choosing a database and searching works fine. Is it connected somehow to dnt coming after dnd, rather than being a toplevel option somehow? Hi, download this version https://github.com/mpco/AlfredWorkflow-DEVONthink-Search/files/2657674/DEVONthink.Pro.Search.zip and test dnt. I changed some configs in it. Link to comment
lutefish Posted December 7, 2018 Share Posted December 7, 2018 Mpco - Brilliant. That did the trick, and it works as expected now. Thank you! Link to comment
lutefish Posted July 19, 2019 Share Posted July 19, 2019 Mpco - I just downloaded the most recent release - thanks so much for keeping this up to date. I started seeing very slow searches in DT3b3 and still in DT3b4. It's not timing out. I tried running the script with logging enabled, and there's fully 7 or so seconds between when I enter text and results are returned: [11:23:10.768] Logging Started... [11:23:17.517] DEVONthink Search[Script Filter] Queuing argument 'c' [11:23:18.774] DEVONthink Search[Script Filter] Queuing argument 'chancery' [11:23:24.083] DEVONthink Search[Script Filter] Script with argv 'chancery' finished Thanks for a brilliant workflow - just wanted to draw your attention to the issue. Link to comment
deanishe Posted July 19, 2019 Share Posted July 19, 2019 1 hour ago, lutefish said: Thanks for a brilliant workflow - just wanted to draw your attention to the issue. There's really not much that can be done to actually improve the speed of the search: calling applications via AppleScript is fundamentally slow. However, you might be able to get faster results by changing the Script Filter to only search once. Open the Script Filter, click the Run Behaviour button and change the Queue Delay settings. For slow-ish searches, I find that setting Queue Delay to "Automatic delay after last character typed" provides the best results. Link to comment
lutefish Posted July 19, 2019 Share Posted July 19, 2019 Many thanks for the suggestion. That option was already set, and changing Run Behaviour to various settings didn't change things. But, again, thanks - it was worth a try. Link to comment
deanishe Posted July 19, 2019 Share Posted July 19, 2019 Did you uncheck the "Always run immediately for first typed arg character" option? That's critical. Link to comment
slyfox Posted July 23, 2019 Share Posted July 23, 2019 What is the script that I can use to enter a keyword and have Alfred search within a pre-defined database? Link to comment
Mpco Posted August 12, 2019 Author Share Posted August 12, 2019 On 7/23/2019 at 11:24 PM, slyfox said: What is the script that I can use to enter a keyword and have Alfred search within a pre-defined database? The Script Filter whose keyword is dnt gets the selected database from the variables passed to it. If you want to setup a keyword to search within a predefined database, you can follow the steps below. 1. add a Trigger-Hotkey, a Utilities-Arg and Vars object. 2. connect Hotkey to Arg&Vars, connect Arg&Vars to Script Filter whose keyword is dnt. 3. In Hotkey object, setup hotkey. 4. In Arg&Vars object, remove {query} from Argument text box; add "selectedDbName" variable whose value is name of database; add "selectedDbUUID" variable whose value is uuid of database. You can get uuid by Copy Database Link in DEVONthink. 5. Done. Link to comment
slyfox Posted August 12, 2019 Share Posted August 12, 2019 (edited) Almost there. Instead of using a hotkey, what is best way to setup keyword as trigger? For example, for my notes search, I want to setup "nt" keyword input + sear argument will result in searching for the argument in a specific database? Edited August 12, 2019 by slyfox Link to comment
Mpco Posted August 12, 2019 Author Share Posted August 12, 2019 48 minutes ago, slyfox said: Almost there. Instead of using a hotkey, what is best way to setup keyword as trigger? For example, for my notes search, I want to setup "nt" keyword input + sear argument will result in searching for the argument in a specific database? Sorry, I got it wrong. Just replace the Hotkey object with a Keyword object. Link to comment
slyfox Posted August 12, 2019 Share Posted August 12, 2019 @Mpco Keyword trigger has a bump in-between. Something is not right. Entering a keyword with "search argument" does not pass the "search argument" to "dnt" script filter. It just triggers it. I then have to enter the search keyword once dnt is triggered. Link to comment
Mpco Posted August 13, 2019 Author Share Posted August 13, 2019 15 hours ago, slyfox said: @Mpco Keyword trigger has a bump in-between. Something is not right. Entering a keyword with "search argument" does not pass the "search argument" to "dnt" script filter. It just triggers it. I then have to enter the search keyword once dnt is triggered. add {query} to Argument text box of Arg&Vars object. Link to comment
Jasondm007 Posted January 24, 2020 Share Posted January 24, 2020 @Mpco Thanks for sharing this Alfred workflow for DEVONthink. It's fantastic! One quick question: Is it possible to switch the default search results action to open the file in DEVONthink (i.e., instead of an external editor)? I tried merely adapting the configured connection between workflow actions, so that the "Open With External Editor" requires users to hold command and the "Open with DEVONthink" doesn't require anything, but it doesn't seem to work. From what I can tell, the script filter is passing the file path to the "Open with DEVONthink" action instead of the UUID? Is there a minor change that can be done to the script filter or the search.js file to accomplish this? Thanks for your help! And, thanks again for sharing this workflow!! PS - Apologies for the duplicative post to GitHub, as I thought others in this forum also might know to tweak the workflow. Link to comment
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