Sometimes you just want to get the result of something in the same task instead of having to deal with multiple profiles with AutoApps commands.
For example, ever wondered how you can create a notification and wait for it be clicked and find out which button was clicked in the same task and act on it?
Or maybe you wanted to get a remote device's location and have the location available to you in the same task and not in a separate profile, making the task flow much easier?
Here's how to do that with AutoTools Wait and Report
STEP 1 - CREATE PROFILE TO REPORT ALL AUTOAPPS COMMANDS
Many AutoApps (and even some non-AutoApps) use AutoApps commands to send information into Tasker and let you act on it. Here we'll create a profile that simply reports all of these commands with the AutoTools Action Report action so we can act on them later in tasks with the AutoTools Action Wait action.
- Create a new Profile in Tasker
- Use the AutoApps Command event condition
- Accept the settings right away so that all AutoApps commands will trigger this profile
- Accept and create the Task
STEP 2 - REPORT ALL AUTOAPPS COMMANDS
%aamessage contains whatever the received AutoApps command was
- Add a Flash action with the text Reporting %aamessage just to let you know that the reporting is being done correctly
- Add an AutoTools Action Report action
- set the Request Id to autoappscommand
- copy this value: you're going to need it later
- Accept and go back to Tasker's main screen
STEP 3 - SET TASK PRIORITY TO MAX
For this to work correctly, this task needs to run while other tasks are running at the same time. In Tasker, this means that this profile's task needs to run at a higher priority level so that it can start when other tasks are already running. Because of this, we need to make sure this task runs with a higher priority than any other task, so we're going to set it to the maximum value allowed
- Long click the profile
- Go into its settings
- Set Task Priority to 50
STEP 4 - CREATE NOTIFICATION
- Add a new Task and call it Wait For Notification
- Add an AutoNotification action
- Set the title to Are You Sure? and the text to Do you really want to do that?
- Set the Button 1 action to yes and the label to Yes
- Set the Button 2 action to no and the label to No
STEP 5 - WAIT FOR NOTIFICATION ACTION
This action will wait until the Report action reports an action with the autoappscommand Request ID, which, as we saw above, will happen when any AutoApps command is triggered. So, effectively, this action will wait until the notification is clicked to proceed.
- Add a AutoTools Action Wait action
- Set the Request ID to autoappscommand just like you set it in the Report action above
- Set the Variables to answer
- Because you're just expecting 1 value from the notification (yes or no) uncheck the Last Variable Array option
- Accept and go back to Tasker
STEP 6 - SET TIMEOUT TO 10 SECONDS
If no AutoApps command is received in 10 seconds the Wait action will timeout and the task will stop executing
- Set the time you want to wait for the notification click. In this case I chose 10 seconds, but you can make it whatever time you want
STEP 6 - FLASH IF ANSWER WAS YES
This will make the Flash only show up if you clicked on the Yes button. If you clicked on the No button the task will proceed but nothing will be flashed. If the wait times out because nothing was clicked the Task will stop at the Wait action
- Add a Flash action with the text The answer was positive! Woohoo!
- Set the If condition in the task to %answer matches yes
STEP 7 - TEST IT!
The Wait action will always time out if tested manually in a Task.
Because of the way Tasker works, events won't trigger when a Task is being manually tested, so there's no way you can run the AutoTools Action Report Tasker action in a different task in this situation. You can only use this in a real, 'non-testing' situation, like for example with a home screen shortcut like shown below.
- Add a shortcut to the task to your home screen
- Set any icon for the task
- Touch the icon to start the task: a notification will be created
- Touch the Yes button: the flash showing you that yes was clicked will show.
- Clear the notification
- Run the task again from your homescreen
- Click on the No button: the flash will not show up this time!
This can now be used to wait for any AutoApps command! For example, you can request a remote device's location with AutoRemote and then wait for the response in the same task, and directly have access to the latitude and longitude in their own variables!
STEP 8 - WAIT FOR REMOTE LOCATION
- Create a new Task called Wait For Remote Location
- As before, add the AutoTools Action Wait action and set the Request Id to autoappscommand
- This time set the Variables to latitude,longitude
- Uncheck the Last Variable Array option
- Add a Flash action that shows %latitude and %longitude
STEP 9 - TEST WAITING FOR REMOTE LOCATION
As you can see, AutoTools automatically set the latitude and longitude values in their own variables because the command that was sent was 2 values separated by a comma. If you want you can send commands with your own separator. For example, if you want to use the AutoApps Command System you should set the Separator to =:= in the AutoTools Action Wait action config, under Advanced.
- Add the task to your homescreen like before
- Run the task
- From your AutoRemote Personal Url send something like 43.2232,56.2323
- Check that the flash with latitude and longitude appears
To sum it up, Wait and Report is a great way of making ANY Tasker interaction a linear experience. No more separate profiles to handle AutoApps commands if you don't want to. Everything can be done in the same Task!
Wait for notification click in the same task that created the notificaiton (ie any AutoApps command)
Learn how you can wait for any AutoApps command and get the result in the same task