Wait until "perform task" complet

1,013 views
Skip to first unread message

Tomer

unread,
Nov 29, 2019, 9:14:56 AM11/29/19
to Tasker
Hi, i the task is running to the end and don't wait for A3 to be completed.

For now, i added wait 10 seconds, but how can i delete it and make it to wait until A3 task is completed and then proceed to A4?

Profile: Waze Reload (10)
     Restore: no
     State: Profile Active [ Name:Cardo Connected ]
     State: Not AutoNotification Intercept [ Configuration:Notification Title: Waze ]
    Enter: Waze Reload (11)
     Abort Existing Task
     A1: AutoInput Unlock Screen [ Configuration:Unlocking Screen.
    
    Android 7 and above:
    This will only unlock your screen if you're using a non-secure lock screen or if Smart Lock (Trusted Places, Trusted Devices, etc) is currently active.
    
    
    Android 6 and below:
    it's highly recommended that you use the Tasker 'System Lock' action at the end of this task. If you don't, your screen's lock will be permanently off and your system might even become unstable.
    
    This action WILL NOT work with a secure screen lock even if you are using Smart Lock. It will only work if you have screen lock security set to none or swipe. Timeout (Seconds):10 ] 
     A2: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
     A3: Perform Task [ Name:Open Waze From Google Assistance Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 
     A4: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ] 
     A5: Go Home [ Page:0 ] 
     A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] 
     A7: Turn Off [ Dim:Off Lock:On Continue Task After Error:On ] 

Rich D

unread,
Nov 29, 2019, 9:28:15 AM11/29/19
to Tasker Google Groups Post
Child task should definitely complete before the parent task continues. you can try adding a plus one to the priority category as described in The help text. 

Are you sure the task is not completing and it is just taking a while to open the app?

You can check the run log for the exact times. 

Hippo Man

unread,
Nov 29, 2019, 9:39:17 AM11/29/19
to Tasker
On Friday, November 29, 2019 at 9:14:56 AM UTC-5, Tomer wrote:
Hi, i the task is running to the end and don't wait for A3 to be completed.

For now, i added wait 10 seconds, but how can i delete it and make it to wait until A3 task is completed and then proceed to A4?
[ ... etc. ...  ]

What does your  Open Waze From Google Assistance task do? If it simply invokes a Launch App action, that action returns when the app is launched and doesn't wait for the app to complete. If that is what you're doing, then I believe you'll need use an "Application" profile for that app with an Enter and Exit task to set and clear a variable, and then have a loop in your main task which waits for that variable to be cleared before you can assume that the app has completed.

Hippo Man

unread,
Nov 29, 2019, 9:43:08 AM11/29/19
to Tasker
On Friday, November 29, 2019 at 9:39:17 AM UTC-5, Hippo Man wrote:
What does your  Open Waze From Google Assistance task do? If it simply invokes a Launch App action, that action returns when the app is launched and doesn't wait for the app to complete. If that is what you're doing, then I believe you'll need use an "Application" profile for that app with an Enter and Exit task to set and clear a variable, and then have a loop in your main task which waits for that variable to be cleared before you can assume that the app has completed.

... or have your main task exit after A3 and have A4 through A7 being performed in the Exit task I describe above. In this case, your Enter task could just be a do-nothing task.


Tomer

unread,
Nov 29, 2019, 9:44:25 AM11/29/19
to Tasker
20191129 16.41.12 E Start ID0:0.0 TaskService
20191129 16.41.14 T Running ID11 Waze Reload
20191129 16.41.14 A OK ID11.1 Waze Reload.com.joaomgcd.autoinput\n***\n*!&$*;com.joaomgcd.autoinput.activity.ActivityConfigUnlockScreen
20191129 16.41.17 A OK ID11.2 Waze Reload.Wait
20191129 16.41.17 T Running ID42:2 Open Waze From Google Assistance
20191129 16.41.17 A OK ID11.3 Waze Reload.Perform Task, Open Waze From Google Assistance
20191129 16.41.17 A OK ID42:2.1 Open Waze From Google Assistance.com.joaomgcd.autoinput\n***\n*!&$*;com.joaomgcd.autoinput.activity.ActivityConfigUnlockScreen
20191129 16.41.21 A OK ID42:2.2 Open Waze From Google Assistance.Wait
20191129 16.41.21 A OK ID42:2.3 Open Waze From Google Assistance.Launch App
20191129 16.41.21 A Disabled ID42:2.4 Open Waze From Google Assistance.Voice Command
20191129 16.41.21 A Disabled ID42:2.5 Open Waze From Google Assistance.com.joaomgcd.autoinput\n***\n*!&$*;com.joaomgcd.autoinput.activity.ActivityConfigPerformAction
20191129 16.41.21 A Disabled ID42:2.6 Open Waze From Google Assistance.com.joaomgcd.autoinput\n***\n*!&$*;com.joaomgcd.autoinput.activity.ActivityConfigPerformAction
20191129 16.41.21 A Disabled ID42:2.7 Open Waze From Google Assistance.com.joaomgcd.autoinput\n***\n*!&$*;com.joaomgcd.autoinput.activity.ActivityConfigPerformAction
20191129 16.41.21 T ExitOK ID42:2 Open Waze From Google Assistance
20191129 16.41.31 A OK ID11.4 Waze Reload.Wait
20191129 16.41.31 A OK ID11.5 Waze Reload.Go Home
20191129 16.41.33 A OK ID11.6 Waze Reload.Wait
20191129 16.41.33 A OK ID11.7 Waze Reload.Turn Off
20191129 16.41.33 T ExitOK ID11 Waze Reload
20191129 16.41.33 E Stop ID0:0.0 TaskService
20191129 16.41.41 E Start ID0:0.0 TaskService
20191129 16.41.44 E Stop ID0:0.0 TaskService

Tomer

unread,
Nov 29, 2019, 9:44:40 AM11/29/19
to Tasker
Open Waze From Google Assistance (42)

    A1: AutoInput Unlock Screen [ Configuration:Unlocking Screen.
   
    Android 7 and above:
    This will only unlock your screen if you're using a non-secure lock screen or if Smart Lock (Trusted Places, Trusted Devices, etc) is currently active.
   
   
    Android 6 and below:
    it's highly recommended that you use the Tasker 'System Lock' action at the end of this task. If you don't, your screen's lock will be permanently off and your system might even become unstable.
   
    This action WILL NOT work with a secure screen lock even if you are using Smart Lock. It will only work if you have screen lock security set to none or swipe. Timeout (Seconds):10 ]
    A2: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
    A3: Launch App [ App:Waze Data: Exclude From Recent Apps:Off Always Start New Copy:Off Continue Task After Error:On ]
    A4: [X] Voice Command
    A5: [X] AutoInput Action [ Configuration:Type: Text
    Value: Type mode
    Action : Click Timeout (Seconds):20 ]
    A6: [X] AutoInput Action [ Configuration:Type: Text
    Value: Type a message
    Text to Write : Open waze
    Action : Write Timeout (Seconds):20 ]
    A7: [X] AutoInput Action [ Configuration:Type: Text
    Value: Send
    Action : Click Timeout (Seconds):20 ]
Message has been deleted
Message has been deleted

Hippo Man

unread,
Nov 29, 2019, 10:02:08 AM11/29/19
to Tasker
    A3: Launch App [ App:Waze Data: Exclude From Recent Apps:Off Always Start New Copy:Off Continue Task After Error:On ]

This is the Launch App action that I am referring to in my earlier message.

Create an "Application" profile for the "Waze" app and move the following into its Enter task ...  
    A4: [X] Voice Command
    A5: [X] AutoInput Action [ Configuration:Type: Text
    Value: Type mode
    Action : Click Timeout (Seconds):20 ]
    A6: [X] AutoInput Action [ Configuration:Type: Text
    Value: Type a message
    Text to Write : Open waze
    Action : Write Timeout (Seconds):20 ]
    A7: [X] AutoInput Action [ Configuration:Type: Text
    Value: Send
    Action : Click Timeout (Seconds):20 ]

In its Exit task, you can put these steps from your originally mentioned task ...

     A5: Go Home [ Page:0 ] 
     A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] 
     A7: Turn Off [ Dim:Off Lock:On Continue Task After Error:On ]

The 10-second wait can be removed.


Tomer

unread,
Nov 29, 2019, 10:08:57 AM11/29/19
to Tasker
I have it in "perform task" because i have few other tasks that call this task, so your workaround will work only for specific situation.

Even %priority+1 isn't working.

Hippo Man

unread,
Nov 29, 2019, 10:20:08 AM11/29/19
to Tasker
On Friday, November 29, 2019 at 10:08:57 AM UTC-5, Tomer wrote:
I have it in "perform task" because i have few other tasks that call this task, so your workaround will work only for specific situation.

Even %priority+1 isn't working.

Unfortunately, Launch App works in this manner: i.e., that action returns as soon as the app is launched and before the app completes ... and in fact, that action returns even before the app might have fully come up on the screen. So despite the complexity, I believe some sort of "Application" profile(s) will be needed to handle the cases you refer to.

As for %profile versus %profile+1, those are equivalent in modern versions of Tasker (where "modern" means  "released within the past couple years or so").



Tomer

unread,
Nov 29, 2019, 10:42:38 AM11/29/19
to Tasker
I will try to add some var in the and of the Launch App, and wait for it down the road.

Hippo Man

unread,
Nov 29, 2019, 10:54:27 AM11/29/19
to Tasker
On Friday, November 29, 2019 at 10:42:38 AM UTC-5, Tomer wrote:
I will try to add some var in the and of the Launch App, and wait for it down the road

Yep. That should work, and here are some details of how that might be implemented ...

Set up the tasks and then Application profile in the way I described above.

Create a WazeTaskRunning variable and initialize it to 0 during Tasker start-up.

At the top of the Open Waze From Google Assistance task, set the WazeTaskRunning variable to 1.
After A7: Turn Off [ Dim:Off Lock:On Continue Task After Error:On ] in its Exit task as I specified above, set WazeTaskRunning back to 0.

Create a new task, perhaps called OpenWazeWrapper.
The first action of this task should be to set WazeTaskRunning to 1.
Its second action should be to Perform Task Open Waze From Google Assistance.

After that, go into a loop and repeatedly test the value of WazeTaskRunning with a short wait between loop iterations.
Once that variable gets set to 0, exit this task.

Then, instead of performing Open Waze From Google Assistance, always perform WazeTaskRunning with its priority set to %priority.
This should cause the calling task to wait until the Waze dialog completes.

This is complicated, but unfortunately, this kind of complication often can't be avoided in event-driven frameworks like that of Tasker.

Rich D

unread,
Nov 29, 2019, 11:03:06 AM11/29/19
to Tasker Google Groups Post
You could also try the %WIN variable with accessibilities permission granted for Tasker.  You would put a wait until action after they perform task action, and wait until the window label of the app matches %WIN

Hippo Man

unread,
Nov 29, 2019, 1:59:54 PM11/29/19
to Tasker
On Friday, November 29, 2019 at 11:03:06 AM UTC-5, Rich D wrote:
You could also try the %WIN variable with accessibilities permission granted for Tasker.  You would put a wait until action after they perform task action, and wait until the window label of the app matches %WIN

Ah ... yes. Wait Until Action could alleviate the need for using an Application context, and it could make this a bit simpler.


Reply all
Reply to author
Forward
0 new messages