Jump to content

[SOLVED] How to get user query (what is typed to Alfred) from inside a script filter


Recommended Posts

I want to modify Searchio workflow so that if I press cmd key + return on any of the results, it would search what I typed into Alfred on Google/YouTube/.. 

 

So if I press cmd + return on alfred sickert result, it would instead of searching alfred sickert make a query on what I typed in Alfred (alfred is sick in this case). Thus saving me a keystroke of up arrow and return (where current fallback query is placed in Searchio).

 

 1972103756_2018-11-15at21_46.png.1286dc174fea47e6b9ca021695b77c1f.png

 

From what I understand, this is impossible to achieve due to Alfred not providing this information. Or I am wrong?

 

If I am wrong. I would like to move this thread to feature requests as I really wish this feature existed.

 

Thank you.

Edited by nikivi
Link to comment

This doesn't make any sense. {query} is exactly what is fed to the program as input. Literally no Script Filter can work without it unless you have "Alfred filters results" checked.


As you're talking about Searchio!, the variable is literally called query.


All you need to do is modify the Item.

 

Exactly how long did you spend thinking over this problem before you started making screenshots and composing your forum post? Five seconds? Less?

Edited by deanishe
Link to comment
  • vitor changed the title to [SOLVED] How to get user query (what is typed to Alfred) from inside a script filter

@deanishe Can you help with guiding me on how I can customize Searchio to do customized searches on modifier key presses? i.e. doing Google Lucky search on Google script filter with alt+return?

 

I haven't touched Go in quite a bit of time and would literally do anything to get this feature working in Searchio.

Edited by nikivi
Link to comment

No, not really. What you're asking would be a lot of work because the basic data model of the workflow is "one engine per search".

 

Changing that would require some fairly fundamental changes to the workflow, not just a few lines of Go.

 

I'm not going to implement it because I have no use for the feature (I never, ever use "I'm feeling lucky" and I don't think it applies to any other search engines). And I'm not going to help you do it because helping you with code, I am sorry to say, is almost never an enjoyable or rewarding experience for me.

Edited by deanishe
Link to comment

I will try to rewrite Searchio myself with a different data model. I also wanted to include a small portion of Searchio code in my Web Searches workflow to use Google powered suggestions queries to search any website on the net. (MIT license allows me to do it if I mention where I got the code from). But rewriting Searchio should be a learning experience. Might do it in OCaml too as I've been learning it.

 

33 minutes ago, deanishe said:

I am sorry to say, is almost never an enjoyable or rewarding experience for me.

 

Makes perfect sense.

 

Thank you for your help and time.

 

Edited by nikivi
Link to comment
26 minutes ago, deanishe said:

I don't think it applies to any other search engines

 

It does. i.e. cmd + return on YouTube search filter to make a search for past month on YouTube. I see many more cases where I want to scope my search to a certain filter but reuse the suggestions powered by Searchio. Although Google Lucky search is most crucial of them all.

Edited by nikivi
Link to comment
1 minute ago, deanishe said:

Decouple the suggestions from the searches

 

I do think that is a superior way than what Searchio provides currently. This way it is a lot more flexible and can achieve everything current Searchio achieves too.

Link to comment
4 minutes ago, nikivi said:

This way it is a lot more flexible and can achieve everything current Searchio achieves too.

 

At the cost of increased complexity and the fact that you would then have suggestions that may not actually lead to any search results.

 

So no, it doesn't achieve everything Searchio does. You lose the guarantee that there are some search results for the workflow's suggestions.

Link to comment
1 minute ago, deanishe said:

the fact that you would then have suggestions that may not actually lead to any search results

 

By default you add a search engine that will as default result on activating suggestions run the query on the engine's website. Just like what Searchio does now.

 

What makes Searchio unique is the suggestions. The version I am thinking of building looks and works exactly like Searchio does now but has ability to customize outputs of searches to custom URLs. Not sure how that would work Alfred wise but I believe it should be possible.

Link to comment

In fact I think what would be awesome is to use my Web Searches workflow to let users customize custom searches driven by some engine. Either on default result or on modifiers. Through the settings, like what Search has with Installed Searches ... to list all current filters. On return of any of the results let user pick through return, alt, opt, cmd, fn, shift and then on return of those show up Web Searches prompt of all the different searches to map to. With ability to add a custom search if none of the searches you want satisfy you. (Of course user can also extend Web Searches database optionally too).

 

That would be pretty cool I think and it's already written in Go. I might try to read through all of Searchio code and extract all the relevant parts I need to try make this work. If I will need to rewrite Searchio for this, so be it.

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