cremoer Posted August 16, 2019 Share Posted August 16, 2019 Hi there, I am relatively new to Alfred workflows and I could not figure out yet, how to pass more than one variable - from let's say an osascript(JS) - back to the Alfred workflow, so that I can use them there as {var:var1}, {var:var2} and so on. Sorry, if this question has been already answered, but I did not find it... Kind regards, Kay Link to comment
deanishe Posted August 17, 2019 Share Posted August 17, 2019 There is a variables HOWTO stickied at the top of this forum. The latest version is here: https://www.deanishe.net/post/2018/10/workflow/environment-variables-in-alfred/ Link to comment
cremoer Posted August 17, 2019 Author Share Posted August 17, 2019 Sorry, I read this already, but I don’t understand it somehow. I need an example, if possible. Or a little example workflow. I looked really a lot, but don’t get it.... Link to comment
deanishe Posted August 17, 2019 Share Posted August 17, 2019 If you're using a Script Filter, your JS code would look something like: function run(argv) { return JSON.stringify({items: [{title: 'test', variables: {var1: 'val1', var2: 'val2'}}]}); } If you're using a Run Script action, the JS would be: function run(argv) { return JSON.stringify({alfredworkflow: {arg: 'test', variables: {var1: 'val1', var2: 'val2'}}}); } If you need any further help, please say exactly which bit you're having difficulty with. Link to comment
cremoer Posted August 17, 2019 Author Share Posted August 17, 2019 Super!!! That's it... I was thinking in the right direction, close to it, but as often, not 100% right. Thanks a lot 😀 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