Sometimes some actions in tasks take a long time to execute (like a web request for example) so it's great to have a way to get feedback on how they're progressing.
Enter Progress Dialogs.
You can have Indeterminate and Determinate progress dialogs.
Indeterminate will just show a dialog when you don't know how long it will take or how many items you want to process.It looks something like this:
Detrminate will show you the ammount of progress you've achieved so far. It looks like this:
Let's start by creating an Indeterminate Progress Dialog
STEP 1 - SHOW DIALOG
- In a Task add an AutoTools Dialog action before the work that times some time to do
- Set the Dialog Type to Progress
- Set the title to Please Wait
- Set the icon to something like this (not shown in the video, sorry, forgot!)
- Set the text to Doing some stuff...
- Set the text color to a color you like
- Set the Background Color to white or any color you like
- Copy the text color and paste it in the Icon Tint field just so the icon has the same color as the text
- Accept and go back to Tasker
STEP 2 - DO STUFF AND CLOSE DIALOG AFTERWARDS
- Do the stuff that takes some time to do. In this example I simply added a 5 second wait to the task to simulate long-running stuff
- Add another AutoTools Dialog action
- Set the Dialog Type to Progress again
- Don't change any setting other than checking the Close option.
If you now run this, the dialog will show for 5 seconds and then disappear.
Now let's see how you can create an Indeterminate Progress Dialog. As mentioned above, you'll need to have some kind of progress you can monitor for this to be useful. In this example I process an array of 5 elements and show when each is processing in the dialog.
STEP 1 - DO SOMETHING 5 TIMES
- In a new task add a For action
- Set the Variable name to %count
- Set the Items field to 1:5
- Accept and add a End For
This will make Tasker loop 5 times whatever actions are inside the For action
STEP 2 - SHOW DIALOG
- Add an AutoTools Dialog action
- Set the Dialog Type to Progress
- Set the Title to Doing multiple things
- Set the Text to Doing stuff %count
- Set the Current Progress to %count
- Set the Max Progress to 5
This will show a progress dialog that will be updated on each loop iteration with the current value of %count
STEP 3 - DISMISS DIALOG
- Add another AutoTools Dialog action
- Set the Dialog Type to Progress
- Don't change any setting other than checking the Close option.
STEP 4 - ADD WAIT ACTION
- Add a 1 second wait action after the AutoTools Dialog action inside the For loop
This is just so that you can see the progress dialog update itself once a second. Otherwise it would go away too soon.
STEP 5 - TEST DIALOG
If you now test the task you'll see the dialog being shown, updated with the progress and dismissed
![](data/resource_icons/0/165.jpg?1474912111)
Showing progress dialogs for tasks that take long to execute
Learn how to make tasks that take longer to execute show you some feedback on what they're doing