pymousetracker 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymousetracker/__init__.py +3 -0
- pymousetracker/pymousetracker.py +150 -0
- pymousetracker-1.0.0.dist-info/METADATA +18 -0
- pymousetracker-1.0.0.dist-info/RECORD +8 -0
- pymousetracker-1.0.0.dist-info/WHEEL +5 -0
- pymousetracker-1.0.0.dist-info/entry_points.txt +2 -0
- pymousetracker-1.0.0.dist-info/licenses/LICENSE.txt +9 -0
- pymousetracker-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import pyautogui
|
|
2
|
+
import keyboard
|
|
3
|
+
import time
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
class CursorToolbox():
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.recorded_actions = []
|
|
9
|
+
|
|
10
|
+
def record_click_action(self):
|
|
11
|
+
x, y = pyautogui.position()
|
|
12
|
+
self.recorded_actions.append((x, y))
|
|
13
|
+
print(f"\n[RECORDED CLICK] -> pyautogui.click({x}, {y})")
|
|
14
|
+
|
|
15
|
+
def export_generated_code(self, filename="auto_generated_macro.py"):
|
|
16
|
+
if not self.recorded_actions:
|
|
17
|
+
print("\nNo actions recorded. Script generation canceled.")
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
with open(filename, "w") as f:
|
|
22
|
+
f.write("import pyautogui\n")
|
|
23
|
+
f.write("import time\n\n")
|
|
24
|
+
f.write("# Fail-safe: Moving mouse to any corner aborts pyautogui scripts\n")
|
|
25
|
+
f.write("pyautogui.FAILSAFE = True\n\n")
|
|
26
|
+
f.write("print('Starting automated script in 3 seconds... Move mouse to a corner to cancel.')\n")
|
|
27
|
+
f.write("time.sleep(3)\n\n")
|
|
28
|
+
|
|
29
|
+
for index, (x, y) in enumerate(self.recorded_actions):
|
|
30
|
+
f.write(f"# Action {index + 1}\n")
|
|
31
|
+
f.write(f"pyautogui.click({x}, {y})\n")
|
|
32
|
+
f.write("time.sleep(1.0) # Standard delay between actions\n\n")
|
|
33
|
+
|
|
34
|
+
f.write("print('Automation sequence complete.')\n")
|
|
35
|
+
|
|
36
|
+
absolute_path = os.path.abspath(filename)
|
|
37
|
+
print(f"\nSuccess! Python script generated at:\n{absolute_path}")
|
|
38
|
+
|
|
39
|
+
except Exception as e:
|
|
40
|
+
print(f"\nError writing the script file: {e}")
|
|
41
|
+
|
|
42
|
+
def _clear_keyboard_buffer(self):
|
|
43
|
+
# Helper to ensure keypresses don't leak into the terminal menu
|
|
44
|
+
time.sleep(0.3) # Short debounce pause
|
|
45
|
+
while keyboard.is_pressed('esc'):
|
|
46
|
+
time.sleep(0.01)
|
|
47
|
+
|
|
48
|
+
def mouseAutomationBuilder(self):
|
|
49
|
+
print("=" * 50)
|
|
50
|
+
print("CURSOR TOOLBOX: MOUSE AUTOMATION BUILDER")
|
|
51
|
+
print("=" * 50)
|
|
52
|
+
print("- Hover over an element and press 'Ctrl+Shift+S' to record a click.")
|
|
53
|
+
print("- Press 'Esc' to finish recording")
|
|
54
|
+
print("-" * 50)
|
|
55
|
+
|
|
56
|
+
self.recorded_actions = [] # Clear previous session data
|
|
57
|
+
keyboard.add_hotkey('ctrl+shift+s', self.record_click_action)
|
|
58
|
+
|
|
59
|
+
while not keyboard.is_pressed('esc'):
|
|
60
|
+
x, y = pyautogui.position()
|
|
61
|
+
position = f'X: {x:4} Y:{y:4} | Recorded Actions: {len(self.recorded_actions)}'
|
|
62
|
+
print(position, end='', flush=True)
|
|
63
|
+
print(end='\r')
|
|
64
|
+
time.sleep(0.05)
|
|
65
|
+
|
|
66
|
+
keyboard.clear_all_hotkeys()
|
|
67
|
+
print('\n\nStopping mouse recorder...')
|
|
68
|
+
|
|
69
|
+
self.export_generated_code()
|
|
70
|
+
self._clear_keyboard_buffer()
|
|
71
|
+
|
|
72
|
+
def mousePositionTracker(self):
|
|
73
|
+
print("=" * 50)
|
|
74
|
+
print("CURSOR TOOLBOX: MOUSE POSITION TRACKER")
|
|
75
|
+
print("=" * 50)
|
|
76
|
+
print("- Press 'Esc' to stop mouse tracking")
|
|
77
|
+
print("-" * 50)
|
|
78
|
+
|
|
79
|
+
while not keyboard.is_pressed('esc'):
|
|
80
|
+
x, y = pyautogui.position()
|
|
81
|
+
position = f'X: {x:4} Y:{y:4}'
|
|
82
|
+
print(position, end='', flush=True)
|
|
83
|
+
print(end='\r')
|
|
84
|
+
time.sleep(0.05)
|
|
85
|
+
|
|
86
|
+
print('\n\nStopping mouse tracker...')
|
|
87
|
+
self._clear_keyboard_buffer()
|
|
88
|
+
|
|
89
|
+
def mouseColorPicker(self):
|
|
90
|
+
print("=" * 50)
|
|
91
|
+
print("CURSOR TOOLBOX: MOUSE COLOR PICKER")
|
|
92
|
+
print("=" * 50)
|
|
93
|
+
print("- Press 'Space' to save a color layout.")
|
|
94
|
+
print("- Press 'Esc' to stop color tracking")
|
|
95
|
+
print("-" * 50)
|
|
96
|
+
|
|
97
|
+
while not keyboard.is_pressed('esc'):
|
|
98
|
+
x, y = pyautogui.position()
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
r, g, b = pyautogui.pixel(x, y)
|
|
102
|
+
hex_color = f"#{r:02X}{g:02X}{b:02X}"
|
|
103
|
+
color_string = f"RGB: ({r:3}, {g:3}, {b:3}) | HEX: {hex_color}"
|
|
104
|
+
except Exception:
|
|
105
|
+
color_string = "RGB: (N/A, N/A, N/A) | HEX: N/A"
|
|
106
|
+
|
|
107
|
+
if keyboard.is_pressed('space'):
|
|
108
|
+
print(f"\n[SAVED COLOR] X: {x:4}, Y: {y:4} | {color_string}")
|
|
109
|
+
time.sleep(0.3) # Avoid double logging
|
|
110
|
+
|
|
111
|
+
position = f'X: {x:4} Y:{y:4} | {color_string}'
|
|
112
|
+
print(position, end='', flush=True)
|
|
113
|
+
print(end='\r')
|
|
114
|
+
time.sleep(0.05)
|
|
115
|
+
|
|
116
|
+
print('\n\nStopping color picker...')
|
|
117
|
+
self._clear_keyboard_buffer()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def main():
|
|
121
|
+
tracker = CursorToolbox()
|
|
122
|
+
|
|
123
|
+
while True:
|
|
124
|
+
print("\n" + "=" * 50)
|
|
125
|
+
print(" CURSOR TOOLBOX CLI INTERFACE")
|
|
126
|
+
print("=" * 50)
|
|
127
|
+
print("1. Mouse Automation Builder (Record macro)")
|
|
128
|
+
print("2. Mouse Position Tracker (Live X/Y coordinates)")
|
|
129
|
+
print("3. Mouse Color Picker (Live RGB/HEX picker)")
|
|
130
|
+
print("4. Exit")
|
|
131
|
+
print("-" * 50)
|
|
132
|
+
|
|
133
|
+
choice = input("Select an option (1-4): ").strip()
|
|
134
|
+
|
|
135
|
+
if choice == '1':
|
|
136
|
+
tracker.mouseAutomationBuilder()
|
|
137
|
+
elif choice == '2':
|
|
138
|
+
tracker.mousePositionTracker()
|
|
139
|
+
elif choice == '3':
|
|
140
|
+
tracker.mouseColorPicker()
|
|
141
|
+
elif choice == '4':
|
|
142
|
+
print("\nExiting Cursor Toolbox. Goodbye!")
|
|
143
|
+
break
|
|
144
|
+
else:
|
|
145
|
+
if choice != "": # Ignore empty inputs caused by trailing keyboard events
|
|
146
|
+
print(f"\n[ERROR] '{choice}' is an invalid choice. Please enter 1, 2, 3, or 4.")
|
|
147
|
+
time.sleep(1)
|
|
148
|
+
|
|
149
|
+
if __name__ == "__main__":
|
|
150
|
+
main()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pymousetracker
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A simple mouse tracking, color picking, and macro generation utility.
|
|
5
|
+
Author-email: hlee100 <henrylee1606@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/hlee100/PyMouPosTracker
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
Requires-Dist: pyautogui
|
|
14
|
+
Requires-Dist: keyboard
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# pymousetracker Libary
|
|
18
|
+
A simple mouse tracking, color picking, and macro generation utility.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pymousetracker/__init__.py,sha256=Hr-e1__e1GZO7OtwnmxdntTraVz23MQdM1iP1CKn9O0,74
|
|
2
|
+
pymousetracker/pymousetracker.py,sha256=j6Hhx25qqlVzBqpTGM_SgVFQefp5BscT61P2V13CaxQ,5533
|
|
3
|
+
pymousetracker-1.0.0.dist-info/licenses/LICENSE.txt,sha256=rh6PJZGewsaMs85xMM_tYIhrKk9rRUYBbWON_7249-M,1095
|
|
4
|
+
pymousetracker-1.0.0.dist-info/METADATA,sha256=x91DN0xSqKoqjPzyBCLQbNPX4E6KNri8AG4YIVgiNpI,669
|
|
5
|
+
pymousetracker-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
pymousetracker-1.0.0.dist-info/entry_points.txt,sha256=gnDxFgHTHrvaZSMlDHb2G8WPl030NSvN4l76y3Ni8iU,55
|
|
7
|
+
pymousetracker-1.0.0.dist-info/top_level.txt,sha256=_rNSl9YrSrDrGtg_JtpVYA8IJMX0aPmt4DxS7V7lBJE,15
|
|
8
|
+
pymousetracker-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Henry Lee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.myguest.virtualbox.org
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pymousetracker
|