Jump to content

How to send multiple args via External Trigger?


Recommended Posts

Hi Alfred team, right now we can pass one argument via External Trigger (ET). Any way to pass in multiple args? I think maybe we can pass in all args in a single string and then split them, but that requires work to be done in every single workflow. Any good way to pass in multiple args? Something like: `alfred://runtrigger/com.alfredapp.abc/mysearch/?argument=test&argument2=test2`

 

Please share other ideas/suggestions. An example workflow would be great.

 

 

 

 

 

Edited by andy4222
Link to comment
  • andy4222 changed the title to How to send multiple args via External Trigger?
  • 1 month later...

@andy4222 The way I'd approach this is pass the single argument in the URL as comma or pipe separated, then add a Split Arg object after which can split this into either variables or multiple arguments depending on how you want to use it within the workflow.

Link to comment
  • 2 months later...

Are there any updates on resolving the issue of sending multiple arguments? Thank you.

Currently, I'm using a separator to pass multiple arguments, but it's very clumsy.

 

const sep = "******";
const args = `${itemID}${sep}${path}${sep}${contentType}`;

Zotero.HTTP.request(
  "GET",
  `alfred://runtrigger/AIAssistants/upload/?argument=${args}`
);
 

 

 
Edited by carllx
Link to comment

URLs don’t have the concept of an arbitrary number of arguments, everything is either part of the path or a named parameter. Which is what the Things example is doing, changing different known options, each with a single value. It’s fundamentally different to what you’re trying to do with Alfred, that interface wouldn’t make sense it that context. Similarly, there’s nothing about Automation Tasks that would be different than what you should already be doing. If you want to call externally via a URL with an arbitrary number of unnamed arguments, you have to split on something, as @Andrew described above.

Link to comment
Posted (edited)

My bad if I wasn't clear, but at least what I meant was named args. 

 

my wish: `alfred://runtrigger/com.alfredapp.abc/mysearch/?argument=test&argument2=test2`

what Things does: `things:///add?title=test&completed=true&show-quick-entry=true`

 

And maybe in Alfred objects and be able to say `{var:argument2}` and gets the arg value? 

Edited by andy4222
Link to comment

To clarify further, what you’re asking for are variables. Which is what Things is doing in the example (a title variable with the value text, a completed variable with the value true, and so forth). As I’ve explained before, it is using fixed parameters to configure known fields, which is very different from your request, which is to have arbitrarily named key/value pairs (i.e. one could just make up argument2 and more).

 

That surfaces its own class of problems. How would one distinguish between the argument passed to Alfred and a variable called argument? And what to do about those already relying on the feature as is? Plus it closes the door on the URL handler gaining extra features, because then no new simple keywords could be added as those might break existing workflows that used those same words.

 

Your request is noted, and no one is saying it won’t ever happen. But I’m asking that you have confidence we do things in certain ways for good reason. Those reasons are what keeps Alfred lean, fast, and stable, even on pre-releases. I’m not explaining the constraints to be contrarian—quite the opposite, I’m doing it so you understand them and can think up improved suggestions or solutions for yourself. That is the way to becoming a better developer and designer. It’s important to never forget everything in software exists in a context, and ideas need to make sense for a wide range of users. We think long and hard about these issues.

 

Though right now it’s also very worth it to think about and appreciate the view that is passing me by. Trees trees trees, green everywhere! I’ll stare at it a bit more and let these ideas marinate further. I wish you a pleasant and relaxed week.

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