jamafu Posted April 23, 2021 Share Posted April 23, 2021 Here is what I am trying to achieve: Script list is triggered and list of countries is displayed User selects a country Selected country value/arg is passed to subsequent script filter This second/subsequent script filter is triggered automatically (after the user selected a country in first script filter) The displayed list (in the second script filter) is customized based on the selected country The input field should be empty 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. Link to comment
deanishe Posted April 23, 2021 Share Posted April 23, 2021 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} jamafu 1 Link to comment
jamafu Posted April 23, 2021 Author Share Posted April 23, 2021 That works perfectly! Thank you, @deanishe for the quick reply. Have a nice day 👋 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