-
Notifications
You must be signed in to change notification settings - Fork 292
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
91 changed files
with
1,589 additions
and
296 deletions.
There are no files selected for viewing
Binary file not shown.
File renamed without changes.
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,5 @@ | ||
from zxtouch.client import zxtouch | ||
|
||
device = zxtouch("127.0.0.1") | ||
device.show_alert_box("ZXTouch Demo", "This is an AlertBox and will disappear in 3 seconds", 3) | ||
device.disconnect() |
This file was deleted.
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
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 |
---|---|---|
@@ -1,30 +1,14 @@ | ||
import socket | ||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
|
||
def pick_color(x, y): | ||
x = str(x) | ||
y = str(y) | ||
s.send(("223;;Pick color of coordinate (" + x + ", " + y + ");;1.5\r\n").encode()) | ||
print(s.recv(1024)) | ||
time.sleep(1.5) | ||
s.send(("23" + x + ";;" + y).encode()) | ||
data_arr = s.recv(1024).decode().split(";;") | ||
if int(data_arr[0]) == 0: | ||
s.send(("224;;(" + x + ", " + y + ") in RGB: (" + data_arr[1] + ", " + data_arr[2] + ", " + data_arr[3].replace("\r\n", "") + ");;2\r\n").encode()) | ||
else: | ||
s.send(("221;;Failed. Reason: " + data_arr[1].replace("\r\n", "") + ";;2\r\n").encode()) | ||
print(s.recv(1024)) | ||
|
||
s = socket.socket() | ||
s.connect(("127.0.0.1", 6000)) # connect to the tweak | ||
time.sleep(0.1) # please sleep after connection. | ||
|
||
s.send("223;;Return to home screen;;2\r\n".encode()) | ||
print(s.recv(1024)) | ||
time.sleep(2) | ||
pick_color(100, 100) | ||
time.sleep(2) | ||
pick_color(200, 200) | ||
|
||
|
||
s.close() | ||
device = zxtouch("127.0.0.1") | ||
device.show_toast(TOAST_MESSAGE, "Picking color from 100, 100 after 1.5 seconds...", 1.5) | ||
time.sleep(1.5) | ||
result_tuple = device.pick_color(100, 100) | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_MESSAGE, "Error while getting color. Error info: " + result_tuple[1], 1.5) | ||
else: | ||
result_dict = result_tuple[1] | ||
device.show_toast(TOAST_MESSAGE, "Red: " + result_dict["red"] + ". Green: " + result_dict["green"] + ". Blue: " + result_dict["blue"], 1.5) | ||
device.disconnect() |
Binary file not shown.
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,55 @@ | ||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
|
||
device = zxtouch("127.0.0.1") | ||
|
||
|
||
# screen size | ||
result_tuple = device.get_screen_size() | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_ERROR, "Cannot get screen size. Error " + result_tuple[1], 2) | ||
device.disconnect() | ||
exit(0) | ||
|
||
device.show_toast(TOAST_SUCCESS, "Screen width: " + str(int(float(result_tuple[1]["width"]))) + ". Height: " + str(int(float(result_tuple[1]["height"]))), 2) | ||
time.sleep(2) | ||
|
||
# screen orientation and scale | ||
result_tuple = device.get_screen_orientation() | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_ERROR, "Cannot get screen orientation. Error " + result_tuple[1], 2) | ||
device.disconnect() | ||
exit(0) | ||
|
||
result_tuple_scale = device.get_screen_scale() | ||
if not result_tuple_scale[0]: | ||
device.show_toast(TOAST_ERROR, "Cannot get screen scale. Error " + result_tuple[1], 2) | ||
device.disconnect() | ||
exit(0) | ||
|
||
device.show_toast(TOAST_SUCCESS, "Screen orientation: " + str(int(float(result_tuple[1][0]))) + ". Screen scale: " + str(int(float(result_tuple_scale[1][0]))), 2) | ||
time.sleep(2) | ||
|
||
# device info | ||
result_tuple = device.get_device_info() | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_ERROR, "Cannot get device info. Error " + result_tuple[1], 2) | ||
device.disconnect() | ||
exit(0) | ||
|
||
device.show_toast(TOAST_SUCCESS, "Name: " + result_tuple[1]["name"] + ". Model: " + result_tuple[1]["model"] + ". System: iOS " + result_tuple[1]["system_version"], 2) | ||
time.sleep(2) | ||
|
||
# battery info | ||
result_tuple = device.get_battery_info() | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_ERROR, "Cannot get battery info. Error " + result_tuple[1], 2) | ||
device.disconnect() | ||
exit(0) | ||
|
||
device.show_toast(TOAST_SUCCESS, "Battery Level: " + result_tuple[1]["battery_level"] + "%. Battery state: " + result_tuple[1]["battery_state_string"], 2) | ||
time.sleep(2) | ||
|
||
device.show_toast(TOAST_WARNING, "If you need more, please contact me on Github or Discord", 3) | ||
time.sleep(3) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,28 +1,15 @@ | ||
import socket | ||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
|
||
s = socket.socket() | ||
s.connect(("127.0.0.1", 6000)) # connect to the tweak | ||
time.sleep(0.1) # please sleep after connection. | ||
|
||
s.send("223;;Opening Settings;;2\r\n".encode()) | ||
print(s.recv(1024)) | ||
time.sleep(0.1) | ||
s.send("11com.apple.Preferences\r\n".encode()) | ||
print(s.recv(1024)) | ||
time.sleep(2) | ||
s.send("224;;Start image matching and searching for the VPN icon;;1\r\n".encode()) | ||
print(s.recv(1024)) | ||
time.sleep(1) | ||
s.send("222;;Please do not touch your screen until it finishes...;;20\r\n".encode()) | ||
print(s.recv(1024)) | ||
s.send("21/Library/Application Support/zxtouch/vpn.jpg;;8;;0.8;;0.8\r\n".encode()) | ||
data_arr = s.recv(1024).decode().split(";;") | ||
|
||
if int(data_arr[0]) == 0 and float(data_arr[1]) != 0 or float(data_arr[2]) != 0 or float(data_arr[3]) != 0 or float(data_arr[4]) != 0: | ||
s.send(("224;;Icon found!Coordinates - X: \r\n" + data_arr[1] + ". Y: " + data_arr[2] + ";;3").encode()) | ||
device = zxtouch("127.0.0.1") | ||
device.show_toast(TOAST_WARNING, "Start matching \"examples\" string on this page", 1.5, TOAST_BUTTOM) | ||
time.sleep(1.5) | ||
result_tuple = device.image_match("/var/mobile/Library/ZXTouch/scripts/examples/Image Matching.bdl/examples_folder.jpg") | ||
if not result_tuple[0]: | ||
device.show_toast(TOAST_ERROR, "Error happened while matching. Error: " + result_tuple[1], 1.5, TOAST_BUTTOM) | ||
else: | ||
s.send("221;;Match Failed;;1\r\n".encode()) | ||
|
||
print(s.recv(1024)) | ||
s.close() | ||
result_dict = result_tuple[1] | ||
if float(result_dict["width"]) != 0 and float(result_dict["height"]) != 0: | ||
device.show_toast(TOAST_SUCCESS, "X: " + result_dict["x"] + ". Y: " + result_dict["y"] + ". Width: " + result_dict["width"] + ". Height: " + result_dict["height"], 1.5, TOAST_BUTTOM) | ||
device.disconnect() |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
File renamed without changes.
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,33 @@ | ||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
|
||
device = zxtouch("127.0.0.1") | ||
device.show_toast(TOAST_MESSAGE, "Opening Notes...", 2) | ||
time.sleep(2) | ||
device.show_toast(TOAST_MESSAGE, "Please select an input field! 3...", 1) | ||
time.sleep(1) | ||
|
||
device.show_toast(TOAST_MESSAGE, "Please select an input field! 2...", 1) | ||
time.sleep(1) | ||
|
||
device.show_toast(TOAST_MESSAGE, "Please select an input field! 1...", 1) | ||
time.sleep(1) | ||
|
||
device.show_toast(TOAST_MESSAGE, "Inserting text...", 1.5) | ||
device.insert_text("This text is generated by zxtouch!") | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Hiding the keyboard...", 1.5) | ||
device.hide_keyboard() | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Move cursor to the left by 3 position", 1.5) | ||
device.move_cursor(-3) | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Delete 3 characters...", 1.5) | ||
device.insert_text("\b\b\b") | ||
time.sleep(1.5) | ||
|
||
device.disconnect() |
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 |
---|---|---|
@@ -1,20 +1,23 @@ | ||
import socket | ||
|
||
|
||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
|
||
s = socket.socket() | ||
s.connect(("127.0.0.1", 6000)) # connect to the tweak | ||
time.sleep(0.1) # please sleep after connection. | ||
device = zxtouch("127.0.0.1") | ||
|
||
s.send("221;;This is an error message toast;;1.5\r\n".encode()) | ||
print(s.recv(1024)) | ||
device.show_toast(TOAST_SUCCESS, "This is an success message toast", 1.5) | ||
time.sleep(1.5) | ||
s.send("222;;This is a warning message toast;;1.5\r\n".encode()) | ||
print(s.recv(1024)) | ||
|
||
device.show_toast(TOAST_ERROR, "This is an error message toast", 1.5) | ||
time.sleep(1.5) | ||
s.send("223;;This is a normal message toast;;1.5\r\n".encode()) | ||
print(s.recv(1024)) | ||
|
||
device.show_toast(TOAST_WARNING, "This is an warning message toast", 1.5) | ||
time.sleep(1.5) | ||
s.send("224;;This is a success message toast;;1.5\r\n".encode()) | ||
print(s.recv(1024)) | ||
|
||
s.close() | ||
device.show_toast(TOAST_MESSAGE, "This is an normal message toast", 1.5) | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_ERROR, "Toast can also be shown at bottom", 3, TOAST_BUTTOM) | ||
|
||
device.disconnect() |
1 change: 1 addition & 0 deletions
1
...pts/Touch Simulation.bdl/210102110339.raw → ...lation From Raw Data.bdl/210102110339.raw
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
12 changes: 12 additions & 0 deletions
12
Example-Scripts/Touch Simulation From Raw Data.bdl/info.plist
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Entry</key> | ||
<string>210102110339.raw</string> | ||
<key>FrontApp</key> | ||
<string>com.apple.springboard</string> | ||
<key>Orientation</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
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
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,34 @@ | ||
|
||
|
||
from zxtouch.client import zxtouch | ||
from zxtouch.toasttypes import * | ||
import time | ||
from zxtouch.touchtypes import * | ||
|
||
device = zxtouch("127.0.0.1") | ||
|
||
device.show_toast(TOAST_WARNING, "Touching point (400, 400)", 1.5) | ||
device.touch(TOUCH_DOWN, 1, 400, 400) | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Moving to point (400, 600)", 1.5) | ||
device.touch(TOUCH_MOVE, 1, 400, 600) | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Touch up", 1.5) | ||
device.touch(TOUCH_UP, 1, 400, 600) | ||
time.sleep(1.5) | ||
|
||
device.show_toast(TOAST_WARNING, "Touching point (100, 100)", 1.5) | ||
device.touch(TOUCH_DOWN, 1, 100, 100) | ||
time.sleep(0.1) | ||
device.touch(TOUCH_UP, 1, 100, 100) | ||
time.sleep(1.4) | ||
|
||
device.show_toast(TOAST_WARNING, "Multitouching...Point (300, 300) and (500, 500)", 2.5) | ||
device.touch_with_list([{"type": TOUCH_DOWN, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_DOWN, "finger_index": 2, "x": 500, "y": 500}]) | ||
time.sleep(1) | ||
device.touch_with_list([{"type": TOUCH_UP, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_UP, "finger_index": 2, "x": 500, "y": 500}]) | ||
|
||
|
||
device.disconnect() |
Empty file.
10 changes: 10 additions & 0 deletions
10
layout/usr/lib/python3.7/site-packages/zxtouch/constants.py
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,10 @@ | ||
TOAST_POSITION_TOP = 0 | ||
TOAST_POSITION_BOTTOM = 1 | ||
TOAST_POSITION_LEFT = 2 | ||
TOAST_POSITION_RIGHT = 3 | ||
|
||
TOAST_HIDE = 0 | ||
TOAST_ERROR = 1 | ||
TOAST_WARNING = 2 | ||
TOAST_NORMAL = 3 | ||
TOAST_SUCCESS = 4 |
Oops, something went wrong.