cythonsendevent


Namecythonsendevent JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/cythonsendevent
SummarySendevent - Android with Cython
upload_time2024-09-17 00:31:47
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords android sendevent
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Sendevent - Android with Cython

## pip install cythonsendevent

### Tested against Windows 10 / Python 3.11 / Anaconda / ADB / Bluestacks 5

### Important!

The module will be compiled when you import it for the first time. Cython and a C++ compiler must be installed!

```python
from cythonsendevent import SendeventClass, config_settings
from time import sleep
import shutil

config_settings.debug_enabled = False
adb_path = shutil.which("adb")
device_serial = "127.0.0.1:5560"

selfi = SendeventClass(
    device_touchscreen="/dev/input/event4",
    x_max_device_touchscreen=32767,  # getevent -lp
    y_max_device_touchscreen=32767,
    device_mouse="/dev/input/event5",
    x_max_device_mouse=65535,  # getevent -lp
    y_max_device_mouse=65535,
    device_keyboard="/dev/input/event3",
    screen_width=720,
    screen_height=1280,
    adb_path=adb_path,
    device_serial=device_serial,
    local_shell="",
    local_shell_su="",
    local_shell_su_cmd_exec="",
    mouse_move_codes=(
        3,
        0,
        3,
        1,
    ),
    swipe_codes=(
        3,
        53,
        3,
        54,
    ),
    exe_su="su",
    exe_su_cmd_exec="-c",
    exe_sh="sh",
    exe_getevent="getevent",
    shell_for_mouse_position=(
        adb_path,
        "-s",
        device_serial,
        "shell",
    ),
    regex_for_mouse_position=rb"_([XY])\b\s+[^\d]+(\d+)[^\d].*max\s+(\d+)",  # from getevent -lp
    add_su_to_dd_cmd="",
    add_su_to_subprocess_cmd="",
    add_su_to_input_subprocess="su",
)

# All mapped keycodes:
print(selfi.key_map)

# Write text (returns only numpy arrays)
text1 = b"Hello"
textarray1 = selfi.keyboard_write_text(text1)

text2 = list("Hello")
textarray2 = selfi.keyboard_write_text(text2)

text3 = tuple("Hello")
textarray3 = selfi.keyboard_write_text(text3)

text4 = getkeys = [
    "Q",
    "W",
    "E",
    "R",
    "T",
    "Y",
    "U",
    "I",
    "O",
    "P",
    "ç",
    "Ç",
    "ß",
    "ẞ",
    "+",
    ",",
    "-",
    ".",
    "/",
    "ã",
    "à",
    "Ã",
    "~",
    "a",
    "b",
    "ctrl+a",
]
textarray4 = selfi.keyboard_write_text(text4)
textarray4 = selfi.keyboard_write_text(text4)
press1 = selfi.keyboard_press_key(key="A", duration=0.1)
print(press1)
press2 = selfi.keyboard_press_key_combination(
    combination=["ctrl", "alt", "a"], duration=0.1
)
print(press2)
selfi.map_keys({"banana": ["KEY_B", "KEY_A", "KEY_N", "KEY_A", "KEY_N", "KEY_A"]})
press3 = selfi.keyboard_press_key(key="banana", duration=0.1)
print(press3)

# Writing text (using adb shell)
# If you are running the software on the device, substitute the prefix 'adb_' with 'local_shell_', e.g.
# adb_keyboard_press_key -> local_shell_keyboard_press_key
# adb_keyboard_write_text -> local_shell_keyboard_write_text
# Press key for a certain amount of time
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_keyboard_press_key(
    key="a",
    duration=1,
    path_on_device="/sdcard/adb_keyboard_press_key",
    blocksize=72,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
# write a text
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_keyboard_write_text(
    text="Hello my friend",
    path_on_device="/sdcard/adb_keyboard_write_text",
    blocksize=144,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

# press key combination
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_keyboard_press_key_combination(
    combination=["ctrl", "a"],
    duration=1,
    path_on_device="/sdcard/adb_keyboard_press_key_combination",
    blocksize=72,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)


# Mouse moving

(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_from_to(
    x1=10,
    y1=10,
    x2=500,
    y2=400,
    max_variationx=5,  # variations from being a straight line
    max_variationy=5,
    path_on_device="/sdcard/tmpcmd",  # will be created
    blocksize=72 * 12,  # controls the speed
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_from_to_natural(
    x1=10,
    y1=10,
    x2=500,
    y2=800,
    max_variationx=3,
    max_variationy=3,
    multiply_each_iterration=2.0,
    path_on_device="/sdcard/adb_mouse_move_from_to_natural",
    blocksize=72 * 24 * 64,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

x_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_through_coordinates(
    x_y_coordinates,
    max_variationx=5,
    max_variationy=5,
    path_on_device="/sdcard/adb_mouse_move_through_coordinates",
    blocksize=72 * 24,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

x_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_through_coordinates_natural(
    x_y_coordinates,
    max_variationx=5,
    max_variationy=5,
    multiply_each_iterration=2.0,
    path_on_device="/sdcard/adb_mouse_move_through_coordinates_natural",
    blocksize=72 * 24 * 64,  # natural and exact have much more bytedata
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)


x_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_from_current_to_natural(
    x=500,
    y=800,
    max_variationx=5,
    max_variationy=5,
    multiply_each_iterration=2.0,
    path_on_device="/sdcard/adb_mouse_move_from_current_to_natural",
    blocksize=72 * 12 * 64,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_from_current_to(
    x=500,  # uses getevent -lp to get the current mouse position
    y=500,
    max_variationx=5,
    max_variationy=5,
    path_on_device="/sdcard/adb_mouse_move_from_current_to",
    blocksize=72 * 12,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
x_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_through_coordinates_from_current(
    x_y_coordinates,
    max_variationx=5,
    max_variationy=5,
    path_on_device="/sdcard/adb_mouse_move_through_coordinates_from_current",
    blocksize=72 * 12,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
x_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_move_through_coordinates_from_current_natural(
    x_y_coordinates,
    max_variationx=5,
    max_variationy=5,
    multiply_each_iterration=2.0,
    path_on_device="/sdcard/adb_mouse_move_through_coordinates_from_current_natural",
    blocksize=72 * 12 * 64,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_touchscreen_swipe_from_to(
    x1=10,
    y1=10,
    x2=500,
    y2=800,
    max_variationx=5,
    max_variationy=5,
    random_number_start=100,
    random_number_switch=4,
    path_on_device="/sdcard/adb_touchscreen_swipe_from_to",
    blocksize=12 * 24,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_touchscreen_swipe_from_to_exact(
    x1=10,
    y1=10,
    x2=500,
    y2=800,
    max_variationx=5,
    max_variationy=5,
    random_number_start=100,
    random_number_switch=4,
    path_on_device="/sdcard/adb_touchscreen_swipe_from_to_exact",
    blocksize=24 * 24 * 128,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)


(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_touchscreen_swipe_through_coordinates(
    x_y_coordinates=x_y_coordinates,
    max_variationx=5,
    max_variationy=5,
    random_number_start=100,
    random_number_switch=4,
    path_on_device="/sdcard/adb_touchscreen_swipe_through_coordinates",
    blocksize=12 * 24 * 16,
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

# mouse commands binary data
print(selfi.mouse_map)
print(selfi.mouse_map_press)
print(selfi.mouse_map_release)

# as numpy struct arrays
btn_extra = selfi.mouse_btn_extra()
print(btn_extra)
btn_extra_long = selfi.mouse_btn_extra_long(duration=1)
print(btn_extra_long)
btn_middle = selfi.mouse_btn_middle()
print(btn_middle)
btn_middle_long = selfi.mouse_btn_middle_long(duration=1)
print(btn_middle_long)
btn_mouse = selfi.mouse_btn_mouse()
print(btn_mouse)
btn_mouse_long = selfi.mouse_btn_mouse_long(duration=1)
print(btn_mouse_long)
btn_right = selfi.mouse_btn_right()
print(btn_right)
btn_right_long = selfi.mouse_btn_right_long(duration=1)
print(btn_right_long)
btn_side = selfi.mouse_btn_side()
print(btn_side)
btn_side_long = selfi.mouse_btn_side_long(duration=1)
print(btn_side_long)
scroll_down = selfi.mouse_scroll_down()
print(scroll_down)
scroll_down_long = selfi.mouse_scroll_down_long(duration=1)
print(scroll_down_long)
scroll_up = selfi.mouse_scroll_up()
print(scroll_up)
scroll_up_long = selfi.mouse_scroll_up_long(duration=1)
print(scroll_up_long)


# Executing different mouse clicks:


(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_extra(
    path_on_device="/sdcard/adb_mouse_btn_extra",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_extra_long(
    duration=1,
    path_on_device="/sdcard/adb_mouse_btn_extra_long",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_middle(
    path_on_device="/sdcard/adb_mouse_btn_middle",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_middle_long(
    duration=1,
    path_on_device="/sdcard/adb_mouse_btn_middle_long",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_mouse(
    path_on_device="/sdcard/adb_mouse_btn_mouse",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_mouse_long(
    duration=1,
    path_on_device="/sdcard/adb_mouse_btn_mouse_long",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_right(
    path_on_device="/sdcard/adb_mouse_btn_right",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_right_long(
    duration=1,
    path_on_device="/sdcard/adb_mouse_btn_right_long",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_side(
    path_on_device="/sdcard/adb_mouse_btn_side",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_btn_side_long(
    duration=1,
    path_on_device="/sdcard/adb_mouse_btn_side_long",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_scroll_down(
    reps=10,
    path_on_device="/sdcard/adb_mouse_scroll_down",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)
sleep(1)

(
    binary_data,
    finalcmd,
    tmpfilebindevice,
    tmpfileshdevice,
    tmpfilebin,
    tmpfilesh,
    stuctarray,
) = selfi.adb_mouse_scroll_up(
    reps=10,
    path_on_device="/sdcard/adb_mouse_scroll_up",
    delete_temp_files_on_device=False,
    delete_temp_files_on_pc=False,
)

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/cythonsendevent",
    "name": "cythonsendevent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Android, Sendevent",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/38/7e/d789d1a47e6c4cc55dda77de5f2a849244011d48cc8930572a3a4c43fca6/cythonsendevent-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# Sendevent - Android with Cython\r\n\r\n## pip install cythonsendevent\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda / ADB / Bluestacks 5\r\n\r\n### Important!\r\n\r\nThe module will be compiled when you import it for the first time. Cython and a C++ compiler must be installed!\r\n\r\n```python\r\nfrom cythonsendevent import SendeventClass, config_settings\r\nfrom time import sleep\r\nimport shutil\r\n\r\nconfig_settings.debug_enabled = False\r\nadb_path = shutil.which(\"adb\")\r\ndevice_serial = \"127.0.0.1:5560\"\r\n\r\nselfi = SendeventClass(\r\n    device_touchscreen=\"/dev/input/event4\",\r\n    x_max_device_touchscreen=32767,  # getevent -lp\r\n    y_max_device_touchscreen=32767,\r\n    device_mouse=\"/dev/input/event5\",\r\n    x_max_device_mouse=65535,  # getevent -lp\r\n    y_max_device_mouse=65535,\r\n    device_keyboard=\"/dev/input/event3\",\r\n    screen_width=720,\r\n    screen_height=1280,\r\n    adb_path=adb_path,\r\n    device_serial=device_serial,\r\n    local_shell=\"\",\r\n    local_shell_su=\"\",\r\n    local_shell_su_cmd_exec=\"\",\r\n    mouse_move_codes=(\r\n        3,\r\n        0,\r\n        3,\r\n        1,\r\n    ),\r\n    swipe_codes=(\r\n        3,\r\n        53,\r\n        3,\r\n        54,\r\n    ),\r\n    exe_su=\"su\",\r\n    exe_su_cmd_exec=\"-c\",\r\n    exe_sh=\"sh\",\r\n    exe_getevent=\"getevent\",\r\n    shell_for_mouse_position=(\r\n        adb_path,\r\n        \"-s\",\r\n        device_serial,\r\n        \"shell\",\r\n    ),\r\n    regex_for_mouse_position=rb\"_([XY])\\b\\s+[^\\d]+(\\d+)[^\\d].*max\\s+(\\d+)\",  # from getevent -lp\r\n    add_su_to_dd_cmd=\"\",\r\n    add_su_to_subprocess_cmd=\"\",\r\n    add_su_to_input_subprocess=\"su\",\r\n)\r\n\r\n# All mapped keycodes:\r\nprint(selfi.key_map)\r\n\r\n# Write text (returns only numpy arrays)\r\ntext1 = b\"Hello\"\r\ntextarray1 = selfi.keyboard_write_text(text1)\r\n\r\ntext2 = list(\"Hello\")\r\ntextarray2 = selfi.keyboard_write_text(text2)\r\n\r\ntext3 = tuple(\"Hello\")\r\ntextarray3 = selfi.keyboard_write_text(text3)\r\n\r\ntext4 = getkeys = [\r\n    \"Q\",\r\n    \"W\",\r\n    \"E\",\r\n    \"R\",\r\n    \"T\",\r\n    \"Y\",\r\n    \"U\",\r\n    \"I\",\r\n    \"O\",\r\n    \"P\",\r\n    \"\u00e7\",\r\n    \"\u00c7\",\r\n    \"\u00df\",\r\n    \"\u1e9e\",\r\n    \"+\",\r\n    \",\",\r\n    \"-\",\r\n    \".\",\r\n    \"/\",\r\n    \"\u00e3\",\r\n    \"\u00e0\",\r\n    \"\u00c3\",\r\n    \"~\",\r\n    \"a\",\r\n    \"b\",\r\n    \"ctrl+a\",\r\n]\r\ntextarray4 = selfi.keyboard_write_text(text4)\r\ntextarray4 = selfi.keyboard_write_text(text4)\r\npress1 = selfi.keyboard_press_key(key=\"A\", duration=0.1)\r\nprint(press1)\r\npress2 = selfi.keyboard_press_key_combination(\r\n    combination=[\"ctrl\", \"alt\", \"a\"], duration=0.1\r\n)\r\nprint(press2)\r\nselfi.map_keys({\"banana\": [\"KEY_B\", \"KEY_A\", \"KEY_N\", \"KEY_A\", \"KEY_N\", \"KEY_A\"]})\r\npress3 = selfi.keyboard_press_key(key=\"banana\", duration=0.1)\r\nprint(press3)\r\n\r\n# Writing text (using adb shell)\r\n# If you are running the software on the device, substitute the prefix 'adb_' with 'local_shell_', e.g.\r\n# adb_keyboard_press_key -> local_shell_keyboard_press_key\r\n# adb_keyboard_write_text -> local_shell_keyboard_write_text\r\n# Press key for a certain amount of time\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_keyboard_press_key(\r\n    key=\"a\",\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_keyboard_press_key\",\r\n    blocksize=72,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n# write a text\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_keyboard_write_text(\r\n    text=\"Hello my friend\",\r\n    path_on_device=\"/sdcard/adb_keyboard_write_text\",\r\n    blocksize=144,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n# press key combination\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_keyboard_press_key_combination(\r\n    combination=[\"ctrl\", \"a\"],\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_keyboard_press_key_combination\",\r\n    blocksize=72,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n\r\n# Mouse moving\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_from_to(\r\n    x1=10,\r\n    y1=10,\r\n    x2=500,\r\n    y2=400,\r\n    max_variationx=5,  # variations from being a straight line\r\n    max_variationy=5,\r\n    path_on_device=\"/sdcard/tmpcmd\",  # will be created\r\n    blocksize=72 * 12,  # controls the speed\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_from_to_natural(\r\n    x1=10,\r\n    y1=10,\r\n    x2=500,\r\n    y2=800,\r\n    max_variationx=3,\r\n    max_variationy=3,\r\n    multiply_each_iterration=2.0,\r\n    path_on_device=\"/sdcard/adb_mouse_move_from_to_natural\",\r\n    blocksize=72 * 24 * 64,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\nx_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_through_coordinates(\r\n    x_y_coordinates,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    path_on_device=\"/sdcard/adb_mouse_move_through_coordinates\",\r\n    blocksize=72 * 24,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\nx_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_through_coordinates_natural(\r\n    x_y_coordinates,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    multiply_each_iterration=2.0,\r\n    path_on_device=\"/sdcard/adb_mouse_move_through_coordinates_natural\",\r\n    blocksize=72 * 24 * 64,  # natural and exact have much more bytedata\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n\r\nx_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_from_current_to_natural(\r\n    x=500,\r\n    y=800,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    multiply_each_iterration=2.0,\r\n    path_on_device=\"/sdcard/adb_mouse_move_from_current_to_natural\",\r\n    blocksize=72 * 12 * 64,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_from_current_to(\r\n    x=500,  # uses getevent -lp to get the current mouse position\r\n    y=500,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    path_on_device=\"/sdcard/adb_mouse_move_from_current_to\",\r\n    blocksize=72 * 12,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nx_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_through_coordinates_from_current(\r\n    x_y_coordinates,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    path_on_device=\"/sdcard/adb_mouse_move_through_coordinates_from_current\",\r\n    blocksize=72 * 12,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nx_y_coordinates = [(200, 300), (100, 700), (400, 300), (300, 700)]\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_move_through_coordinates_from_current_natural(\r\n    x_y_coordinates,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    multiply_each_iterration=2.0,\r\n    path_on_device=\"/sdcard/adb_mouse_move_through_coordinates_from_current_natural\",\r\n    blocksize=72 * 12 * 64,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_touchscreen_swipe_from_to(\r\n    x1=10,\r\n    y1=10,\r\n    x2=500,\r\n    y2=800,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    random_number_start=100,\r\n    random_number_switch=4,\r\n    path_on_device=\"/sdcard/adb_touchscreen_swipe_from_to\",\r\n    blocksize=12 * 24,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_touchscreen_swipe_from_to_exact(\r\n    x1=10,\r\n    y1=10,\r\n    x2=500,\r\n    y2=800,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    random_number_start=100,\r\n    random_number_switch=4,\r\n    path_on_device=\"/sdcard/adb_touchscreen_swipe_from_to_exact\",\r\n    blocksize=24 * 24 * 128,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_touchscreen_swipe_through_coordinates(\r\n    x_y_coordinates=x_y_coordinates,\r\n    max_variationx=5,\r\n    max_variationy=5,\r\n    random_number_start=100,\r\n    random_number_switch=4,\r\n    path_on_device=\"/sdcard/adb_touchscreen_swipe_through_coordinates\",\r\n    blocksize=12 * 24 * 16,\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n# mouse commands binary data\r\nprint(selfi.mouse_map)\r\nprint(selfi.mouse_map_press)\r\nprint(selfi.mouse_map_release)\r\n\r\n# as numpy struct arrays\r\nbtn_extra = selfi.mouse_btn_extra()\r\nprint(btn_extra)\r\nbtn_extra_long = selfi.mouse_btn_extra_long(duration=1)\r\nprint(btn_extra_long)\r\nbtn_middle = selfi.mouse_btn_middle()\r\nprint(btn_middle)\r\nbtn_middle_long = selfi.mouse_btn_middle_long(duration=1)\r\nprint(btn_middle_long)\r\nbtn_mouse = selfi.mouse_btn_mouse()\r\nprint(btn_mouse)\r\nbtn_mouse_long = selfi.mouse_btn_mouse_long(duration=1)\r\nprint(btn_mouse_long)\r\nbtn_right = selfi.mouse_btn_right()\r\nprint(btn_right)\r\nbtn_right_long = selfi.mouse_btn_right_long(duration=1)\r\nprint(btn_right_long)\r\nbtn_side = selfi.mouse_btn_side()\r\nprint(btn_side)\r\nbtn_side_long = selfi.mouse_btn_side_long(duration=1)\r\nprint(btn_side_long)\r\nscroll_down = selfi.mouse_scroll_down()\r\nprint(scroll_down)\r\nscroll_down_long = selfi.mouse_scroll_down_long(duration=1)\r\nprint(scroll_down_long)\r\nscroll_up = selfi.mouse_scroll_up()\r\nprint(scroll_up)\r\nscroll_up_long = selfi.mouse_scroll_up_long(duration=1)\r\nprint(scroll_up_long)\r\n\r\n\r\n# Executing different mouse clicks:\r\n\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_extra(\r\n    path_on_device=\"/sdcard/adb_mouse_btn_extra\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_extra_long(\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_mouse_btn_extra_long\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_middle(\r\n    path_on_device=\"/sdcard/adb_mouse_btn_middle\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_middle_long(\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_mouse_btn_middle_long\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_mouse(\r\n    path_on_device=\"/sdcard/adb_mouse_btn_mouse\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_mouse_long(\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_mouse_btn_mouse_long\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_right(\r\n    path_on_device=\"/sdcard/adb_mouse_btn_right\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_right_long(\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_mouse_btn_right_long\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_side(\r\n    path_on_device=\"/sdcard/adb_mouse_btn_side\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_btn_side_long(\r\n    duration=1,\r\n    path_on_device=\"/sdcard/adb_mouse_btn_side_long\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_scroll_down(\r\n    reps=10,\r\n    path_on_device=\"/sdcard/adb_mouse_scroll_down\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\nsleep(1)\r\n\r\n(\r\n    binary_data,\r\n    finalcmd,\r\n    tmpfilebindevice,\r\n    tmpfileshdevice,\r\n    tmpfilebin,\r\n    tmpfilesh,\r\n    stuctarray,\r\n) = selfi.adb_mouse_scroll_up(\r\n    reps=10,\r\n    path_on_device=\"/sdcard/adb_mouse_scroll_up\",\r\n    delete_temp_files_on_device=False,\r\n    delete_temp_files_on_pc=False,\r\n)\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Sendevent - Android with Cython",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/cythonsendevent"
    },
    "split_keywords": [
        "android",
        " sendevent"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5130009201bf6db74d811542430817731925b13b792cb55ae10ad0424cbd355",
                "md5": "de6d45390046e16ea687c6a889ea02e7",
                "sha256": "3ef1e477891d4363b0d18f3cd35e4fcc8ec25c75b1b626d146d2c55f7fa911b4"
            },
            "downloads": -1,
            "filename": "cythonsendevent-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de6d45390046e16ea687c6a889ea02e7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 50358,
            "upload_time": "2024-09-17T00:31:45",
            "upload_time_iso_8601": "2024-09-17T00:31:45.421411Z",
            "url": "https://files.pythonhosted.org/packages/d5/13/0009201bf6db74d811542430817731925b13b792cb55ae10ad0424cbd355/cythonsendevent-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "387ed789d1a47e6c4cc55dda77de5f2a849244011d48cc8930572a3a4c43fca6",
                "md5": "4bed34673feaa528c8e0275918296af4",
                "sha256": "e695a2a4d0bc959e1f34b8b2bd212a356aaf4e3ab40e168fc12dce6d1cbee610"
            },
            "downloads": -1,
            "filename": "cythonsendevent-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "4bed34673feaa528c8e0275918296af4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 50859,
            "upload_time": "2024-09-17T00:31:47",
            "upload_time_iso_8601": "2024-09-17T00:31:47.078063Z",
            "url": "https://files.pythonhosted.org/packages/38/7e/d789d1a47e6c4cc55dda77de5f2a849244011d48cc8930572a3a4c43fca6/cythonsendevent-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-17 00:31:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "cythonsendevent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cythonsendevent"
}
        
Elapsed time: 5.03590s