-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,342 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include **/lib libRemoteInput* | ||
recursive-include **/lib/headers/ *.hxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
pillow = "*" | ||
pyautogui = "*" | ||
psutil = "*" | ||
setuptools = "*" | ||
|
||
[requires] | ||
python_version = "3.9" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import win32gui | ||
import win32ui | ||
from ctypes import windll | ||
from PIL import Image | ||
|
||
hwnd = win32gui.FindWindow(None, "Old School RuneScape") | ||
|
||
# Change the line below depending on whether you want the whole window | ||
# or just the client area. | ||
# left, top, right, bot = win32gui.GetClientRect(hwnd) | ||
left, top, right, bot = win32gui.GetWindowRect(hwnd) | ||
w = right - left | ||
h = bot - top | ||
|
||
hwndDC = win32gui.GetWindowDC(hwnd) | ||
mfcDC = win32ui.CreateDCFromHandle(hwndDC) | ||
saveDC = mfcDC.CreateCompatibleDC() | ||
|
||
saveBitMap = win32ui.CreateBitmap() | ||
saveBitMap.CreateCompatibleBitmap(mfcDC, w, h) | ||
|
||
saveDC.SelectObject(saveBitMap) | ||
|
||
# Change the line below depending on whether you want the whole window | ||
# or just the client area. | ||
result = windll.user32.PrintWindow(hwnd, saveDC.GetSafeHdc(), 1) | ||
# result = windll.user32.PrintWindow(hwnd, saveDC.GetSafeHdc(), 0) | ||
print(result) | ||
|
||
bmpinfo = saveBitMap.GetInfo() | ||
bmpstr = saveBitMap.GetBitmapBits(True) | ||
|
||
im = Image.frombuffer( | ||
"RGB", (bmpinfo["bmWidth"], bmpinfo["bmHeight"]), bmpstr, "raw", "BGRX", 0, 1 | ||
) | ||
|
||
im.show() | ||
win32gui.DeleteObject(saveBitMap.GetHandle()) | ||
saveDC.DeleteDC() | ||
mfcDC.DeleteDC() | ||
win32gui.ReleaseDC(hwnd, hwndDC) | ||
|
||
if result == 1: | ||
# PrintWindow Succeeded | ||
im.save("test.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pyautogui | ||
import _pyautogui_remoteinput | ||
|
||
pyautogui.platformModule = _pyautogui_remoteinput | ||
reflect = pyautogui.platformModule.REFLECT | ||
|
||
reflect.EIOS_Inject() | ||
|
||
# Get number of clients | ||
client_count = reflect.EIOS_GetClients() | ||
print(f"there are {client_count} clients") | ||
|
||
# Get first clients PID | ||
client_pid = reflect.EIOS_GetClientPID(0) | ||
|
||
# Pair the client and get the target or eios_ptr | ||
eios_ptr = reflect.EIOS_PairClient(client_pid) | ||
print(f"Pointer for the target for client is = {eios_ptr}") | ||
|
||
pyautogui.click(478, 294) | ||
pyautogui.click(375, 263) | ||
pyautogui.typewrite("password") | ||
pyautogui.click(329, 319) | ||
pyautogui.platformModule._size() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import getpass | ||
|
||
from pyautoeios.eios import EIOS | ||
from pyautoeios.hex_keycodes import VK_ESC, VK_LBUTTON | ||
|
||
print("injecting into client") | ||
# Create instance of Remote Input | ||
reflect = EIOS() | ||
|
||
# Get number of clients | ||
client_count = reflect.EIOS_GetClients() | ||
print(f"there are {client_count} clients") | ||
|
||
# Get first clients PID | ||
client_pid = reflect.EIOS_GetClientPID(0) | ||
|
||
# Pair the client and get the target or eios_ptr | ||
eios_ptr = reflect.EIOS_PairClient(client_pid) | ||
print(f"Pointer for the target for client is = {eios_ptr}") | ||
|
||
reflect.lose_focus(eios_ptr) | ||
have_focus1 = reflect.has_focus(eios_ptr) | ||
print(f"have_focus1 = {have_focus1}") | ||
|
||
reflect.gain_focus(eios_ptr) | ||
have_focus2 = reflect.has_focus(eios_ptr) | ||
print(f"have_focus2 = {have_focus2}") | ||
|
||
dimensions = reflect.get_target_dimensions(eios_ptr) | ||
print(f"dimensions = {dimensions}") | ||
|
||
mouse_position = reflect.get_mouse_position(eios_ptr) | ||
print(f"mouse_position = {mouse_position}") | ||
|
||
real_mouse_position = reflect.get_real_mouse_position(eios_ptr) | ||
print(f"real_mouse_position = {real_mouse_position}") | ||
|
||
print( | ||
"If you're at the login screen enter password to do a stupidly simple login _SCDECLpt with fixed coordinates" | ||
) | ||
password = getpass.getpass() | ||
if password: | ||
reflect.hold_key(eios_ptr, VK_ESC) | ||
time.sleep(0.3) | ||
reflect.release_key(eios_ptr, VK_ESC) | ||
reflect.hold_key(eios_ptr, VK_ESC) | ||
time.sleep(0.3) | ||
reflect.release_key(eios_ptr, VK_ESC) | ||
reflect.hold_key(eios_ptr, VK_ESC) | ||
time.sleep(0.3) | ||
reflect.release_key(eios_ptr, VK_ESC) | ||
|
||
reflect._EIOS_MoveMouse(eios_ptr, 478, 294) | ||
mouse_position = reflect.get_mouse_position(eios_ptr) | ||
print(f"mouse_position = {mouse_position}") | ||
|
||
reflect._EIOS_HoldMouse(eios_ptr, 478, 294, VK_LBUTTON) | ||
time.sleep(0.3) | ||
reflect._EIOS_ReleaseMouse(eios_ptr, 478, 294, VK_LBUTTON) | ||
mouse_position = reflect.get_mouse_position(eios_ptr) | ||
print(f"mouse_position = {mouse_position}") | ||
|
||
reflect._EIOS_HoldMouse(eios_ptr, 375, 263, VK_LBUTTON) | ||
time.sleep(0.3) | ||
reflect._EIOS_ReleaseMouse(eios_ptr, 375, 263, VK_LBUTTON) | ||
mouse_position = reflect.get_mouse_position(eios_ptr) | ||
print(f"mouse_position = {mouse_position}") | ||
|
||
reflect._EIOS_SendString(eios_ptr, password, 100, 100) | ||
|
||
reflect._EIOS_HoldMouse(eios_ptr, 329, 319, VK_LBUTTON) | ||
time.sleep(0.3) | ||
reflect._EIOS_ReleaseMouse(eios_ptr, 329, 319, VK_LBUTTON) | ||
mouse_position = reflect.get_mouse_position(eios_ptr) | ||
print(f"mouse_position = {mouse_position}") | ||
|
||
reflect._lose_focus(eios_ptr) | ||
reflect._EIOS_ReleaseTarget(eios_ptr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import importlib.resources | ||
f = importlib.resources.files(__package__) | ||
print(f / 'lib') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[metadata] | ||
name = pyautoeios | ||
version = attr: src.pyautoeios.__VERSION__ | ||
author = Brett Moan | ||
author-email = [email protected] | ||
home-page = https://github.com/BrettMoan/pyautoeios | ||
description = automate an old school classic | ||
long-description = file: README.md | ||
long_description_content_type = text/markdown | ||
license = BSD 3-Clause | ||
license-file = LICENSE | ||
platform = any | ||
keywords = {keywords} | ||
classifiers = | ||
Development Status :: 2 - Pre-Alpha | ||
Intended Audience :: Developers | ||
Intended Audience :: Science/Research | ||
License :: OSI Approved :: BSD License | ||
Environment :: Win32 (MS Windows) | ||
Operating System :: Microsoft :: Windows :: Windows 10 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: Implementation :: CPython | ||
Topic :: Software Development :: Libraries :: Python Modules | ||
Topic :: Games/Entertainment | ||
Topic :: Scientific/Engineering :: Image Recognition | ||
Topic :: Scientific/Engineering :: Image Processing | ||
project_urls = | ||
Bug Tracker = https://github.com/BrettMoan/pyautoeios/issues | ||
Changelog = https://github.com/BrettMoan/pyautoeios/blob/master/CHANGELOG.md | ||
|
||
include_package_data = True | ||
|
||
[options] | ||
package_dir= | ||
=src | ||
packages=find: | ||
|
||
[options.packages.find] | ||
where=src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import setuptools | ||
|
||
setuptools.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from pyautogui import * | ||
from pyautoeios import eios | ||
import pyautoeios.hex_keycodes as hexcodes | ||
from pyautoeios import _pyautogui_remoteinput | ||
platformModule = _pyautogui_remoteinput | ||
__AUTHOR__ = "[email protected]" | ||
__VERSION__ = "0.0.1" |
Oops, something went wrong.