19
Planned

Run sub-tasks

1) Allow the "perform task" action to have unlimited number of parameters

2) Allow the "perform task" action to return an array variable

3 replies

The current workaround for not being able to return arrays is to use variable join and split.

Instead of unlimited parameters, an idea would be to have all local variables in the calling task be available in in the called task and returned to the calling task. In addition, variables created in the calledctask should be returned  alto the calling task. If done well, this could permit sharing local variables between an unlimited number of levels of tasks.

Should be part of Tasker.

I think this is an interesting idea, because this is exactly the way Scenes currently work.

Whenever a Task calls for a Scene to open, all of the Task's local variables and arrays are available within the Scene.

And the Scene holds on to them as long as the Scene exists.

I think a good solution to apply this to "Perform Task" would be to make sending all the variables from the calling Task an option. So there would be a checkbox in the "Perform Task" action labelled "Share Variables" :)

In which case all local vars get sent into the sub-Task, and when the sub-Task is finished any modified var values (as well as any new var names and values created) can get sent back to the calling Task, via a modified "Return" action.

The "Return" action would have its own checkbox option for "Return All Variables". This way, with the checkbox options - all current Tasks using the current method will still function, and anyone who wants to use "Perform Task" in the usual way can still do so.

There is currently a workaround way to send umlimited varnames and var values to the other Task using a single AutoTools action:

https://www.reddit.com/r/tasker/comments/3d1f0q/how_to_send_unlimited_par_tasker_variables_over/ct2ckv8/

Yes, that is a work around, but it can require a significant number of actions to accomplish.