Jump to content

Create an auto-suggest workflow?


Recommended Posts

Hi,

 

I have a number of custom searches for my companies internal/external sites and find myself searching for the same sets of keywords day after day and would love to have a workflow to help me streamline this process. Basically my own local autosuggest with the following features:

 

  1. Saves all keywords searched to disk so that the next time I trigger the workflow it will autosuggest the previous keywords searched and allow me to filter the list as I type.
  2. It would also be great if I could configure these different autosuggest workflows to use the same keyword dataset for their suggestions as I often end up searching across different urls with the same keywords.

 

Has anyone come across a workflow that can do this.

 

Thanks

Edited by Alfred0
Link to comment
  • Alfred0 changed the title to Create an auto-suggest workflow?

Wow, this is AMAZING, tku so much for helping @deanishe 🙏 🙏 🙏

 

If I wanted to duplicate this workflow to use for other urls do you know the best way to go about that? I tried simply duplicating it and changing the keywords but I ran into this error:
 

[19:45:06.975] ERROR: Go To URL With History[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/tony/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5C60DE21-919E-402F-B68F-2F23CF082B62/./search-history.py", line 19, in <module>
    CACHE = Path(os.environ['alfred_workflow_cache'])
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'alfred_workflow_cache'

 

 

Also, do you know if it would be possible for a different workflows to share the same history.txt file?

 

Edited by Alfred0
Link to comment
4 hours ago, Alfred0 said:

I tried simply duplicating it and changing the keywords but I ran into this error:

 

It sounds like you need to change the bundle ID, too.

 

4 hours ago, Alfred0 said:

Also, do you know if it would be possible for a different workflows to share the same history.txt file?

 

Absolutely. Just edit the workflows so they all point to the same history file.

 

The proper way to do it would be to add a variable for the path to the history file.

 

Add a variable called, say, history_file set to ~/search-history.txt and change the  HISTORY = CACHE / 'history.txt' line to HISTORY = Path(os.environ['history_file']).expanduser()

 

Then you can delete the CACHE lines from the script and don’t need to worry about the bundle ID (delete it).


Also, don't forget you can add additional searches to the first workflow instead of creating duplicates.

Edited by deanishe
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...