Setting default search terms

Hello everybody,
I would love to know how to set a default in DT3 so that when I type into the search bar I am automatically searching “name,” which is by far my most common search. I haven’t found any discussion for how to do this, but it would be a great option that I would use constantly.
Thanks,
Ben

It’s doesn’t insert the search prefix automatically, but you could use this script as a toolbar script.

If you put the toolbar script’s icon next to the search field it’s just a little mouse movement and one click.

-- Insert search prefix

property theSearchPrefix : "name:"

tell application id "DNtp"
	try
		set theWindow to viewer window 1
		set theQuery to search query of theWindow
		
		try
			if theQuery does not start with theSearchPrefix then
				set search query of theWindow to theSearchPrefix & theQuery
			end if
		on error
			set search query of theWindow to theSearchPrefix
		end try
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell

Thank you! I will try this (though I don’t know what a toolbar script is and will have to figure out how to make one, but I’m sure that information is available somewhere on this great forum). I will let you know if I am successful!

“Toolbar Scripts” is in the Automation section of DEVONthink 3 Help documentation. Hope that helps!

1 Like

Yes, it does - thank you. It tells me to place the script into the folder ~/Library/Application Scripts/com.devon-technologies.think3/Toolbar, which is too bad because there is no “Application Scripts” folder in my Library. So I need to figure that one out…

I do believe I have figured it out… thanks everybody

2 Likes