Jump to content

Create workflow search history

Recommended Posts

Hi, first off I'm a complete workflow newbie. I'm using a workflow to initiate a search in a new DEVONthink window. Quite often I want to redo a search after some time but DEVONthink's "recent searches" dropdown doesn't list searches that were initiated via AppleScript (and even if they were included I'd still want to use Alfred).


What's the easiest way to save workflow queries to later get back to them when using the workflow with a modifier?


I know I can use the "Append To File" action or write the query into a file via AppleScript, but I've no idea what format I should write (a newline separated file? CSV? JSON?) because I've no idea what action to use to access the file. Already thought of simply using AppleScript's "choose from list" but finally want to learn how to write an Alfred workflow.




Link to comment
56 minutes ago, Pete31 said:

am I missing something?


Kind of, but it's not obvious. If you right-click on your Keyword or Script Filter, choose Inbound Configuration and set Inbound Mode to "Keyword" (and give your Keyword/Script Filter a keyword), your workflow will open in "normal" mode (keyword + query) even when you use a Hotkey. Then Alfred will remember your queries in its history.


If you don’t want the keyword showing up in normal results, put a punctuation mark at the beginning (e.g. :devon)

Edited by deanishe
Link to comment
5 hours ago, deanishe said:

it's not obvious


Never would have found this, thanks!


However Alfred's history only remembers the last 20 queries globally, not for each workflow. That doesn't help much I'm afraid. Any pointers which action (List or Script Filter) to use? I probably could create JSON via AppleScriptObjC however I hope there's an easier way.

Link to comment
19 minutes ago, Pete31 said:

Any pointers which action (List or Script Filter) to use?

You probably want a Run Script to save the query and call Devon, and a Script Filter for searching your query history. Remember you can connect two in parallel to your Keyword, so you can save the query and call Devon at the same time.


20 minutes ago, Pete31 said:

I probably could create JSON via AppleScriptObjC however I hope there's an easier way.

Just about any other language that supports JSON, tbh. JXA, Python, Ruby, PHP etc.


Unless you’re really handy with AppleScript, of course. 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...