Click on the screen

Post your questions and help other users.

Moderator: Martin

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Click on the screen

Post by lubrasko » 25 Apr 2013 15:28

Hello,

I am new here and have been playing with Automagic for last day or so. I absolutely love it and I find it way superior and easier to use then Tasker and On{x}.

I have this problem.

I want to create a flow that will turn on my alarm (Double Twist Alarm Clock) when I put my phone on charger. This works fine, but I also want to switch the alarm app to "night watch" mode which requires 3 clicks.
I execute the launch app command and then execute the 3 clicks. The first click is on an actual element (an arrow) which works fine, but the other two clicks are only on random place on the screen (this changes the mode of the watch). Because there is no "element" to click on, these two clicks don't work. At least I think that's the reason.

Is there a way to simulate just "touching the screen" with my finger without having an actual element to click on?

Also, is there a way to simulate swipe motion from point a to point b?

Thank you.

Lubrasko

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click on the screen

Post by Martin » 26 Apr 2013 10:55

Hi,

Unfortunately the clock element seems not to support click actions.
You have to use an action Execute Root Command and simulate touchscreen events (your device needs to be rooted).

-action Execute Root Command: input touchscreen tap 200 400 (x=200, y=400) to switch to full-screen and a second time to switch to night mode


Action Control UI only supports forward and backwards scrolling in elements that support the scroll actions like lists.

A general swipe can also be simulated using the action Execute Root Command:
-action Execute Root Command: input touchscreen swipe 200 400 400 400 (x1 y1 x2 y2)

some other input commands that might be interesting (infos directly copied from adb shell):
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>

Regards,
Martin

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Re: Click on the screen

Post by lubrasko » 26 Apr 2013 16:26

Wow, fantastic!

Thank you very much.

I unrooted my phone a week ago :D.. I think I will look into getting rooted kernel for my stock image :)

Thanks again, this was very helpful.

L.

lubrasko
Posts: 7
Joined: 25 Apr 2013 15:21

Re: Click on the screen

Post by lubrasko » 26 Apr 2013 17:15

Just an update in case somebody comes across the same problem(s).

First of all, I believe one needs to have BusyBox installed in order for this command to work. This is many times standard installation during rooted devices but not always.

Then I believe you made a mistake in the command. Mine works with this:
- Action - Execute Root Command - input tap 200 400

There is no touchscreen in that command (on my device anyway)

I made it work now and love it,

Thanks again. I am buying this app right now. I love it! You are a great developer that deserves support.

L.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click on the screen

Post by Martin » 26 Apr 2013 17:58

You are right, the command is not the same on every device/ROM. I only checked the stock Android 4.2.2.

S3 (4.1.2)
input text <string>
input keyevent <key code number or name>
input tap <x> <y>
input swipe <x1> <y1> <x2> <y2>

S2 (4.0.4):
input text <string>
input keyevent <event_code>

You can also list the available options by editing an action Execute Root Command: input then press menu->Execute, menu->Log

Regards,
Martin

evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Re: Click on the screen

Post by evebrea » 24 Jan 2014 18:28

None of these are working on my Kyocera rise running android 4.0.4. I need a way to emulate touch to sign in to an app automatically

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click on the screen

Post by Martin » 25 Jan 2014 10:57

Maybe your device does not have the required input command. Please execute the following action and check the log:
-action Execute Root Command: input

The log output should look like this:

Code: Select all

25.01.2014 11:47:36.397 [Flow] Action 'Execute Root Command: input in ' stderr=Usage: input [<source>] <command> [<arg>...]
    The sources are:
    trackball
    joystick
    touchnavigation
    mouse
    keyboard
    gamepad
    touchpad
    dpad
    stylus
    touchscreen
    The commands and default sources are:
    text <string> (Default: touchscreen)
    keyevent [--longpress] <key code number or name> ... (Default: keyboard)
    tap <x> <y> (Default: touchscreen)
    swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
    press (Default: trackball)
    roll <dx> <dy> (Default: trackball)
25.01.2014 11:47:36.397 [Flow] Action 'Execute Root Command: input in ' exit_code=0
The output will look different on your device but it will show what kind of options are supported on your device.
Please post the output of your device or send the output by mail to info@automagic4android.com (in the log: menu->Send Log).

evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Re: Click on the screen

Post by evebrea » 25 Jan 2014 17:01

just sent you the log as suggested. It's coming from evechanbrea@gmail.com

I did not see ANY of that stuff you posted.. just stuff like "could not load needed library"

I'm doing this on a Virgin Mobile Kyocera Rise
Maybe something's missing? I used a hack called "poot" to root it, and install supersu..
pretty sure it doesn't remove anything.. but maybe there's some libraries i need that i can download?
the support for this phone kind of sucks.. but it can tether to my tablet and costs less for unlimited data

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click on the screen

Post by Martin » 27 Jan 2014 17:33

Thanks for the log. To me this looks like an issue of the ROM itself or a problem of the root-binary since su can not successfully execute the command 'input' at all.
Are you already using the latest ROM available for this device and is the root-binary up-to-date?

evebrea
Posts: 116
Joined: 12 Aug 2013 15:28

Re: Click on the screen

Post by evebrea » 28 Jan 2014 02:12

Actually i'm not using any rom. I don't think there is one. All i did was use poot to give it superuser access.. i've seen a couple places that say even trying to put a rom on this thing can brick it..

Post Reply