Jump to content

How to pipe output to a new Alfred look-up session?


Recommended Posts

Hey everyone,

 

I am writing my first workflow. After doing everything in JXA, I discovered https://github.com/sindresorhus/alfy, which I enjoy.

 

In my use case, I have a simple API endpoint returning JSON. In that endpoint, I can search/filter for a title, but I am interested in the key property. When pressing tab or enter I set autocomplete and the key to key

In other words, a video is more helpful than my description:

SikNR.gif

(Screen capture is from this workflow)

 

After pressing tab/enter on Breaking Bad, it takes the output key of it and launches like a new search instance.

 

How do I achieve this in JavaScript land?

Edited by Kalaschnik
Link to comment
2 hours ago, Kalaschnik said:

After doing everything in JXA, I discovered https://github.com/sindresorhus/alfy, which I enjoy.


If you’re using a library, then it becomes a question for its author or documentation.

 

2 hours ago, Kalaschnik said:

When pressing tab or enter I set autocomplete and the key to key.


That part is unclear. There is an autocomplete key in Alfred’s Script Filter JSON, but no key. What exactly are you doing?

 

3 hours ago, Kalaschnik said:

After pressing tab/enter on Breaking Bad, it takes the output key of it and launches like a new search instance.

 

The way to force the autocomplete to expand on ↩ is to set valid to false. The Script Filter then reruns because the input changed. Presumably (haven’t verified), that workflow is checking if the input starts with a known string (t: or m:) to react accordingly.

 

3 hours ago, Kalaschnik said:

How do I achieve this in JavaScript land?


The language is irrelevant. All that matters is that you output the correct JSON.

Link to comment
30 minutes ago, vitor said:

The way to force the autocomplete to expand on ↩ is to set valid to false. The Script Filter then reruns because the input changed. Presumably (haven’t verified), that workflow is checking if the input starts with a known string (t: or m:) to react accordingly.

That part is really helpful! Thank you vitor!

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