Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Posts posted by dvcrn

  1. Most of the stuff works with DT3 but the search currently doesn't. The applescript needs updating to call the correct app and didn't get around to doing that yet. A hotfix is to just change the name inside the script to "DEVONthink 3" until DT3 is fully released

  2. 16 hours ago, pwharrison said:

    @dvcrn @gr37 I experienced the same issue -- the search only uses the first word of the query and ignores any subsequent words. I think this is because multi-word queries are passed into devonsearch.js as multiple command line parameters, but devonsearch.js appears to only use the first one (line 38):

    const query = argv[0];

    I fixed the issue by changing the ds keyword script filter from "with input as argv" to "with input as query" and changing the bash command to this:

    osascript ./devonsearch.js "{query}"

    This ensures the full query is passed to devonsearch.js as a single command line parameter.


    Nice workflow -- a very convenient way to interact with your content in DEVONthink. Thank you for sharing.


    Thank you! I updated the workflow with this and released version 1.4.2. It should auto-update sometime 

  3. 7 hours ago, gr37 said:

    Updated to 1.4.1 but my search results still seem random. I type the exact full title of an item and it doesn't even show in the results. I think part of the issue is that, as far as I can tell, the results list is only based on the first search term. Adding a second word to the search doesn't update the search results.


    Hrrm, can you tell me what it passes to the script? Open the workflow in alfred and hit the little bug icon on the top right. Then change "Interesting Information" to ""All Information" and execute the workflow while having that window open

  4. Updated to 1.4.1 https://github.com/dvcrn/alfred-devonthink/releases/tag/v1.4.1


    Uses score correctly now and the results are pretty good! Really liking this new search. 

    I reduced the results per DB to 5 which seems a good sweetspot to not be too slow. If that's not enough you can change the value inside devonsearch.js


    I tried to replicate what @sokolik_22 said but even for files that are not supported by DEVONthink, when I hit enter it just shows it in a DEVONthink window and doesn't open it in a different application. From there you can hit CMD-R and it will reveal the file inside DEVONthink

  5. Searching order right now works like this: It searches the first db, then the second, then the third and so on. After that, it just puts all the results into a big result list. 

    Another idea was to merge them as is, so: first result of db1, first result of db2, first result of db3, etc but if your db doesn't have any good results it would just show really irrelevant things inside good results. 


    Someone inside the devonthink forums just told me that 2.10.2 fixes the scoring being 0 problem, so I'll take a look at that later!


    For what to search, the search interface itself currently only supports this:




    Everything else would have to get implemented through other means (like finding the tag, then searching in that tag group, then filtering inside alfred by kind)

  6. I pushed an update (1.4.0) that uses the applescript search interface. It should auto-update but if it doesn't, get it here - https://github.com/dvcrn/alfred-devonthink/releases/tag/v1.4.0


    Some caveats: 

    - Sorting is a bit meh. There is a score field returned by DEVONthink but it's always 0 for me. I am currently just appending all results from each db

    - With a lot of results, it's very slow. I limited it to max 10 per db for now which feels like a good sweet spot


    Tags, I am not sure. It can search for tags, so maybe a separate tag search might make sense? 


    I'l see if I can fix the sorting part somehow. 


    2 other ideas that came up while adding this:

    - Quick jump to a folder. DEVONthink doesn't have quick-jump functionality so Alfred could help out with that. Similar to how Safari Assistant does quick jump to open tabs

    - Quick move to. Similar to Quick Jump: Select something, hit a shortcut, fuzzy find a folder and it'll move the item to that folder instantly 

  7. Just a heads up - I tried rewriting the search to use DEVONthinks search interface but it looks like that's restricted to the currently selected database if not specified. I was also not able to find a way to get a list with all open databases that could be usable for this so I'm throwing the towel for now. 

    If anyone has an idea, let me know!

  8. 5 hours ago, gr37 said:

    I love the idea of this workflow, especially given that, for some reason, Spotlight includes DT items in its search results but Alfred doesn't...


    One issue I have though, and I can't tell if it's my set up, but the search results of this workflow seem to be ordered by date created (maybe?) rather than relevance. In any case, when I do a search with two terms I know are part of the name of a DT item, this item is included in the results, but down the list. Other items that do have those terms somewhere in their content show up first.


    Also, am I correct that it doesn't search DT tags? 


    Thanks for your help!


    Yeah currently ordering seems a bit off since it's not using DEVONthinks engine for searching, but just spotlight. I want to change the search part to use DEVONthinks search applescript interface but didn't have time for that yet. And yes, tags are not searched yet. 

  9. 8 hours ago, Kikuchiyo said:

    Update: I made some progress based on this post


    	tell application id "DNtp"
    		set theRecord to create record with {name:theQuery, type:text, content:theQuery} in inbox
    		set theFile to path of theRecord as POSIX file
    		tell application "Finder" to open theFile
    	end tell

    It opens the files in apps that are set to handle the file type. In my case BBEdit. Not DEVONthink. I'm guessing because DEVONthink doesn't understand POSIX files?


    You mean like this? 


    tell application id "DNtp"
    	set newRecord to create record with {name:"foo", type:text, content:"foo"} in inbox
    	open window for record newRecord
    end tell

    This creates a document, opens it in a new editor window and sets focus to DEVONthink 

  10. 16 hours ago, Kikuchiyo said:

    Any thoughts on how to modify this workflow to open the file after creation?

    You can expand the applescripts inside the workflow. `create record` should give you the record back it created. From there you can tell DEVONthink to open it and grab focus

  11. You can use applescript to access DEVONthinks search, something like:

    tell application id "com.devon-technologies.thinkpro2"
    	search "foo"
    end tell

    You can integrate that into a alfred workflow but I didn't have the time to play around with that yet 


    I'm not sure if it's possible to open a search window directly, but you could use keyboard maestro (or possibly UI scripting with applescript) to activate DEVONthink and execute the "search" menu action

  12. 3 hours ago, chrisWhite said:

    This is fantastic! Thank you so much, I've really wanted a better way to interact with DEVONthink in Alfred, way better than just setting up a custom search!


    As an aside, I really like the Alfred theme you're using, any chance you could post it?


    The theme in the screenshot is The Minimalist. I use the 'almost midnight' variant

  13. Whoops, I forgot to turn on email replies so I didn't see these comments until now - sorry about that! It's turned on now. 

    Is everything working ok now? The search command is using the spotlight index to search for DEVONthink metadata files without much magic, so if spotlight is doing it's job fine, you should find them. 


    I also just pushed an update to replace the import commands with applescript which should make the workflow a good chunk more robust :)

    I also included a auto update script independent of packal (since that seems to be dead now anyway). Check the first post for the updated workflow (that will update itself from now on) 

  14. I've been recently playing around with launchbar and switch back and forth between it and Alfred. 

    One thing I noticed that is pretty killer in launchbar, is the ability to use macOS services. Launchbar is indexing them by default and lets you use them either with normal text or files. 


    A proposal could be:

    1. Type some text (or use a workflow to get the selected text and propagate the alfred window with it)
    2. Hit CTRL
    3. Select "Use Service" (or directly suggest them)
    4. Hit enter on a service to use them


    And the same with files. Hit CTRL and propagate the actions window with services that support the file type, next to workflow actions and default alfred actions


    I think this would make Alfred a lot more powerful without the need to create custom workflows. A lot of apps (the majority?) already exposes services, and being able to use them directly within alfred would be great. 


    For example, some workflows that I manually wrote that would be possible with a service:

    • DEVONthink: Add notes or files
    • Delivers: Add a delivery from a text string
    • Fantastical, Cardhop, Things: Add new entry directly from text


    Screenshot of available services enabled on my system when selecting text:



    Screenshot of available services when selecting a file:


  15. 16 hours ago, CJK said:

    No, but I wouldn't use that script to do what you're doing.  I would just set a keyboard shortcut within macOS for that particular service.  You don't need to use Keyboard Maestro or Alfred or UI scripting.


    I personally don't like how macOS manages shortcuts and the lack of sync is a little annoying so I rather have my script collection that can go from simple things, to more complex actions that link different apps if needed.


    A variation of the script above for example is part of a automation that chains different services together, like sending a piece of text to a few apps instead of just one

  16. As the title says, I noticed this odd behavior. I am trying to execute the following applescript: 


    tell application "System Events"
    	set frontApp to first application process whose frontmost is true
    	set frontAppName to name of frontApp
    	tell frontApp
    		tell menu bar 1
    			tell menu 1 of menu bar item frontAppName
    				tell menu item "Services"
    					tell menu "Services"
    						click first menu item whose name contains "My Item"
    					end tell
    				end tell
    			end tell
    		end tell
    	end tell
    end tell


    When executed with keyboard maestro (hotkey) or the script editor, it does exactly what I expect: Search for a menu item under Services and click it. 

    However, when doing the same in alfred (also hotkey, tried main thread and through 'run script'), the 'Edit' menu item just flashes shortly and that's it. 


    Anyone an idea why this happens? 

  17. Super simple workflow for interacting with DEVONthink.






    - `ds` to search DEVONthink
    - `dn` to create a new DEVONthink note


    Also defines a `Import To DEVONthink` file action to quickly add files from Alfred to the DEVONthink Inbox. (Very useful with the File Selection shortcut from Alfreds Features -> File Search -> Actions to instantly open the currently selected file in Alfred)




    Get it here: https://github.com/dvcrn/alfred-devonthink/releases


    This workflow will auto-update itself when a new version is available. If you don't want this, open the workflow and remove the "Auto Update" node. 



    - Global hotkey to paste whatever is in the clipboard to DEVONthink


    If you have other cool ideas that would make DEVONthink with Alfred even more useful, please let me know :)

  • Create New...