26
Completed

Possibility to copy if conditions from actions

Hello there 👋

This is a request for Joaomgcd, to implement a new feature into Tasker, which I believe will save lots of time when dealing with actions that has a complicated set of conditions set.

Currently, duplicating or reusing a tasks if-conditions is impossible. You can duplicate the action and preserve its conditions, but if you need the conditions on a different action, you are forced to tediously reconfigure the (at times) complicated conditions.

My hope is that it will be considered to allow copying the conditions off an action, much like an action is copied by long pressing it. The menu in the top featuring copy, cut and delete, could feature a button called copy conditions, or paste conditions if conditions are placed in the clipboard.

What does youppeople think about the idea? I found this idea which would also satisfy my request: https://tasker.helprace.com/i210-don-t-reset-action-conditions-when-changing-the-action

Kind Regards

5 replies

Copy-pasting conditions and converting to/from if blocks have been implemented in Tasker v6.2.18 (https://bit.ly/tasker6_2_changelog).

Thanks for reminding me! 😁👍

S

I second this idea. As I wrote in the Google groups (https://groups.google.com/forum/#!msg/tasker/q9VLpFjSqOA/uFF-HLC6CQAJ), I think it's sufficient to just keep conditions when switching the type of an action. By this, you can just copy any action and then change it - by this, you effectively copied the conditions.

Of course Joao is right about it being better to put complicated conditions into variables. But Tasker provides us with the inline conditions feature. So what happens in real life is this:

  • You create an action with a simple condition - simple stuff, no need for boolean variables or if-constructs.
  • After a while, turns out you need another condition. And then another. But still only for this one action, so keeping it as inline conditions is still more compact.
  • Then at some point, you need another action with the exact same conditions. Now you're in trouble.

If inline conditions were kept when changing the action, now you could either copy the action and change the type of the copy to the new one. Or you change it to "IF" and can then make a block for this condition set. Or, as Joao proposes, change it to "Variable Set".

Anyway, that's what happens in real life, where you can't just plan all these things beforehand.

AT

Hello Slarti, 

What you describe as real life, is exacly the situation that i find myself in, time and time again. Thank you for weighing in on this, it's much appriciated. 

What I would do is have a Variable Set action with all those conditions. Then later in the task you can simply check if the variable is set :)

It's never good policy to copy if conditions. If your condition changes, you'll have to go in all the actions and change it everywhere. It gets messy real quick.

It's really better to centralize your conditions somewhere and re-use from there.

AT

That would result in a severe overhead of condition-variables? Rather than checking the condition directly, you propose that we manage a multitude of variables instead?
Furthermore, conditions may not be feasible to group together on a single variable?

Hi. Can you clarify why you can't use an If action and then put all the actions that need condition inside the If group?

AT

Sure, avoiding if actions sometimes provides cleaner code  depending on the use case. Also the nature of the task might change during development where copying conditions can be needed. Also there is the general need to reuse conditions in different spots,.

Recreating this is quite combersome for example: https://m.imgur.com/Cs9gZwk

SW

Functions in the same way variables work would be cool