2
Planned

"Wait Until Command" Action

The command system is incredibly powerful and simple to use, it can be used as a way to simplify various projects and tasks into a single one that takes the command and does stuff based on the command itself.

It is easier than "Run Task" because the syntax is significantly easier. However, the drawback is that if you have one task that triggers a command and another that gets triggered by it, the first one has no way of knowing if the second one finished without problem, as there's no "return variable" option and no way to logically allow it.

I propose a "Wait until command" action (or a option in the "Wait Until" action) that halts the task until a given command was broadcasted

2 replies

Can you give me an example of how you would use that exactly?

If you can, give me an example of the calling task and the called task if the action you are proposing existed already and how the new action would help.

Thanks!

Ooof, apologies for not seen this before.

I've ran into this issue shortly before you've introduced Shizuku.

My project was trying to implement Shizuku in Tasker using Rish, I was pretty proud of it because it would set up Shizuku and would have examples and would work as a central way for users to simply call for a common Shizuku function without having to copy the action that used shizuku:

There were a bunch of events profiles that reacted in Shizuku=:=Bluetooth/Mobiledata/WIFI=:=on/off/toggle.

The issue is that sometimes it wouldn't work because Shizuku wasn't running yet, this would be incredibly easy to fix if there was a way to return a broadcast that it ran fine.

My idea would be for Task1 to run the command using a unique identifier, if necessary, idk shizuku=:=Bluetooth=:=on=:=timestamp=:=ok, this would trigger Task2 that dealt with everything, and when it ended, it would broadcast some command with Task1 timestamp back, which would be interpreted by the Task1 `Wait for Command` action as the command running fine.

The Command System is incredibly powerful and could easily become a way to centralize tasks and projects that have the same "skeleton" but different values. Like disabling/enabling apps without having to prepare for a variable, changing volumes without having a defined number. You can have a very complicated task that does almost everything related to a "theme", and have it work dynamically using parameters in the command system. The only thing that holds me back is that there is no way for the task that ran the command to get some feedback if it worked or not

I was unhappy with my previous comment.

"Wait for Command" action would work like the Command Event trigger: Command Filter, split the parameters into variables, and would have an timeout option so it doesn't wait indefinitely.

As previously stated, my main case is for Task A to send a command that triggers Task B.

Right now Task B can fail for whatever reason, but Task A will have no way of knowing or react accordingly. Right now the assumption is that whatever Task is triggered will either run successfully or deal with it.

You could something similar with `Run Action`, but it becomes very cumbersome. You need to use Passthrough and Return Variables, both Tasks need to be maintained together and refactoring needs to take both Tasks into consideration.

The proposed action also opens the possibility of decoupling complex formulas or math work from "main" tasks and returning the result. For example extracting information from an HTML page could be separated into Task B that does the extracting and "returns" to Task A the result.

A difference from Run Task is that your Task A could send a command that triggers Task B, keep running other actions and *then* use Wait for Command if you are sure that Task B takes a while to finish

Yeah, I guess this makes sense. Seems simple to add. I will probably do it after the current version comes out of beta. Thanks!

Wow, thanks João

NP! Remind me after this release if I forget please 😅

It's been more than 24 hours since the last release, where's the new beta? 😛

Chill! The new version isn't even in production yet 😅 Google still hasn't approved it. I'll have to stay a few days in maintenance mode to handle potential bugs that I need to fix before starting to work on new features.