Oh, sorry. I was wrong from the beginning. I put the script after the execute flow, thus subflow didn't get the variable. My bad. I only use execute flows once in my whole flow, and didn't pay attention to the variable being passed from parent to subflow. Which means any other use of execute flow besides using it in widget, can pass parameter properly. (this is no longer a weakness compared to tasker). I mostly want to use execute flow in widget click. But I need parameter, thus I have changed it to send broadcast/general broadcast pair.
That means
current concept of execute flow actually is fine already, as the variable can be passed properly. Without any additional trigger, every flow should behave this way, accepting every variable from parent flow. For variable duplicate, I think this should be the homework of the user to make sure the variables don't overlap. We have a lot of name variation can be used. The only problem now is for widget, as the
widget can only have one action mapped to the clickable action. Thus execute flow with parameter is requested.
Probably there is a better way to solve this widget problem. If you can add a new function
executeFlow(flowname,skip,wait,returnvar) in the Script action, widget click problem can be solved. No need to add additional parameter option, or to execute with certain variable. Since I can use single action script only, declare the variable first and use function executeFlow.
Code: Select all
number = 0;
executeFlow("Multi Clipboard",false,false,false);
{number} is passed to the flow Multi Clipboard, where in the flow it paste the clipboard index 0. I have 5, so each of the widget will have the {number} changed to 1, 2, 3 and 4 (pasting clipboard index 1, 2, 3, and 4 respectively). I can put more variable as I wish, without using broadcast anymore.
Execute flow with variable/parameter is considered done then, if we can have this new function
executeFlow() in Script action.
=====================================
The first idea of mapping variable is actually for dealing with template, to change the parameter in the template to match the variable we are using at that flow when creating the template. But now it developed to function

I have contemplated on this several times.
Adding new trigger
Input Arguments will act just like a firewall, to block any variable being passed from parent to subflow. But I think it will become a separate function on its own. Since flow and trigger are different, I can add multiple triggers to a single flow. You maybe need to create a new action, Execute (flow with) Input argument. Or maybe just name it as "
Execute Function" in order to execute the input arguments trigger. If you reuse the same Execute Flow,
it will only execute only the flow, not the trigger. While we need to be able execute the trigger separately from the flow, if we are going to use this Input Arguments trigger.
If I understand correctly, First we define Trigger Input Arguments : "Addition", with two arguments a and b, with return value x. We can also in another flow (or maybe same flow but different trigger), define Input Arguments : "Subtraction", with 3 arguments : a, b and c; and return value x and y. Then in the parent flow, use action Execute Input Argument (or Execute Function), we can choose from any available input argument triggers we have made. (the same way we choose shortcut from available triggers shortcut we have made).
I choose to execute Input Argument "Subtraction", then in the parent flow i will have the field a, b, c provided. In each of the field, i would define which variable to map
Input a : {biggernumber}
Input b : {smallernumber}
Input c : {comment}
If the trigger also return value, the return field x and y also provided. we can fill in the return variables
Return x : {confirmation}
Return y : {result}
No need for additional action return value, as the whole thing is handled by the trigger itself, which act as a firewall to allow only return value of x and y.
This way, we can view the trigger input arguments "Subtraction" as a new function
Subtraction(Number a, Number b, String c) with the return value (String x, Number y)
Execute function "Subtraction" with the arguments above is almost like executing
substraction(biggernumber, smallernumber, comment)
and return the result in {confirmation} and {result} to the parent flow. Only {confirmation} and {result} will be returned back. a, b, c, x, y all stays in input argument flow.
I see this Trigger input argument
becomes a kind of custom user defined function. It doesn't share variables from the parent flow, but only take arguments and output return value. Basically the whole concept is very similiar to execute flow, except
input argument create a separate sandbox enviroment for all its own variable. If it is going to be this way, I wish it can be also called from the script
executeFunction(), the same way
executeFlow() to be implemented later.
We can put multiple Input arguments trigger in single flow and separate them using the same concept multiple parallel expression. This way, I can put the frequent used "function" in single flow and maintain from there.
Regards,
Desmanto