Disclaimer: This post is being written by someone who had to Google what a 'Terminal emulator' IS before downloading it and using it for this procedure. I do not know if this procedure can harm your device in any way. So as with most things root, please proceed At your own risk. Perhaps a more experienced user could chime in on any possible dangers.
110% of the credit for this goes to .. GermainZ.. It is his amazing script found here:
that makes it all possible..
I am Not sure this keyboard shortcut is available on all devices However if you 'Hold the menu button' and press "v" this should activate a Paste function.
Unfortunately GermainZ's helper script above is either device or manufacturer specific (I'm not sure wich) so the event codes listed below are for a I moto droid 4 running 2.3.6. rooted.
The thing that took me the longest time to figure out was the actual number of the events per button push. Without looking it up I believe in the tutorial it states something like MOST Buttons have 4 events. The key word obviously being most.. And the tricky part being Even if you send an incomplete Set of events you can still get a partially correct response. For example I thought I had found the correct 4 events for the letter "v" because a capital "V" was returned but it turns out to get the proper "v" I actually needed 10 events ( 5 for down press 5 for up) and the menu button was a total of 14 ( 7down 7 up) on my device.
Here is what I found:
AGAIN.. THIS IS FOR A DROID 4.........
Menu. Button
sendevent /dev/input/event4 3 53 95
sendevent /dev/input/event4 3 54 1017
sendevent /dev/input/event4 3 48 15
sendevent /dev/input/event4 3 50 1
sendevent /dev/input/event4 3 57 0
sendevent /dev/input/event4 0 2 0
sendevent /dev/input/event4 0 0 0
sendevent /dev/input/event4 3 53 95
sendevent /dev/input/event4 3 54 1017
sendevent /dev/input/event4 3 48 0
sendevent /dev/input/event4 3 50 1
sendevent /dev/input/event4 3 57 0
sendevent /dev/input/event4 0 2 0
sendevent /dev/input/event4 0 0 0
"v" Button
sendevent /dev/input/event1 3 2 265
sendevent /dev/input/event1 0 0 0
sendevent /dev/input/event3 4 4 15
sendevent /dev/input/event3 1 47 1
sendevent /dev/input/event3 0 0 0
sendevent /dev/input/event1 3 2 269
sendevent /dev/input/event1 0 0 0
sendevent /dev/input/event3 4 4 15
sendevent /dev/input/event3 1 47 0
sendevent /dev/input/event3 0 0 0
So for the menu short cut simply put the first 7 events for the menu button (down press), then a 1 sec wait then the entire 'v' button then the rest of the menu button
Hitch it all together for a 'Run shell' action in tasker and you get this:
sleep 10; sendevent /dev/input/event4 3 53 95; sendevent /dev/input/event4 3 54 1017; sendevent /dev/input/event4 3 48 15; sendevent /dev/input/event4 3 50 1; sendevent /dev/input/event4 3 57 0; sendevent /dev/input/event4 0 2 0; sendevent /dev/input/event4 0 0 0; sleep 1; sendevent /dev/input/event3 4 4 15; sendevent /dev/input/event3 1 47 1; sendevent /dev/input/event3 0 0 0; sendevent /dev/input/event1 3 1 998; sleep 0; sendevent /dev/input/event4 3 53 95; sendevent /dev/input/event4 3 54 1017; sendevent /dev/input/event4 3 48 0; sendevent /dev/input/event4 3 50 1; sendevent /dev/input/event4 3 57 0; sendevent /dev/input/event4 0 2 0; sendevent /dev/input/event4 0 0 0
And we are now pasting with tasker. All thanks to the tremendous work of 'The amazing Mr. Z'
When i get a chance I will post this along with other newbie help tips over on GermainZ's post.....
Rich....
# vibrate for 500 ms
busybox echo 500 > "/sys/class/timed_output/vibrator/enable"
Oooooooops........ I did do some testing before I posted this but as usual forgot to test with the slide out keyboard closed ... I always have the keyboard out any time I use the phone so it is almost its natural state.. The Paste work around does not work when the keyboard is closed, so I would suspect that it would not work on devices without a slide out keyboard. So unless I can figure out a way to emulate the keyboard being open the paste work around will have limited use. :( Sorry if I instilled any false hope..... Rich.
Here is some more disappointing info on this subject I found after a little more research.
- The google gods have decreed that we no longer need keyboard shortcuts. So from ICS and beyond they are no longer available.
- In gingerbread and below you definitely need a physical keyboard and it needs to be open for the shortcuts to work..
So in short if you have a device running gingerbread or below, that has a physical keyboard and you would like to paste something with tasker. But only when the keyboard is open...... Then this is just the work around you have been looking for.
This will obviously be a very sought after procedure so please be patient when posting questions and comments. I will answer them as timely as I can.......... :) ...
Rich..
> In other words... you should be able to use the script to simply emulate a long press + a "Paste" tap.
Yup, that was the way I was heading but thought I had found a nice little short cut... a little more research up front would have been a good idea..
>
> Also, adding a timeout option is much more tricky than expected. Simply put, the buffer isn't being, umm.. "pushed" fast enough so I can't get real time data from getevent. Asked on SO for advice, we'll see.
>
> Thanks for trying to improve. Once you know what you are looking for the way it is now actually works quite well..
Rich..
> Run Log shows a run error when trying to execute my getevents. If this is the wrong syntax, let me know; I simply place the following into a 'Run Shell' Action:
With 'use root' selected of course... ?
It looks OK ......
Just curious, what buttons are you emulating?
Everything is working in emulator?
Do you get a error if you try to just emulate one button?
Rich..
>