How perform a drag (based in X,Y mouse coordinates) on Android using AccessibilityService?

后端 未结 2 564
执笔经年
执笔经年 2021-02-01 13:14

I want know how to perform a drag on android based in X, Y mouse coordinates? consider as two simple examples, the Team Viewer/QuickSupport drawing the \"password pattern\" on r

2条回答
  •  北海茫月
    2021-02-01 14:00

    Have you tried to use AutoIt scripting?

    You can save coordinates within specific windows/screens. You can hold mouseclick pressed while drawing the pattern.

    I also have some example code / scripts for you if you want them!


    EDIT:

    According to this tutorial you can use Auto-IT on C#.

    Follow these steps:

    1. Install Auto-IT
    2. Add Auto-IT as reference in reference manager (AutoItX3.dll)
    3. Then import library that you added with: Using AutoItX3Lib;
    4. Make new AutoItX3 object called 'auto': AutoItX3 auto = new AutoItX3();
    5. You can now execute Auto It commands.

    This is the complete example for executing a mouseclick:

    Using AutoItX3Lib;
    AutoItX3 auto = new AutoItX3();
    auto.MouseClick("left", 78, 1133, 1, 35)
    


    With the AutoIt Window Info Tool you can check the coordinates you want to use.

    Please note there are differences between mouse coordinates modes:

    for example: auto.AutoItSetOption("MouseCoordMode", 1) will use absolute screen coordinates. See source here.


    For holding the mouseclick down, you can check MouseDown Function

提交回复
热议问题