|
Post by razuturi on Aug 11, 2020 23:55:19 GMT
Hi
Pictures are often needed for script development. I'm trying to write a little helper script to quickly and easily navigate to certain places in apps and to save screenshots.
Background:
Some Android apps do not always recognize the mouse clicks when a mouse is connected, but AnkuLua does. The idea is to intercept the screen touch and let the script handle it. When the action is a "click", forward it. When the action is a "longClick", take a screenshot. Here is the script so far
... while(true) do local action, location, touch = getTouchEvent() if (action == "click") then click(location) elseif (action == "longClick") then region = Region(0, 0, getRealScreenSize():getX(), getRealScreenSize():getY()) region:save(os.date("sc_%d_%m_%Y_%H_%M_%S.png")) -- gray-scale-screenshot toast("Screenshot successful") end end
Questions
- getTouchEvent() covers the screen with a translucent color. Can that be switched off completely? Because otherwise the screenshot is falsified?
- Is it also possible to react to certain keys? E.g. when the "s" key is pressed, take a screenshot.
- And is it better to work with gray-scale-screenshots or with color format for performance later?
I am very happy to receive an answer
|
|
|
Post by AnkuLua on Aug 12, 2020 8:00:09 GMT
1. After getTouchEvent() executed, on the next script line, the covered translucent color is gone. You don't need to worry about it.
2. AnkuLua doesn't react to keys. You can set a region to do some actions. For example, click on upper right corner will save the screenshot.
3. gray-scale images always perform better.
|
|
|
Post by razuturi on Aug 12, 2020 8:55:03 GMT
Thanks for the fast respond.
Just curious, is there a more detailed reference on how to use the color parameter of the setTouchEventStyle() function exactly? Let's say, for aesthetic reasons, the translucent color should be white and 100% transparent. How should the function be called for this?
|
|
|
Post by AnkuLua on Aug 12, 2020 12:05:50 GMT
0x00ffffff
|
|