Jump to content

[SOLVED] How can I return more than one variable back from a script to Alfred


Recommended Posts

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

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
  • vitor changed the title to [SOLVED] How can I return more than one variable back from a script to Alfred

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