andy4222 Posted November 26, 2021 Share Posted November 26, 2021 (edited) Hi, I have been creating workflows with alfred but find myself using lot of alfred objects that kinda do the same thing, but in a different flow (in the same workflow). How can I reduce this redundancy? For instance, here a workflow I created for amazon.com order search and amazon prime video: Goals: amazon search orders - search or open (keyword trigger "azo"): If I passed in an arg, then search it with amazon order's search (with search url), else open amazon orders page (order's page url) AND, If am holding cmd, then open whatever in chrome, else in firefox prime video - open or search (keyword trigger "pv"): If I passed in an arg, then search it with amazon prime video, else open prime video home page AND, If am holding cmd, then open whatever in chrome, else in firefox The entire pipeline between the trigger and "Open URL" is almost the same for both the workflows, except setting variables in the args. work link: https://www.dropbox.com/s/cmkovpjix8mlyuc/Amazon Search.alfredworkflow?dl=0. How do I reduce this duplication? Edited November 26, 2021 by andy4222 Link to comment
deanishe Posted November 26, 2021 Share Posted November 26, 2021 (edited) 30 minutes ago, andy4222 said: How can I reduce this redundancy? You could probably compress it all into one flow, with just a Keyword and an Arg & Vars per search if you add variables for your search and listing URLs and a JSON Config for your Open URL action. But at some point, the answer has to be "implement your logic in code". Alfred's built-in components aren't really suitable for implementing complex logic. Edited November 26, 2021 by deanishe Link to comment
andy4222 Posted November 27, 2021 Author Share Posted November 27, 2021 (edited) 20 hours ago, deanishe said: You could probably compress it all into one flow, with just a Keyword and an Arg & Vars per search if you add variables for your search and listing URLs and a JSON Config for your Open URL action. I tried a few ways, but could not figure out what you recommended. Can you please elaborate a bit? Workflow: https://www.dropbox.com/s/h91j62un0iauylq/Amazon Search.alfredworkflow?dl=0 Edited November 27, 2021 by andy4222 Link to comment
andy4222 Posted December 1, 2021 Author Share Posted December 1, 2021 On 11/26/2021 at 2:53 AM, deanishe said: You could probably compress it all into one flow, with just a Keyword and an Arg & Vars per search if you add variables for your search and listing URLs and a JSON Config for your Open URL action. @deanishe Apologies for buzzing you again, but I still couldn't comprehend how to make it work ⬆️ way Link to comment
andy4222 Posted December 2, 2021 Author Share Posted December 2, 2021 Understood. This works like a charm. I'll split the open/search modules into an external trigger and re-use it across multiple workflows. Thanks for guiding on this @deanishe, appreciate it!! 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