Skip to main content

auto control alpha 0.0.20

Project description

je_auto_control

install

pip install je_auto_control

example

  • All test in test dir

Windows

mouse

import time

from je_auto_control import win32_ctype_mouse_control as mouse_control
from je_auto_control.windows.mouse import win32_mouse_left
from je_auto_control.windows.mouse import win32_mouse_right

time.sleep(1)
print(mouse_control.position())
mouse_control.set_position(809, 388)
mouse_control.press_mouse(win32_mouse_right)
mouse_control.release_mouse(win32_mouse_right)
mouse_control.press_mouse(win32_mouse_left)
mouse_control.release_mouse(win32_mouse_left)

mouse_control.click_mouse(win32_mouse_left)

keyboard

from je_auto_control import win32_keyT
from je_auto_control import win32_keyE
from je_auto_control import win32_keyS
from je_auto_control import win32_ctype_keyboard_control as keyboard_control

keyboard_control.press_key(win32_keyT)
keyboard_control.press_key(win32_keyE)
keyboard_control.press_key(win32_keyS)
keyboard_control.press_key(win32_keyT)

screen

from je_auto_control import win32_screen

print(win32_screen.size())

scroll

import time

from je_auto_control import win32_ctype_mouse_control as mouse_control

time.sleep(3)
print(mouse_control.position())
mouse_control.scroll(500)

Image detect one image

import cv2

from je_auto_control import template_detection

# detect_threshold 0~1 , 1 is absolute equal
image_data_array = template_detection.find_image("../../test_template.png", detect_threshold=1, draw_image=True)

print(image_data_array[1])
print(image_data_array[2])

if len(image_data_array[2]) > 0:
    print("left_top", image_data_array[2][0], image_data_array[2][1])
    print("right_bottom", image_data_array[2][2], image_data_array[2][3])
    height = image_data_array[2][2] - image_data_array[2][0]
    width = image_data_array[2][3] - image_data_array[2][1]
    print(height, width)
    center = [int(height / 2), int(width / 2)]
    print(center)
    template_center = [image_data_array[2][0] + center[0], image_data_array[2][1] + center[1]]
    print(template_center)

cv2.imshow("test", image_data_array[0])
cv2.waitKey(0)
cv2.destroyAllWindows()

Image detect multi image

import cv2

from je_auto_control import template_detection

# detect_threshold 0~1 , 1 is absolute equal
image_data_array = template_detection.find_image_multi("../../test1.png", detect_threshold=1, draw_image=True)

print(image_data_array[1])

cv2.imshow("test", image_data_array[0])
cv2.waitKey(0)
cv2.destroyAllWindows()

Linux

mouse

from je_auto_control import x11_linux_mouse_control as linux_mouse
from je_auto_control import x11_linux_mouse_right

print(linux_mouse.position())
linux_mouse.set_position(100, 100)
print(linux_mouse.position())
linux_mouse.click_mouse(x11_linux_mouse_right)

keyboard

import time
from je_auto_control import x11_linux_keyboard_control as linux_keyboard
from je_auto_control import x11_linux_key_t
from je_auto_control import x11_linux_key_e
from je_auto_control import x11_linux_key_s

linux_keyboard.press_key(x11_linux_key_t)
linux_keyboard.release_key(x11_linux_key_t)
time.sleep(.01)
linux_keyboard.press_key(x11_linux_key_e)
linux_keyboard.release_key(x11_linux_key_e)
time.sleep(.01)
linux_keyboard.press_key(x11_linux_key_s)
linux_keyboard.release_key(x11_linux_key_s)
time.sleep(.01)
linux_keyboard.press_key(x11_linux_key_t)
linux_keyboard.release_key(x11_linux_key_t)

screen

from je_auto_control import x11_linux_screen

print(x11_linux_screen.size())

scroll

import time

from je_auto_control import x11_linux_mouse_control as linux_mouse

from je_auto_control import x11_linux_scroll_direction_down
from je_auto_control import x11_linux_scroll_direction_up

linux_mouse.scroll(5, x11_linux_scroll_direction_down)
time.sleep(1)
"""
this block just scroll test use








































"""
linux_mouse.scroll(5, x11_linux_scroll_direction_up)

Image detect

from je_auto_control import template_detection

image_data_array = template_detection.find_image("../../test_template.png", draw_image=True)

print(image_data_array[1])
print(image_data_array[2])

if len(image_data_array[2]) > 0:
    print("left_top", image_data_array[2][0], image_data_array[2][1])
    print("right_bottom", image_data_array[2][2], image_data_array[2][3])
    height = image_data_array[2][2] - image_data_array[2][0]
    width = image_data_array[2][3] - image_data_array[2][1]
    print(height, width)
    center = [int(height / 2), int(width / 2)]
    print(center)
    template_center = [image_data_array[2][0] + center[0], image_data_array[2][1] + center[1]]
    print(template_center)

Image detect multi image

from je_auto_control import template_detection

image_data_array = template_detection.find_image_multi("../../test_template.png", draw_image=True)

print(image_data_array[1])

OSX

mouse

from je_auto_control import osx_mouse
from je_auto_control import osx_mouse_right


osx_mouse.click_mouse(500, 100, osx_mouse_right)
print(osx_mouse.position())

keyboard

from je_auto_control import osx_keyboard
from je_auto_control import osx_key_t
from je_auto_control import osx_key_e
from je_auto_control import osx_key_s

osx_keyboard.press_key(osx_key_t, False)
osx_keyboard.press_key(osx_key_e, False)
osx_keyboard.press_key(osx_key_s, False)
osx_keyboard.press_key(osx_key_t, False)

screen

from je_auto_control import osx_screen

print(osx_screen.size())

scroll

from je_auto_control import osx_mouse

osx_mouse.scroll(100)

Image detect

from je_auto_control import template_detection

image_data_array = template_detection.find_image_multi("../../test_template.png", draw_image=True)

print(image_data_array[1])

Image detect multi image

from je_auto_control import template_detection

image_data_array = template_detection.find_image("../../test_template.png", draw_image=True)

print(image_data_array[1])
print(image_data_array[2])

if len(image_data_array[2]) > 0:
    print("left_top", image_data_array[2][0], image_data_array[2][1])
    print("right_bottom", image_data_array[2][2], image_data_array[2][3])
    height = image_data_array[2][2] - image_data_array[2][0]
    width = image_data_array[2][3] - image_data_array[2][1]
    print(height, width)
    center = [int(height / 2), int(width / 2)]
    print(center)
    template_center = [image_data_array[2][0] + center[0], image_data_array[2][1] + center[1]]
    print(template_center)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

je_auto_control-0.0.21.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

je_auto_control-0.0.21-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file je_auto_control-0.0.21.tar.gz.

File metadata

  • Download URL: je_auto_control-0.0.21.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

File hashes

Hashes for je_auto_control-0.0.21.tar.gz
Algorithm Hash digest
SHA256 13889df56925e780fe553b6dd8b73239968b7b48d8fd02533787177560241d91
MD5 a4cdcd0b0d7ff799d964613fded36a16
BLAKE2b-256 6b75df156544e337938d0e3c7397d28917553c3195c3366a58d57af0816b9212

See more details on using hashes here.

File details

Details for the file je_auto_control-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: je_auto_control-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

File hashes

Hashes for je_auto_control-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f85ea01e12660f85b4585d87799182fbd43255cfecf77906e88a5ec2f77b53
MD5 aace943746829259f96839435b9e2fd3
BLAKE2b-256 16be746e505c9febf1fcbc5d1e5689d46714f37ff0a83eb732c4be4c3ffdf484

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page