Speed up DPAD presses?

2,147 views
Skip to first unread message

kssxs

unread,
Feb 13, 2013, 3:04:30 AM2/13/13
to tas...@googlegroups.com
Is there a way to speed up the delay in between DPAD presses?  I have a task that launches an app, and then I need to send 14 DPAD DOWN button pushes (and then a couple of DPAD PRESS's) but it's fairly slow in doing that.  Also, I noticed that the max number of button presses is limited to 10.

Anyone have any ideas here, or alternative solution?

Thanks!

Matt R

unread,
Feb 13, 2013, 1:37:15 PM2/13/13
to tas...@googlegroups.com
You can try doing the actions in one shell script. Search this forum for "emulate key press" and you should find the thread explaining it.

Matt

kssxs

unread,
Feb 14, 2013, 5:58:25 AM2/14/13
to tas...@googlegroups.com
Believe it or not, I found that method to be slower than Tasker's 'input' method.  I was hoping there was some way to change the time in between DPAD clicks to something like 50ms, because the way it is right now, it feels like 1.5 seconds.

TomL

unread,
Feb 14, 2013, 6:09:35 AM2/14/13
to tas...@googlegroups.com
Instead of 14 down presses, could you go the other direction and wrap around? So if you're traversing a 20 item list, instead of clicking 14 down, go 6 up?

Tom

kssxs

unread,
Feb 15, 2013, 5:45:17 AM2/15/13
to tas...@googlegroups.com
I had tried that, but found it, unfortunately, doesn't work.

Vladimir Oz

unread,
Feb 15, 2013, 6:49:22 AM2/15/13
to tas...@googlegroups.com
can You show us Your shell script that is slower than Taskers DPAD?  

TomL

unread,
Feb 15, 2013, 7:30:10 AM2/15/13
to tas...@googlegroups.com
Try Alt-Down, then Up Up Up.  On my phone, that jumps to the last item, and allows me to go up up.

Tom

Matt R

unread,
Feb 15, 2013, 3:29:40 PM2/15/13
to tas...@googlegroups.com
Tom, do you know how to do alt-down in a shell command?

Matt

TomL

unread,
Feb 15, 2013, 3:50:53 PM2/15/13
to tas...@googlegroups.com
I use the app "KeyEvent Display" to find the codes. On my phone, alt is keycode 57, down is keycode 20. I think those numbers would work in Tasker's send key event action.

I'm not sure about from a shell script.

Tom

Matt R

unread,
Feb 15, 2013, 6:20:52 PM2/15/13
to tas...@googlegroups.com
My problem is how to do two key events at the same time. Alt then down is obviously different than alt+down. Have you successfully had Tasker send alt+down?

Matt

TomL

unread,
Feb 15, 2013, 8:19:30 PM2/15/13
to tas...@googlegroups.com
No, I haven't used it myself. I think you would use the sendevent shell command to send:

"alt" key down
"down" key down
"down" key up
"alt" key up

Tom

kssxs

unread,
Feb 16, 2013, 5:24:57 PM2/16/13
to tas...@googlegroups.com
Can you show the commands to carry out what you did, please?  I can't seem to replicate it.

Thanks!

GermainZ

unread,
Feb 17, 2013, 2:48:48 PM2/17/13
to tas...@googlegroups.com

GermainZ

unread,
Feb 17, 2013, 2:56:22 PM2/17/13
to tas...@googlegroups.com
Hit the Post button a bit early.

I'm not sure if that would work - in theory, it might. What you basically want is to *try* something like this (I'm using random codes just to give an example; refer to the thread for instructions on how to build the script):
sendevent /dev/input/event5 1 33 1
sendevent /dev/input/event5 0 0 0 <-- These two lines press "alt"
<--- "alt" is still pressed --->
sendevent /dev/input/event5 1 55 1 sendevent /dev/input/event5 0 0 0
sendevent /dev/input/event5 1 55 0 sendevent /dev/input/event5 0 0 0 <-- Press and release down sendevent /dev/input/event5 1 33 0 sendevent /dev/input/event5 0 0 0 <-- These two lines release "alt"

TomL

unread,
Feb 17, 2013, 3:59:06 PM2/17/13
to tas...@googlegroups.com
Some keyboards interpret a double press as a sticky press, so:

ALT ALT DOWN would be the same as press & hold ALT, press DOWN.

So, you can try:

"alt" key down
"alt" key up
"alt" key down
"alt" key up


"down" key down
"down" key up

Tom

Rich D

unread,
Feb 17, 2013, 5:34:41 PM2/17/13
to tas...@googlegroups.com

> Some keyboards interpret a double press as a sticky press, so:
>
> ALT ALT DOWN would be the same as press & hold ALT, press DOWN.

That is great info... If that works then maybe it would be possible to get a paste function with  the keyboard shortcut ' hold menu + V'  

That is probably wishfull thinking but night be worth a shot....  :)

Rich D

unread,
Feb 17, 2013, 6:05:55 PM2/17/13
to tas...@googlegroups.com


> http://forum.xda-developers.com/showthread.php?p=38072214#post38072214

Thanks GermainZ...  I missed this post earlier. Very clear and informative .. your efforts are much appreciated. It would appear that a paste function might very well be possible.  I will give a try..   Rich.

Oon-Ee Ng

unread,
Feb 17, 2013, 6:24:21 PM2/17/13
to tas...@googlegroups.com
I'd be very interested in whether this is possible/succeeds.

Vladimir Oz

unread,
Feb 18, 2013, 12:59:58 AM2/18/13
to tas...@googlegroups.com
Come on!
This script have to run at maximum system priority to be not interrupted by some delays. I have some experience of sendevent at hi-loaded env.

Any ALT-<BTN> have its' own keycode. So, You have to find it, only.

Wow! on my CM 10.1 (4.2.1) input becomes as powerful as needed :)
# input --help
Error: Unknown command: --help
usage: input ...
input text <string>
input keyevent <key code number or name>
input [touchscreen|touchpad] tap <x> <y>
input [touchscreen|touchpad] swipe <x1> <y1> <x2> <y2>
input trackball press
input trackball roll <dx> <dy>
root@android:/ # input touchscreen swipe 10 50 10 200  -- swipes notifications :)

GermainZ

unread,
Feb 18, 2013, 3:45:56 AM2/18/13
to tas...@googlegroups.com
Renice Tasker (e,g, renice -10 `pidof net.dinglisch.android.taskerm`) using the script to give it a higher priority. Add some delays (sleep 1) e.g. before swiping to make sure the notification bar is already fully pulled down.

Vladimir Oz

unread,
Feb 18, 2013, 4:14:58 AM2/18/13
to tas...@googlegroups.com
Sure, but it can fail in some circumstances. 
as I found, not only Tasker, script in Run Shell should be niced.

kssxs

unread,
Feb 18, 2013, 5:10:58 PM2/18/13
to tas...@googlegroups.com
Thanks to everyone for all of the assistance provided here.  I've learned a new method of input from all of this!

I found that Vladamir's method works best.  Not only is it EXTREMELY fast (and since I have an S3, it's not an issue whatsoever).  I used Tasker's 'Run Shell' action, and put in an 'input swipe <x1> <y1> <x2> <y2>' command to scroll my app's screen to the bottom where the buttons are, and then I used (in another 'Run Shell' action) 'input tap <x> <y>' to hit the appropriate buttons.  I put in a couple of very small wait times (25ms) in between taps so that the application had time to respond to the previous tap and bring up the appropriate buttons.

This is now working PERFECTLY!  I've not automated wallpaper resizing with the help of a 3rd party app that doesn't have Tasker support in it :p .

Having said that... there is one thing that I found you will need to do when trying to figure out your screen co-ordinates (for the <x> and <y> numbers above).  The easiest way to find out where your buttons are is to go into the 'Developer options' of your phone and turn on 'Show pointer location'.  When that is turned on, you can see the X and Y co-ordinates of where your finger is touching the screen.  If you point at a button you want to have Tasker click with the 'input tap' command, you can get the X and Y co-ordinate numbers using this, and can then complete your 'input tap <x> <y>' command with the right numbers.

Hope you all out there can use this to write more fantastic tasks!

Thanks again all! :)

Rich D

unread,
Feb 18, 2013, 8:37:03 PM2/18/13
to tas...@googlegroups.com

> Hope you all out there can use this to write more fantastic tasks!

Would you be willing to paste the task / profile here as a example for others?
Long press on task /profile name / export / export description to clipboard..

It would be very much appreciated .....  Rich...

kssxs

unread,
Feb 18, 2013, 8:42:15 PM2/18/13
to tas...@googlegroups.com
Sure, no problem. Here you go:


Test (34)
A1: Open File [ File:%PWallpaperSet Mime Type: ]
A2: Wait [ MS:100 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A3: Run Shell [ Command:input swipe 20 1250 20 50 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ]
A4: Wait [ MS:25 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A5: Run Shell [ Command:input tap 30 1250 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ]
A6: Wait [ MS:25 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A7: Run Shell [ Command:input tap 520 800 Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ]

Vladimir Oz

unread,
Feb 19, 2013, 1:19:43 AM2/19/13
to tas...@googlegroups.com
Actions 2 - 7 should become:

A2: Run Shell [ Command:sleep 0.1; input swipe 20 1250 20 50; sleep 0.025; input tap 30 1250; sleep 0.025; input tap 520 800  Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] 

maybe U have to tune sleep times - RunSell is faster if called once rather then batch of Actions.

вторник, 19 февраля 2013 г., 5:42:15 UTC+4 пользователь kssxs написал:

kssxs

unread,
Feb 19, 2013, 2:50:21 AM2/19/13
to tas...@googlegroups.com
Cool!

I didn't know you could string commands like that (I'm a Windows guy, so no hardcore Linux/Unix experience).

I'll try it out, thanks again!

kssxs

unread,
Feb 19, 2013, 2:56:06 AM2/19/13
to tas...@googlegroups.com
Just tried stringing the commands together into one 'Run Shell' action, and it works perfectly.  It turned out to be even faster than my initial individual steps setup, so I had to tune the first 'sleep' command to 'sleep 0.2'.

Thanks again for the information!

kssxs

unread,
Feb 19, 2013, 2:25:26 PM2/19/13
to tas...@googlegroups.com
I should have mentioned that the app I'm using this 'Run Shell' action on is called Image2Wallpaper. I don't know if it's ok to link apps like that here, so if it isn't, then please remove and accept my apologies.  If you install that, and then associate it with opening an image file to set as wallpaper, you can then create the task as I detailed above, with Vladamir's shortened steps (making the task a 2-step), to test it.  You'll see it works VERY well :) .

Rich D

unread,
Feb 20, 2013, 9:28:27 AM2/20/13
to tas...@googlegroups.com


 You'll see it works VERY well :) .

Thanks for all the great info... I will be using this shortly.... :)

Rich..

Rich D

unread,
Feb 20, 2013, 9:30:18 AM2/20/13
to tas...@googlegroups.com

>
> I'd be very interested in whether this is possible/succeeds.

Success ....   I have posted it in a new topic " How to paste in tasker" 

Rich..

Stefano Guazzotti

unread,
Mar 12, 2013, 10:08:18 AM3/12/13
to tas...@googlegroups.com
Hey, this is really interesting and powerful! I'm experimenting with this and the first thing I've tried was to pull down notification bar. So I used run shell in tasker, enabled root and executed the command: 'input touchscreen swipe 100 20 100 1000'.  Actually the notification bar is pulled down. The problem is that it doesn't stay down to show notifications, but immediately go back, the same way it acts when you pull down and release above the half of the screen.
Suggestions?

Rich D

unread,
Mar 12, 2013, 10:29:50 AM3/12/13
to tas...@googlegroups.com

There is a tasker action to pull down status bar...

Display / status bar

Rich..

Stefano Guazzotti

unread,
Mar 14, 2013, 5:26:59 AM3/14/13
to tas...@googlegroups.com
Yes, I knew that. I was just trying for fun :D

Another question: is it possible in this way to simulate a real swipe not only a straight line?

Vladimir Oz

unread,
Mar 14, 2013, 6:29:48 AM3/14/13
to tas...@googlegroups.com
Sure.
Just calc the spline's approximation points coords, build array of them and run cycle through it in RunShell action.
Should work.

But why?

четверг, 14 марта 2013 г., 13:26:59 UTC+4 пользователь Stefano Guazzotti написал:

Stefano Guazzotti

unread,
Mar 14, 2013, 9:39:17 AM3/14/13
to tas...@googlegroups.com
I don't understand one thing. Up to getting coordinates I'm OK: I'll use a small number of segments, so no problem at all. But I don't know how to run it. Can you give me a practical example using two segments, like 100,100 -> 100,300 and 100,300 -> 300,300

I'm trying to work out a way for tasker to automatically turn on/off keyguard, since both tasker's option and securesettings' one aren't working for my galaxy nexus...

Vladimir Oz

unread,
Mar 14, 2013, 9:54:54 AM3/14/13
to tas...@googlegroups.com
for i in "100,300" "200,200" "300,100"; do echo $i; done
The rest is for Your mind gym ;)

четверг, 14 марта 2013 г., 17:39:17 UTC+4 пользователь Stefano Guazzotti написал:

PC

unread,
Aug 16, 2013, 6:52:54 PM8/16/13
to tas...@googlegroups.com
Does anyone know how to simulate a long press using these types of commands?  Or, better yet, know how to get Orbot to start after launching the application using a 'Run Shell' line, or some other way?

I don't want it running all of the time as a background service, so I don't want to enable its 'Start on boot' functionality.

Thanks for any help you can provide!

PC

unread,
Sep 23, 2013, 1:42:12 AM9/23/13
to tas...@googlegroups.com
I know this thread is getting old, but I just discovered (after upgrading to Slim Bean 4.3 Build 1 on my S4) that the renice command has changed syntax.

The one I was using (from GermainZ's post here was:

renice -10 `pidof net.dinglisch.android.taskerm`

Apparently, now the command has to look something like this:

renice -r --10 -g $(pidof net.dinglisch.android.taskerm)

Of course, this doesn't work.  I'm not a Linux guy, so I don't know where the error is that I'm making, but it's something to do with the -r (there's also a new '-t TYPE' switch) and the process priority I want to set.  I'd like to use the recommendation of '-10'.

Can anyone check what the syntax of the command SHOULD be, and reply here, please?

Thanks!

Matt R

unread,
Sep 23, 2013, 2:10:12 PM9/23/13
to tas...@googlegroups.com
Try just typing renice to see if you get some command help text. On my phone, the help text indicates the command should be something like:

renice -n -10 -p $(pidof net.dinglisch.android.taskerm)

Matt

PC

unread,
Sep 23, 2013, 6:39:26 PM9/23/13
to tas...@googlegroups.com
When I type in just 'renice', I get the new syntax returned as:

renice [[-r] [-t TYPE] priority pids ...] [-g pid]

So:

type in:
renice -r --10 -g $(pidof net.dinglisch.android.taskerm)

Get error: 
unknown option -- -
USAGE: renice [[-r] [-t TYPE] priority pids ...] [-g pid]

Your suggestion:
renice -n -10 -p $(pidof net.dinglisch.android.taskerm)

Get error:
unknown option -- -n
USAGE: renice [[-r] [-t TYPE] priority pids ...] [-g pid]

I also tried:

type in:
renice -r -10 -g $(pidof net.dinglisch.android.taskerm)

Get error: 
unknown option -- 1
USAGE: renice [[-r] [-t TYPE] priority pids ...] [-g pid]

Any other suggestions anyone?

Bob Hansen

unread,
Sep 23, 2013, 6:57:42 PM9/23/13
to tas...@googlegroups.com
Try:

    renice -10 pidof 'net.dinglisch.android.taskerm'

note: it is -10 not --10.


PC

unread,
Sep 23, 2013, 7:31:59 PM9/23/13
to tas...@googlegroups.com
I get error:

unknown option -- 1

Sidenote to all attempting to help:

Is anyone actually trying these commands in a terminal window like I am?  If it doesn't work in a terminal window, it won't work, even with 'Use as Root', in Tasker...

Matt R

unread,
Sep 23, 2013, 9:54:37 PM9/23/13
to tas...@googlegroups.com
Maybe try putting the -10 in single or double quotes? I can't try these commands because the syntax on my renice command is different (and seems to work fine).

Matt

Bob Hansen

unread,
Sep 23, 2013, 10:08:19 PM9/23/13
to tas...@googlegroups.com
I ran what I posted on my phone using my terminal emulator, it does require superuser access to run though.

PC

unread,
Sep 26, 2013, 2:17:36 AM9/26/13
to tas...@googlegroups.com
So I've been messing around with various attempts to get this working, and I've got it figured out.  This is what it's supposed to look like:

busybox renice -10 -p $(pidof net.dinglisch.android.taskerm)

I've got Busybox v1.21.1 installed (the latest).  Obviously this requires a rooted phone.

Now on to figure out how to increase the speed of the UI ;) .

Steve Mills

unread,
Nov 5, 2013, 6:10:29 PM11/5/13
to tas...@googlegroups.com
Android changed a while back and Secure Settings keyguard off now only works if you're rooted.

Brandon Horwath

unread,
Nov 5, 2013, 6:24:44 PM11/5/13
to tas...@googlegroups.com
Steve Mills,

I'm running 4.1.1 without root, and can remove my keyguard using this task:

Disable Keyguard (120)
A1: Secure Settings [ Configuration:Clear Password Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]
A2: Secure Settings [ Configuration:Keyguard Disabled Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ]
A3: Perform Task [ Name:Set Slide_lock ~ enabled Stop:Off Priority:10 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A4: Variable Set [ Name:%Keyguard To:disabled Do Maths:Off Append:Off ]
A5: Zoom State [ Element:Slide Lock Toggle.w / Switcher1 State:2 ]

I don't know if you meant with the latest version of android or something.

Jeffrey White

unread,
Feb 15, 2014, 1:47:45 AM2/15/14
to tas...@googlegroups.com
hey! i have this problem with slow input taps but when i used a 25 ms wait after each tap, it doesnt do anything. its still slow! HELP! :(

On Monday, February 18, 2013 4:10:58 PM UTC-6, PC wrote:
Thanks to everyone for all of the assistance provided here.  I've learned a new method of input from all of this!

I found that Vladamir's method works best.  Not only is it EXTREMELY fast (and since I have an S3, it's not an issue whatsoever).  I used Tasker's 'Run Shell' action, and put in an 'input swipe <x1> <y1> <x2> <y2>' command to scroll my app's screen to the bottom where the buttons are, and then I used (in another 'Run Shell' action) 'input tap <x> <y>' to hit the appropriate buttons.  I put in a couple of very small wait times (25ms) in between taps so that the application had time to respond to the previous tap and bring up the appropriate buttons.

This is now working PERFECTLY!  I've not automated wallpaper resizing with the help of a 3rd party app that doesn't have Tasker support in it :p .

Having said that... there is one thing that I found you will need to do when trying to figure out your screen co-ordinates (for the <x> and <y> numbers above).  The easiest way to find out where your buttons are is to go into the 'Developer options' of your phone and turn on 'Show pointer location'.  When that is turned on, you can see the X and Y co-ordinates of where your finger is touching the screen.  If you point at a button you want to have Tasker click with the 'input tap' command, you can get the X and Y co-ordinate numbers using this, and can then complete your 'input tap <x> <y>' command with the right numbers.

Hope you all out there can use this to write more fantastic tasks!

Thanks again all! :)

Jeffrey White

unread,
Feb 16, 2014, 2:08:01 AM2/16/14
to tas...@googlegroups.com
i run tasker on my nexus 7 tablet. what is wow?? can i get it on my android device? i would like to make my input quick too. plz reply!

Jay M

unread,
Feb 16, 2014, 9:04:54 AM2/16/14
to tas...@googlegroups.com

I think he's just saying hes shocked lol

Jay M

--
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.

Jeffrey White

unread,
Feb 16, 2014, 2:04:29 PM2/16/14
to tas...@googlegroups.com
I wish someone could help me.

Bob Hansen

unread,
Feb 16, 2014, 2:45:46 PM2/16/14
to tas...@googlegroups.com
To get the fastest speed with input commands (tap or keyevent) you should put the commands in one run shell action like this:

input tap 100,200; input tap 230,540; input keyevent 26

Jeffrey White

unread,
Feb 16, 2014, 2:48:45 PM2/16/14
to tas...@googlegroups.com

I have tried that. Didn't do anything. I use tasker on a Nexus 7 2nd gen...

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/2_OZM45QzPo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.

Bob Hansen

unread,
Feb 16, 2014, 3:02:00 PM2/16/14
to tas...@googlegroups.com
Assuming the the events are executing, that is as fast as it can be using Tasker. 

More likely, inputs are occurring too fast and the command is failing. In that case, you need to add a sleep command between the inputs like:

input tap 100,200; sleep .1; input tap 230,540; sleep .1; input keyevent 26f

Try a larger value like .1 and then reduce (.1 > .05 > .025 etc until it fails) that will be the fastest it can work on your device. 

Bob Hansen

unread,
Feb 16, 2014, 3:34:48 PM2/16/14
to tas...@googlegroups.com
For a comparison, I my Droid RAZR HD it takes about 500ms per input command (tap or keyevent).
Reply all
Reply to author
Forward
Message has been deleted
0 new messages