Jump to content

Chain script filters and pass arguments


Recommended Posts

Here is what I am trying to achieve:

  1. Script list is triggered and list of countries is displayed
  2. User selects a country
  3. Selected country value/arg is passed to subsequent script filter
  4. This second/subsequent script filter is triggered automatically (after the user selected a country in first script filter)
  5. The displayed list (in the second script filter) is customized based on the selected country
    1. The input field should be empty
  6. The user can still type in the input field to filter the results

 

All this works except steps 5.1 and 6 since the passed value always appears in the input field.

I guess what I am asking is how to pass environment variables to a script list that are not displayed in the input field?

 

The language of my scripts is Typescript / Javascript and I try to access env variables via

const selectedCountry = process.argv[2];

This is the correct way to access variables that have been passed via Alfred Workflows (works in all my other scripts).

However, there is no env variable in the second script list which I would need to pre-filter the options that are then displayed to the user.

 

 

543806820_Screenshot2021-04-23at08_00_26.png.71425a36b6816e3ab423e5c8d2272e80.png

Link to comment
41 minutes ago, jamafu said:

The language of my scripts is Typescript / Javascript and I try to access env variables via


const selectedCountry = process.argv[2];

 

Value/arg and ARGV are command-line arguments, not environment variables.

 

It looks like you’re using Node, which (I think) puts environment variables in process.env.

 

If you want arg “moved” to an environment variable, so the second Script Filter has an empty query, add an Arg and Vars utility between the Script Filters with an empty Argument field, and a variable with the value {query}

 

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