Jump to content

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


Recommended Posts

Posted

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

Posted

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

Posted

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.

Posted

Super!!!

That's it... I was thinking in the right direction, close to it, but as often, not 100% right.

Thanks a lot 😀

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