2

Task: "While/End While" instructions

I know that Mateo asked for some sort of loops like "while", but he was answered with "For" loop which in programming works differently.

Also, I am asking for true "While" loop. To give better view of this concept I am going to share my case: I'd like to hear who calls on the phone. So, AutoNotification comes here and the Tasker, of course. I make three profiles: one with Event->Phone->Phone Ringing, another one with Event->Phone->Missed Call and the last one with Plugin->AutoNotification. The first two just switch value of one shared variable %phoneRings from false, when phone does not ring, to true, when it rings. The last one profile I customize for reading rotification from "Calls" application in format depending on if phone is ringing or not.

And that is the case where "while" loop enters. By now I have to make "If" task checking if phone rings and at the end of this statement I have to put "Goto" instruction pointing to the beginning. I wish there was "While" and "End While" tasks in Tasker. I could simply choose Task->While action, let it check if my variable is in desired state and then put other actions to do in a loop, of course including anywhere the case when the mentioned variable used for the described loop changes its value. And to add other actions after such loop within the same task there should be put "End While" task between the wanted loop and the rest of instructions.

1 reply

MB

Hi Simaus,

Maybe you doestn't need to check for a ending call, when you use event -> phone -> call and exit task.

depending on that, this ideas could be interesting:
https://tasker.helprace.com/i894-reorganize-caller-variables
https://tasker.helprace.com/i893-profile-variable-share-local-variable-from-start-task-in-exit-task
disclaimer: i posted both ;-)

best regards
Max