Alfred0 Posted November 16, 2021 Share Posted November 16, 2021 (edited) 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: 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. 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 November 16, 2021 by Alfred0 Link to comment
deanishe Posted November 16, 2021 Share Posted November 16, 2021 This workflow combines a web search with a history. Edit the Open URL to change the site that's searched (by default, it's DuckDuckGo). You'll need to have Python 3 installed, either via Homebrew or Apple's Developer Tools. Alfred0 1 Link to comment
Alfred0 Posted November 17, 2021 Author Share Posted November 17, 2021 (edited) 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 November 17, 2021 by Alfred0 Link to comment
deanishe Posted November 17, 2021 Share Posted November 17, 2021 (edited) 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 November 17, 2021 by deanishe Link to comment
Alfred0 Posted November 18, 2021 Author Share Posted November 18, 2021 Thx again @deanishe, works perfectly!!! 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