Jump to content

How to make this workflow simpler?


Recommended Posts

This is more of a general question since I'm trying to optimize and learn a few more Alfred tricks and best practices. 

 

Hi, I have written a small workflow/module (let's call is OpenOrSearch module) which is triggered via external trigger and helps to open URLs based on:

 

1. If it's a open or search keyword command (e.g., I enter `li <space>` into Alfred. Since the query is empty space, it open LinkedIn.com, else it opens LinkedIn.com?q=<query>) - search/open URL set outside of this module/workflow

2. If I want to open the URL in Browser/BetterTouchTool floating view (for temporary stuff - ChatGPT/gemini) - controlled by setting variable outside of this module/workflow

3. If I want to paste the content on the webpage (some website don't have a query param way of searching things)

 

I need help with two things:

1. Can we simplify this workflow somehow? - maybe for future improvements

2. Right now I'm setting `open_url` and `search_url` when calling this OpenOrSearch module from another workflow, so i think the "{query}" value gets injected/replaced in the `search_url` right away before even reaching OpenOrSearch. I want it to be cleansed (right now is only trim but can be other stuff later) in the OpenOrSearch before it getting replaced in the variables. any way to do that? 

3. In general, I was thinking to keep all this extra things like pasteContent, trim query, where to open URL etc, in this module as they can be reused. What do you think?

 

 

image.thumb.png.a1ceeb56fdc3b63463f12c529e683b8e.png

 

 

workflow:

https://www.dropbox.com/scl/fi/ddd81irnx386m0ihz0u52/Open-or-Search.alfredworkflow?rlkey=48ioaz3fxlq2g284wpuc1e8ss&dl=0

 

image.thumb.png.93653999a192ac36730ce1caaf8d4fa3.png

Edited by andy4222
Link to comment
  • andy4222 changed the title to How to make this workflow simpler?

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...