Help with repeating a task

2,208 views
Skip to first unread message

Jake Wohldmann

unread,
Aug 28, 2013, 9:48:08 PM8/28/13
to tas...@googlegroups.com
I am experimenting with input tap to make Tasker tap the screen in certain places. So I made a task that opens a app and clicks the screen in certain areas.. I want to make it so the task repeats as much as I want. I think it's called looping. (would be nice if I could make a pop-up to ask how many times) but that is over my head. I do not understand variables very well because I can't find any in depth guides. Thank you

Rich D

unread,
Aug 28, 2013, 10:40:49 PM8/28/13
to tas...@googlegroups.com

> I am experimenting with input tap to make Tasker tap the screen in certain  places.  So I made a task that opens a app and clicks the screen in certain areas..  I want to make it so the task repeats as much as I want. I think it's called looping.  (would be nice if I could make a pop-up to ask how many times)  but that is over my head.  I do  not understand variables very well because I can't find any in depth guides.  Thank you


Could you post your profile here...  Long press on the profile name / ( 3 dot menu with 4.0+ ) export / export description to clipboard (not XML)

The beginner mode needs to be off and the profile needs to have a name to be able to export.  

And give a detailed explanation of what you are trying to achieve.  

There is a "goto" action that lets you jump back to a previous action. It is in 'task / goto'

Rich..

Brandon Horwath

unread,
Aug 29, 2013, 2:20:16 AM8/29/13
to tas...@googlegroups.com
Hey Jake,

Post your profile using the process above and you might be surprised with the volume of input and advice you get :-)

A lot of users LOVE to help and we've all been lost in tasker at some point.

Jake Wohldmann

unread,
Aug 29, 2013, 7:24:32 AM8/29/13
to tas...@googlegroups.com
Profile: Input Test (11) State: AutoVoice Recognized [ Configuration:Command: "test " ] Enter: Make Money Task (13) A1: Load App [ App:AppTrailers Data: Exclude From Recent Apps:Off ] A2: Wait [ MS:0 Seconds:11 Minutes:0 Hours:0 Days:0 ] A3: Run Shell [ Command:input tap 354 675 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] A4: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] A5: Run Shell [ Command:input tap 360 408 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] A6: Wait [ MS:0 Seconds:40 Minutes:0 Hours:0 Days:0 ] A7: Button [ Button:Back ] A8: Wait [ MS:0 Seconds:6 Minutes:0 Hours:0 Days:0 ] A9: Button [ Button:Back ] thank you!
Message has been deleted

Jake Wohldmann

unread,
Aug 29, 2013, 5:06:59 PM8/29/13
to tas...@googlegroups.com
Some one help?

Rich D

unread,
Aug 29, 2013, 6:47:10 PM8/29/13
to tas...@googlegroups.com

This should be easier to read...

OK.. you forgot the detailed description of what is working and what you would like to do. 

To loop the entire task you would just add a goto action at the end. However this will loop endlessly so you need a "stop" action somewhere in the loop but you need to figure out when you want to stop the loop. IE.. stop after it loops x times, or stop after a certain amount of time has past, or stop when app is exited.

Is this task working as expected?

When do you want the loop to stop?

Message has been deleted

Jake Wohldmann

unread,
Aug 29, 2013, 7:08:29 PM8/29/13
to tas...@googlegroups.com
Basically I want it to repeat actions 5-10 as much as I want. But I only need steps 1-4 done once. This task works fine but I just can't figure out how to make the loop

Mike L

unread,
Aug 29, 2013, 7:14:44 PM8/29/13
to tas...@googlegroups.com
Just add a "Go to" action, set to action number 5. You will need to put some sort of counter system to break the loop.
Or you could use a "For" loop. The "for" action would be setup with some random variable name, and for the items just put 1:x. With x being the number of times to loop, which can also be a variable if you go that route (Variable Query would make this possible/easy)

Jake Wohldmann

unread,
Aug 29, 2013, 7:48:28 PM8/29/13
to tas...@googlegroups.com
So I can just long hold on action 5 and add "goto"? What do I fill in in the goto action, it has a selection for type, number and" if"

Thanks!

Rich D

unread,
Aug 29, 2013, 7:51:43 PM8/29/13
to tas...@googlegroups.com

I would with the variable query and for loop as mike recommended. To expand a little on it you would put the variable query wherever you want to get the input, probably the first action.  It is in actions / variable. I would set the fields as follows ..

Title:   Input Loop count

Variable: %LOOP

Input type: numeric/decimal

Default: %LOOP

Then the for loop requires 2 actions, they are under actions/task/for  and actions/task/end for

Insert the "for" action above A5 and set the fields like this..

Variable: %null

Items: 1:%LOOP

Then put the "end for" action at the end of the loop

Post back if you get stuck....

Rich D

unread,
Aug 29, 2013, 7:58:27 PM8/29/13
to tas...@googlegroups.com

>
> So I can just long hold on action 5 and add "goto"?

If you use the "goto" you will need to make your own counter with a "variable add" action... the for loop will be easier ...

 What do I fill in in the goto action,  it has a selection for type,

You can got a action number, or a label. ( all actions have a "label" option)

and" if"

You would use the " If" in conjunction with the variable add..

Give the for loop a try ..

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Jake Wohldmann

unread,
Aug 29, 2013, 10:30:56 PM8/29/13
to tas...@googlegroups.com
Ummm. I sort of did what you said... I added the for before the 5 and I set the variable to Loop and I set the item to 1:10 to make it loop 10 times. . I didn't understand the rest you said.. And is there any way to make a pop-up when the profile is activated to set the number of times it loops? That would be nice
Message has been deleted

Jake Wohldmann

unread,
Aug 29, 2013, 11:08:10 PM8/29/13
to tas...@googlegroups.com
Edit: the loop did not work for some reason.. It went all the way to the last action (the back button) then presses the back button again. It was supposed to go back to the action 5 which was tap the screen

Brandon Horwath

unread,
Aug 29, 2013, 11:58:03 PM8/29/13
to tas...@googlegroups.com
Loop Example (195)
A1: Variable Query [ Title: Variable:%repeat Input Type:Numeric / Integer Default: Background Image: Layout:Variable Query Timeout (Seconds):10 Show Over Keyguard:On ]
A2: Variable Add [ Name:%loop Value:1 Wrap Around:0 ]
A3: Flash [ Text:Loop value equals: %loop Long:Off ]
A4: Goto [ Type:Action Number Number:2 Label: ] If [ %loop != %repeat ]

For Example (247)
A1: Variable Query [ Title: Variable:%repeat Input Type:Numeric / Integer Default: Background Image: Layout:Variable Query Timeout (Seconds):10 Show Over Keyguard:On ]
A2: For [ Variable:%loop Items:1:%repeat ]
A3: Flash [ Text:For example loop: %loop Long:Off ]
A4: End For

This will give you an idea of how loops work based on variable query :-)

Rich D

unread,
Aug 30, 2013, 6:33:51 AM8/30/13
to tas...@googlegroups.com

> Please keep in mind that I know how to use Tasker very well but I have never touched a variable before and I have no Idea what I'm doing.

Okay then... I would suggest starting with the basics, if you have not done so already please read the pocketables beginners guide.

This is a simple task that allows you to set a variable to the number of times you want to loop through a task, then it will loop through the task that many times.

My First Variable (300)
A1: Variable Query [ Title:input number for my first variable Variable:%Myfirstvariable Input Type:Numeric / Integer Default:%Myfirstvariable Background Image: Layout:Variable Query Timeout (Seconds):54 Show Over Keyguard:Off ]
A2: Variable Add [ Name:%count Value:1 Wrap Around:0 ]
A3: Flash [ Text:Number of times looped --- %count Long:Off ]
A4: Goto [ Type:Action Number Number:2 Label: ] If [ %count < %Myfirstvariable ]

I have attached the XML so you can import it to see how the actions are set up and test it..

Make sure you select tasker to download the XML from the email.
Then in tasker go to the task edit screen and long click on the task tab / select Import.

While in the task edit screen you should see a small play button. You can use this to manually fire and test the task.

Read the entire section on "variables" in the user's guide. Pay close attention to the difference between "global variables" and "local variables'

Post back with any questions you have, once you fully understand how the variables work we can implement them into your profile..

My_First_Variable.tsk.xml

Jake Wohldmann

unread,
Aug 30, 2013, 7:50:28 AM8/30/13
to tas...@googlegroups.com
Thanks. Give me about a day to read the pocketables article because it's HUGE. And when your task you sent me asks for The number of times you want it to Loop, do I just delete the text and type 2 or 3 or 4?

Jay M

unread,
Aug 30, 2013, 8:41:54 AM8/30/13
to tas...@googlegroups.com

Might be Huge but IMO its well worth a read,Andreas is great at explaining stuff,

Jay M

On 30 Aug 2013 12:50, "Jake Wohldmann" <jake.wo...@gmail.com> wrote:
Thanks.  Give me about a day to read the pocketables article because it's HUGE. And when  your task you sent me asks for The number of times you want it to Loop,  do I just delete the text and type 2 or 3 or 4?

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.

Jake Wohldmann

unread,
Aug 30, 2013, 3:25:50 PM8/30/13
to tas...@googlegroups.com
He andreas does not go into the complicated stuff such as variables though..

Rich D

unread,
Aug 30, 2013, 3:40:40 PM8/30/13
to tas...@googlegroups.com

when  your task you sent me asks for The number of times you want it to Loop,  do I just delete the text and type 2 or 3 or 4?

Yes, just delete the variable name. This is the default value of a variable that has not been set. You should only see this the first time you run the task, after that you should see the last value you entered..

Jake Wohldmann

unread,
Aug 30, 2013, 4:33:38 PM8/30/13
to tas...@googlegroups.com
Can someone just please message me on Google hangouts? Or email me @ jake.wo...@gmail.com so we can chat faster? Thank you

Mike L

unread,
Aug 30, 2013, 4:44:24 PM8/30/13
to tas...@googlegroups.com
Andreas has easily the most in depth articles to get your head around this. You're either reading the wrong page or just not reading it

Rich D

unread,
Aug 30, 2013, 5:50:30 PM8/30/13
to tas...@googlegroups.com

There is a whole section on variables.......

http://www.pocketables.com/2012/08/beginners-guide-to-tasker-part-2-variables.html

I'm having a hard time believing you could have missed this...

On Aug 30, 2013 3:25 PM, "Jake Wohldmann" <jake.wo...@gmail.com> wrote:
He andreas does not go into the complicated stuff such as variables though..

Jay M

unread,
Aug 30, 2013, 6:50:59 PM8/30/13
to tas...@googlegroups.com

IMO most of what he writes covers the complex stuff, I learnt how to use variables and some other cool stuff from his News fetcher Tutorial.

http://www.pocketables.com/2012/09/beginners-guide-to-tasker-part-4-variable-data-processing.html

Jay M

Jake Wohldmann

unread,
Aug 30, 2013, 8:20:17 PM8/30/13
to tas...@googlegroups.com
Thank you very much rich d for the example. I tried to squeeze in a part of your task to mine. I can't get it to work though.. I do not understand why so I will put the description below:


Test 2 With Var (22)


A1: Load App [ App:AppTrailers Data: Exclude From Recent Apps:Off ]

A2: Wait [ MS:0 Seconds:14 Minutes:0 Hours:0 Days:0 ]
A3: Variable Query [ Title:input number for my first variable Variable:%Myfirstvariable Input Type:Numeric / Integer Default:%Myfirstvariable Background Image: Layout:Variable Query Timeout (Seconds):54 Show Over Keyguard:Off ]
A4: Variable Add [ Name:%count Value:1 Wrap Around:0 ]
A5: Flash [ Text:Number of times looped --- %count Long:Off ]
A6: Run Shell [ Command:input tap 360 408 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ]
A7: Wait [ MS:0 Seconds:42 Minutes:0 Hours:0 Days:0 ]
A8: Button [ Button:Back ]
A9: Wait [ MS:0 Seconds:8 Minutes:0 Hours:0 Days:0 ]
A10: Button [ Button:Back ]
A11: Goto [ Type:Action Number Number:4 Label: ] If [ %count < %Myfirstvariable ]

Rich D

unread,
Aug 30, 2013, 9:03:26 PM8/30/13
to tas...@googlegroups.com

> Thank you very much rich d for the example. I tried to squeeze in a part of your task to mine. I can't get it to work though.. I do not understand why so I will put the description below:
>

Looks OK..
what exactly happens after you input the number and hit the green check??

Does it not exit the app after the second back button action??

You can check the flow with the run log.. menu / more / run log. 

If you can't get it post back with the run log.

When viewing run log hit menu/external viewer to copy and paste the log here..

Jake Wohldmann

unread,
Aug 30, 2013, 10:06:06 PM8/30/13
to tas...@googlegroups.com
Whew! I got it to work! Finally.. thanks to everyone for helping out and replying so fast. I may make a thread to upload your favorite profile.. the wiki page is a bit outdated for tasker..
Reply all
Reply to author
Forward
0 new messages